These are two minor topics and I'm not asking for anything to be done about
either for the upcoming release but I thought it couldn't hurt to mention
them for discussion. First, the $(wildcard ...) function appears to rely on
stat(), not lstat(), which means it considers a dangling symlink to not
exist (test case below). This can be a pain in "make clean" scenarios and
other corner cases. One could imagine fixing this in the code with (say) a
$(wildcardl ...) function but it may be sufficient to address it in the
documentation. I've been able to work around any problems this causes by
use of $(shell ls ...).

Second: now that make has $(file ...) and can create files internally, not
just via a recipe, there is the possibility of race conditions such as two
make processes creating the same file and no internal way to uniqify them.
Would it make sense to publish a new variable like $(.MAKEPID) for that
use? I thought I had a test case for this but the problem turned out to be
different: however it still seems like a theoretical possibility. A
.MAKEPID variable could also be useful in strace etc scenarios.

Thanks,
David

Test case for wildcard:

$ ls -lrt
total 4
-rw-rw-r-- 1 xxxxxxxx users 120 Sep 10 09:05 Makefile
-rw-rw-r-- 1 xxxxxxxx users   0 Sep 10 09:06 target
lrwxrwxrwx 1 xxxxxxxx users   6 Sep 10 09:06 testlink -> target

$ cat Makefile
ifneq ($(wildcard testlink),)
  $(warning testlink is present)
else
  $(warning testlink does not exist)
endif
all:;@:

$ make
Makefile:2: testlink is present

$ rm target

$ make
Makefile:4: testlink does not exist
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to