|
From: | Martin Dorey |
Subject: | Re: [PATCH] doc: note that $(wildcard) is implemented in terms of glob(3) |
Date: | Fri, 3 Dec 2021 22:08:28 +0000 |
It was documented but only in NEWS:
martind@sirius:~/download/make$ sgrep wildcard | grep sort
./NEWS:179:* All wildcard expansion within GNU make, including $(wildcard ...), will sort
./NEWS:426: results from wildcard expansions, use the $(sort ...) function to request
./ChangeLog.3:1586: * NEWS: Accidentally forgot to back out the sorted wildcard
martind@sirius:~/download/make$
That non-sorting of multiple arguments to wildcard, eg *.c *.h, is a nice gotcha, which wasn't in the NEWS item (presumably it didn't change). Not for me to say but the whole issue does feel worth a few lines to me. Then there's the wider topic of reproducible
builds but perhaps I shouldn't pull on loose ends.
From: Bug-make <bug-make-bounces+martin.dorey=hds.com@gnu.org> on behalf of Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Sent: Friday, December 3, 2021 13:10 To: psmith@gnu.org <psmith@gnu.org> Cc: bug-make@gnu.org <bug-make@gnu.org> Subject: Re: [PATCH] doc: note that $(wildcard) is implemented in terms of glob(3) ***** EXTERNAL EMAIL *****
On Fri, Dec 03 2021, Paul Smith wrote: > On Fri, 2021-12-03 at 11:08 +0100, Ævar Arnfjörð Bjarmason wrote: >> The motivation for this patch is that I've seen code like this in the >> wild: >> >> FILES = $(sort $(wildcard t*.sh)) >> >> I thought that it would be documented that that sort of thing was >> redundant, but I didn't find any mention of it in the manual. After >> some source spelunking I came up with this addition, which would have >> helped me when I consulted the manual. > > Originally it was not _guaranteed_ that wildcard yields sorted output. > > However, the output did happen to be sorted in older versions of GNU > make. In GNU make 3.82, that was changed to yield unsorted output. As > of GNU make 4.3, it was changed back and it is now guaranteed that > wildcard results are sorted: > > https://nam04.safelinks.protection.outlook.com/?url=""> > > I thought that I had updated the documentation to make this guarantee > clear but perhaps I forgot? As far as the proposed update goes what I should have noted that individual arguments to "wildcard" expand to sorted globs, but as noted in the thread: $(wildcard ? ?) Will return e.g. "1 2 3 1 2 3". Would a patch that's updated to note that, and discusses the behavior in older versions be acceptable for inclusion? Unless there's some place where this is documented that I didn't spot... |
[Prev in Thread] | Current Thread | [Next in Thread] |