bugmake - Bugs: bug #37065, $(wildcard dir/*/.) is wrong...


bug #37065: $(wildcard dir/*/.) is wrong (worked fine in 3.81)

Submitted by:  None
Submitted on:  Thu Aug 9 23:02:20 2012  
Severity: 3 - NormalItem Group: Bug
Status: FixedPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.82Operating System: MS Windows
Fixed Release: 4.0Triage Status: Verified

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


Sun Apr 28 18:09:12 2013, comment #5:

Sorry, I missed the attached makefile.

This bug is now solved (commit 5667376). It was caused by a change in string_glob: in 3.81 it tested whether each file name returned by 'glob' actually existed, and discarded non-existent ones. Make 3.82 no longer does that, and this exposed a bug in MS-Windows 'stat' which assigns no special meaning to a file name that ends in "/."; it normalizes it, which removes the period and the slash, and returns information about a file without making sure it is a directory.

I solved this by using the local_stat wrapper on MS-Windows, which we arrange to be called from 'glob'. It now detects this special case and verifies that the parent directory exists and is a directory. We just need to remember never to remove the GLOB_ALTDIRFUNC flag from the call to 'glob' ;-)

Eli Zaretskii <eliz>
Project Member
Sun Apr 28 05:56:12 2013, comment #4:

Hi Eli; there's a makefile attached. It's maybe not everything we'd wish for in a repro case but it seems to be enough to try. Something like this (but translated to Windows):

should show just "foo/bar/." Rossen appears to be saying that on Windows, this will show "foo/bar/. foo/baz/." which is clearly not correct. I'm resetting the triage status: if this example doesn't work for you please update again. Cheers!

Paul D. Smith <psmith>
Project Administrator
Fri Aug 10 06:31:14 2012, comment #3:

Could you please show a short Makefile to reproduce the problem?


Eli Zaretskii <eliz>
Project Member
Thu Aug 9 23:17:02 2012, comment #2:

Sorry, again. This time I think I got it:
$(wildcard dir/*/.) matches non-directories for the `*'.

Rossen Mikhov <log65536>
Thu Aug 9 23:12:27 2012, comment #1:

Sorry, I messed up the markup.
I meant that +$(wildcard dir//.)+ matches non-directories for the `++'.

Rossen Mikhov <log65536>
Thu Aug 9 23:02:20 2012, original submission:

$(wildcard dir//.) matches non-directories for the `' (returns dir/somefile.txt/. as well as dir/subdir/.) in 3.82 (and latest CVS) on Windows.

This was a convenient way to get a list of sub-directories of a given directory. It used to work fine in 3.81 on Windows, and still does in 3.82 on other platforms.



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

Attach File(s):

Attached Files
file #26340:  Makefile added by log65536 (31B - 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 eliz (Posted a comment)
  • -unavailable- added by log65536 (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 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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun Apr 28 18:09:12 2013elizStatusNone=>Fixed
      Fixed ReleaseNone=>4.0
      Triage StatusNone=>Verified
    Sun Apr 28 05:56:12 2013psmithTriage StatusNeed Info=>None
    Sat Apr 27 17:14:01 2013elizTriage StatusNone=>Need Info
    Fri Aug 10 07:44:33 2012log65536Attached File-=>Added Makefile, #26340

    Back to the top

    Powered by Savane 3.1-cleanup1