On Mon, Jul 16, 2018 at 07:48:26AM -0400, Paul Smith wrote: > On Mon, 2018-07-16 at 15:30 +0800, Zorro Lang wrote: > > > [root@fedoravm tmp]# ls -l > > > total 4 > > > -rw-r--r--. 1 root root 206 Jul 15 14:58 Makefile > > > drwxr-xr-x. 1 root root 0 Jul 15 14:59 testdir > > > [root@fedoravm tmp]# cat Makefile > > > STRING1 = $(wildcard $(CURDIR)/[a-z]*/) > > > STRING2 = $(wildcard ./[a-z]*/) > > > default: > > > @echo STRING1="$(STRING1)" > > > @echo STRING2="$(STRING2)" > > > [root@fedoravm tmp]# make > > > STRING1=/root/tmp/testdir/ /root/tmp/Makefile > > > STRING2=./testdir/ ./Makefile This is the same bug I've reported (with a working fix) in http://lists.gnu.org/archive/html/bug-make/2018-06/msg00009.html The '[a-z] matching uppercase chars because of LC_COLLATE' aggravating "feature" is a red herring here; './[a-z]*/' shouldn't match 'makefile' either; it should only match directories. > > > [root@fedoravm tmp]# > > GNU make uses the system libc version of the glob(3) and fnmatch(3) > functions to implement its wildcard function on any system which > provides GNU libc. > > So, if there's a change which introduces a problem with wildcard it is > more likely to be related to the GNU libc implementation of glob() or > fnmatch(). There is a bug in glibc's glob() implementation. Here is a simple test case that's doing the exactly same things gnu make is doing to trigger it (use the GLOB_ALTDIRFUNC extension mechanism and set dirent.d_type to DT_UNKNOWN). The bug can also be triggered without GLOB_ALTDIRFUNC by using a filesystem without support for the d_type field (eg. minix fs). $ cc -Wall -O2 glob_onlydir.c -o glob_onlydir $ mkdir -p test/dir $ touch test/file $ ./glob_onlydir 'test/*' test/dir test/file $ cat glob_onlydir.c #include <stdio.h> #include <glob.h> #include <dirent.h> #include <sys/stat.h> static void *my_readdir(void *v){ struct dirent *d = readdir(v); if(d) d->d_type = DT_UNKNOWN; return d; } int main(int ac, char **av){ int i, j; glob_t g = {0}; g.gl_opendir = (void*(*)(const char*))opendir; g.gl_closedir = (void(*)(void*))closedir; g.gl_stat = (int(*)(const char*, void*))stat; g.gl_lstat = (int(*)(const char*, void*))lstat; g.gl_readdir = my_readdir; for(i = 1; i < ac; i++) if(glob(av[i], GLOB_ONLYDIR|GLOB_ALTDIRFUNC, 0, &g) == 0) for(j = 0; j < g.gl_pathc; j++) printf("%s\n", g.gl_pathv[j]); return 0; } -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html