bugmake - Bugs: bug #21231, $(wildcard ) function sometimes...

 
 

bug #21231: $(wildcard ) function sometimes fails very strangely

Submitted by:  Jun Chen <chjfth>
Submitted on:  Wed 03 Oct 2007 01:51:25 AM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: FixedPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: 3.81Operating System: Any
Fixed Release: 3.82Triage 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 09:22:00 PM UTC, comment #3:

Fixed. Thanks for your report.

Paul D. Smith <psmith>
Project AdministratorIn charge of this item.
Tue 27 Nov 2007 01:47:43 AM UTC, comment #2:

Thank you for your comment on Friday 11/23/07. As you said, putting out.txt in a subdir does not exhibit the problem -- that's right. However, I encountered that $(wildcard ) problem in my real-world makefiles when out.txt(other name may be used though) is put in a subdir within current dir. Since my real-world working makefiles(GnumakeUniproc) are quite complicated so that it is unsuitable to paste it here as an example, I tried to dig out the simplist case that show my problem(as my post here on Wednesday 10/03/07).

However, beside from using GnumakeUniproc, I find it's hard to forge an example that can demonstrate the $(wildcard ) problem when the file being tested by $(wildcar ) is in a subdir.

Anyhow, I think it should be a problem to fix.

(Attachment is a makefile that does show this problem, for memorial purpose.)

(file #14489)

Jun Chen <chjfth>
Fri 23 Nov 2007 03:59:54 PM UTC, comment #1:

this appears to be normal behavior. wildcard reads from its own cache and the current dir is cached upon startup. -- put out.txt in a subdir and you will see the difference. The subdir is not cached until the wildcard is performed.

Anonymous
Wed 03 Oct 2007 01:51:25 AM UTC, original submission:

I encountered a strange situation recently, $(wildard ) function seems failing to work. See my code below:

========================================================
all: first_target

outfile = out.txt

$(outfile):
@echo nnn > $@

.PHONY: prj_count
prj_count:
@echo "[[$(outfile)]] <<$(wildcard $(outfile))>> "

.PHONY: first_target
first_target: $(outfile) prj_count
@echo "[DONE]"
========================================================

First, delete out.txt and run make on that makefile, the output is

[[out.txt]] <<>>
[DONE]

then, run make again, the output is

[[out.txt]] <<out.txt>>
[DONE]

Result of the first run is strange. When target prj_count is being made, out.txt should have been generated on my disk(because $(outfile) had been made before), then WHY $(wildcard out.txt) gives me null result ?

I've tested it on make 3.80 & 3.81 on Linux and on Windows(MSVC-built), both produce the same result.

Reference mailling list item: http://lists.gnu.org/archive/html/help-make/2007-09/msg00060.html

Jun Chen <chjfth>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #14489:  tt.mk added by chjfth (1KiB - text/plain)

 

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 chjfth (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements 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
    Wed 28 Jul 2010 06:17:41 AM UTCpsmithFixed Release4.0=>3.82
    Sat 13 Jun 2009 09:22:00 PM UTCpsmithStatusNone=>Fixed
      Assigned toNone=>psmith
      Open/ClosedOpen=>Closed
      Fixed ReleaseNone=>4.0
    Tue 27 Nov 2007 01:47:43 AM UTCchjfthAttached File-=>Added tt.mk, #14489

    Back to the top


    Powered by Savane 3.1-cleanup1