bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: makefile rules


From: Paul Eggert
Subject: Re: makefile rules
Date: Tue, 21 Dec 2021 12:12:04 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1

On 12/21/21 11:50, Jim Meyering wrote:
One must delete $@ and the potential $@-t temporary file in any rule
that creates a generated file and marks it (as I prefer always to do) as
read-only by using chmod to subtract write permissions.

Otherwise, the attempt to redirect to $@-t (when it is read-only) will fail.
Gnulib isn't doing a chmod -w so that shouldn't be an issue here.

Quite possibly Gnulib's 'rm -f $@' got copied from earlier recipes that did 'chmod -w' for the reason you mention.
If we were going to do a 'chmod -w' then we could do "create $@-t; chmod 
a-w $@-t; mv -f $@-t $@' which (though not perfect) would be good 
enough. Perhaps we didn't do that long ago in coreutils etc. because 'mv 
-f' wasn't universal way back then? It's safe to assume 'mv -f' 
nowadays, though.
My preference is to not do the chmod -w, though, as I've found it to be 
more of a hassle than a help. Even though 'configure' creates a bunch of 
files that could be read-only, it's nice to be able to edit them easily 
while debugging a 'make' gone wrong. Similarly for the .h files that the 
Gnulib recipes generate.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]