Re: bug in $(wildcard) with trailing slash

2012-03-03 Thread Paul Smith
On Fri, 2012-03-02 at 06:57 -0700, Eric Blake wrote:
 Make fails to restrict output to just directories when a wildcard
 contains both a trailing slash and internal slashes, even though it does
 the right thing with no internal slashes.

Hi Eric;

This is actually a bug in glibc's glob() function (which I reported to
the glibc bugzilla almost 3 years ago but hasn't been looked at yet).
GNU make just calls glibc glob(), it doesn't do its own globbing.

GNU make bug report:  https://savannah.gnu.org/bugs/index.php?18123
glibc bug report: http://sourceware.org/bugzilla/show_bug.cgi?id=10278

Cheers!

-- 
---
 Paul D. Smith psm...@gnu.org  Find some GNU make tips at:
 http://www.gnu.org  http://make.mad-scientist.net
 Please remain calm...I may be mad, but I am a professional. --Mad Scientist


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


bug in $(wildcard) with trailing slash

2012-03-02 Thread Eric Blake
Make fails to restrict output to just directories when a wildcard
contains both a trailing slash and internal slashes, even though it does
the right thing with no internal slashes.

$ mkdir /tmp/example
$ cd /tmp/example/
$ touch a
$ mkdir b
$ printf 'all:\n\t@echo $(wildcard */)' | make -f -
b/
$ printf 'all:\n\t@echo $(wildcard ./*/)' | make -f -
./b/ ./a

Both invocations should have omitted a, since the trailing slash cannot
match a non-directory (other than a symlink to a directory).

$ make --version | head -n2
GNU Make 3.82
Built for x86_64-redhat-linux-gnu

I encountered this while writing a macro for libvirt; as a workaround, I
ended up using a trailing /. to force just directories, then using
$(patsubst) to strip things back to what I wanted in the first place.

cross_dirs=$(patsubst $(srcdir)/src/%.,%,$(wildcard $(srcdir)/src/*/.))

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org





signature.asc
Description: OpenPGP digital signature
___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make