bugmake - Bugs: bug #14617, wildcard function produces...

 
 

bug #14617: wildcard function produces incorrect results because of cache

Submitted by:  Matthew Carter <mcarter>
Submitted on:  Thu 22 Sep 2005 03:57:23 PM UTC  
Votes:  1  
 
Severity: 3 - NormalItem Group: Bug
Status: DuplicatePrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.80Operating System: POSIX-Based
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 13 Jun 2009 08:04:56 PM UTC, comment #4:

Closed as a duplicate of bug #443

Paul D. Smith <psmith>
Project Administrator
Wed 23 Apr 2008 06:57:20 PM UTC, comment #3:

It looks like the problem is still present. Tested on Ubuntu Gutsy.

AZ <alfonsname>
Fri 07 Jul 2006 02:40:46 AM UTC, comment #2:

An additional option beyond what I mentioned is to address the "problem" at the point it occurs, in $(wildcard):

Either an optional param to $(wildcard --ignorecache ...), or
an alternate named function for the same: $(wildcard-nocache ...).

Larry West <larrywest42>
Fri 07 Jul 2006 02:34:31 AM UTC, comment #1:

I'm seeing the same problem, I believe, on RHEL 4 with Make 3.80. In my case, I'm testing for a (target-like) directory with $(wildcard $(DIR)), then creating the directory. In my real Makefile, a later sanity test with $(if $(wildcard $(DIR)) then aborts, even though the directory does indeed exist.

I see the need for cacheing to minimize the time spent calling stat(2), as mentioned in bug #443, but I think there should be some mechanism to invalidate the cache.

The easiest would be to invalidate the cache when a shell command is invoked. Possibly make this an attribute for some target trees via a phony target like .PRECIOUS:

.INVALIDATE_CACHE_WHEN_SHELLING: targ1 targ2

.INVALIDATE_CACHE_WHEN_SHELLING: # no dependencies = "always"

Of course a less stupid name would be preferable.

Or an explicit function: $(invalidate_cache), possibly accepting a list of filenames: $(invalidate_cache file1 file2) if it's not too much work.

Anyway, I'm uploading an example Makefile that demonstrates the problem, and the output from "make -d -p".

Larry West <larrywest42>
Thu 22 Sep 2005 03:57:23 PM UTC, original submission:

This issue is similar to bug #443, but is different in that it does not use multiple invocations of the $(wildcard) function.

Reproduced on Linux Fedora Core 3 and on cygwin.

Symptoms:
Running "make" with the attached Makefile shows a contradiction: The "$(shell ls ${file})" command demonstrates that $file exists, yet the subsequent "$(wildcard ${file})" command indicates that it does not.

A subsequent run of "make", after $file has been created, does not reproduce the problem. This indicates to me that the problem results from $(wildcard) using a directory cache.

The implicit rule at the bottom of Makefile seems to be necessary to reproduce the problem, even though the implicit rule is overridden by the explicit rule and is, therefore, never invoked.

Matthew Carter <mcarter>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #10317:  wildcard-cache.tgz added by larrywest42 (5KiB - application/octet-stream - tgz w/ Makefile & output illustrating $(wildcard) cacheing problem)
file #3093:  Makefile added by mcarter (278B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by alfonsname (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 1 encouragement so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 13 Jun 2009 08:04:56 PM UTCpsmithStatusNone=>Duplicate
      Open/ClosedOpen=>Closed
    Fri 07 Jul 2006 02:34:31 AM UTClarrywest42Attached File-=>Added wildcard-cache.tgz, #10317
      Carbon-Copy-=>Added -unavailable-
      Carbon-Copy-=>Added larrywest42
    Thu 22 Sep 2005 03:57:23 PM UTCmcarterAttached File-=>Added Makefile, #2986

    Back to the top


    Powered by Savane 3.1-cleanup1