bugmake - Bugs: bug #443, $(wildcard) function uses...

 
 

bug #443: $(wildcard) function uses directory cache: gives incorrect results sometimes

Submitter:  Invalid User ID <#7558>
Submitted:  Thu 23 May 2002 11:06:37 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Duplicate Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.79.1 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 13 Jun 2009 10:04:02 PM UTC, comment #3: 

I'm not convinced that the entirety of this bug is fixed but the example given here was fixed as a result of the fix for Savannah bug #21231.

Until we come up with an example that is not fixed I'm closing this as a duplicate.

Paul D. Smith <psmith>
Group administrator
Sat 13 Jun 2009 08:05:24 PM UTC, comment #2: 

Bug #14617 is closed as a duplicate of this bug.

Paul D. Smith <psmith>
Group administrator
Thu 23 May 2002 01:22:12 PM UTC, comment #1: 

It is not true that make evaluates all $(wildcard *) functions when the first one is invoked.  In fact, in your example the wildcard in GENERATED_FILES is never even evaluated: you could comment out that line and see the same behavior.

However, GNU make does have a directory cache which is used for a significant performance advantage; much of the time make spends is for doing stat(2) system calls.  It's this cache which is causing the behavior you're seeing.

Because your rule says it will create the file "generate_code", that's what make will put into its directory cache.  Since you do not say you will create the file "generated_file", it won't appear in the cache.

Anonymous
Thu 23 May 2002 11:06:37 AM UTC, original submission:  

If a $(wildcard) function is used in several places within a makefile, Make evaluates all their values whenever the first instance of the wildcard function is evaluated, not when the rule containing that wildcard function is invoked. This bug becomes apparent when the wildcard function is looking for files that are generated during the build so they may not exist when one wildcard function is called but should exist when another is called. However because make evaluates all the wildacrds at the same time neither will be able to pick up the generated files.

An example of this occurring can be seen in the attached file Makefile.broken.

When this is run with the following command:

gmake -f Makefile.broken depend

The file 'generated_file' is created and then the makefile tries to list this generated file by invoking the command:

ls -l $(wildcard gen*)

The output from the build is:

touch generated_file
ls -l
total 16
-rw-r--r--    1 jtooley  staff           0 May 23 11:59 generated_file
-rw-r--r--    1 jtooley  staff         122 May 23 11:28 Makefile.broken
-rw-r--r--    1 jtooley  staff         119 May 23 11:08 Makefile.working

The result of the $(wildcard) function is empty as it was evaluated before the generated_file was created, when another wildcard function was called.

Invalid User ID <#7558>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by srivasta (So that the Debian BTS may track progress on this)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-06-13 psmith StatusNone Duplicate
        Open/ClosedOpen Closed
    2006-03-20 srivasta Carbon-Copy- Added -email is unavailable-
    2003-01-28 psmith SummaryMake evaluates all $(wildcard) functions when the first $(wilcard) function is evaluated

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code