[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK
From: |
Moritz Klammler |
Subject: |
bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK |
Date: |
Sat, 11 Dec 2021 23:19:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 |
Hi folks,
hope you don't mind an outsider (occasional Autotools user) joining the
discussion with some trivia.
On 12/11/21 22:52, Karl Berry wrote:
Hi Mike, Peter,
> or do we document that we expect `rm -f` to work,
I don't see a reason to break working code wrt rm -f merely for cosmetic
purposes.
test -z "$(VAR)" || rm -f $(VAR)
does not actually seem "awful" to me. And I fail to see any significant
gain by simplifying it.
I do have to say that I found it visually disturbing and the noise makes
it harder for me to understand what an Automake recipe does. Especially
when not looking at the code but the expended commands as printed during
execution.
Whatever POSIX says, we can be sure that reality differs.
Although systems that fail on "rm -f" are few and far between by now,
they are not nonexistent. So why break them?
My idea is to let the existing code stand (forever).
In the alternative, I agree with Peter that at least providing an
overridable variable would be desirable. --thanks, karl.
An alternative trick which I have used in my code and found much less
disturbing is to prepend an arbitrary, hopefully non-existent, file name
so the list of arguments will never be empty even if the variable is.
rm -f NOTFOUND $(VAR)
Note that the suggested
RM = rm -f
$(RM) $(VAR)
makes it very easy to inject this behavior; just set RM="rm -f NOTFOUND"
and you're good to go. You don't have to be able to expand the argument
list twice, which would be less trivial to inject.
I'm not aware of any situation where this trick doesn't work.
OpenPGP_signature
Description: OpenPGP digital signature
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK, Mike Frysinger, 2021/12/10
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK, Peter Johansson, 2021/12/10
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK, Mike Frysinger, 2021/12/11
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK, Peter Johansson, 2021/12/11
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK, Karl Berry, 2021/12/11
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK,
Moritz Klammler <=
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK, Mike Frysinger, 2021/12/13
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK, Karl Berry, 2021/12/15
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK, Mike Frysinger, 2021/12/15
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK, Karl Berry, 2021/12/16
- bug#10828: [RFC] POSIX will say running "rm -f" with no argument is OK, Karl Berry, 2021/12/11