Discussion:
[bug #54816] $(wildcard ...) function does not report dangling symlinks
David Boyce
2018-10-10 13:32:49 UTC
Permalink
URL:
<https://savannah.gnu.org/bugs/?54816>

Summary: $(wildcard ...) function does not report dangling
symlinks
Project: make
Submitted by: boyski
Submitted on: Wed 10 Oct 2018 01:32:48 PM UTC
Severity: 3 - Normal
Item Group: Documentation
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: SCM
Operating System: POSIX-Based
Fixed Release: None
Triage Status: None

_______________________________________________________

Details:

According to the manual the wildcard function "is replaced by a
space-separated list of names of existing files ...". However, it does not
find a symbolic link which exists but does not point to an existing file
(apparently wildcard uses stat, not lstat). It's not clear to me whether this
is a code or a documentation bug but it ought to be clarified in the doc at
the least. Here's a test case:

% ls -lrt
total 4
-rw-rw-r-- 1 xxxxxxx users 42 Oct 10 06:24 Makefile
lrwxrwxrwx 1 xxxxxxx users 11 Oct 10 06:24 yes -> /etc/passwd
lrwxrwxrwx 1 xxxxxxx users 9 Oct 10 06:25 no -> /etc/asdf

% cat Makefile
$(info FOUND: $(wildcard yes no))
all:;@:

% make
FOUND: yes




_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?54816>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
Paul D. Smith
2018-10-10 14:30:54 UTC
Permalink
Follow-up Comment #1, bug #54816 (project make):

wildcard invokes the system glob() function. It doesn't do any extra checking
beyond that, that I recall (like a stat etc.) I don't know why glob() would
not return symlinks but I couldn't find anything in the man page about it,
either way. I'll need to debug it.

_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?54816>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
Andreas Schwab
2018-10-10 14:49:35 UTC
Permalink
Follow-up Comment #2, bug #54816 (project make):

See glibc bug 866 <https://sourceware.org/bugzilla/show_bug.cgi?id=866> which
was only fixed recently.

_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?54816>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Loading...