* [Buildroot] usage of '-rm -f ...' in .mk files
@ 2007-10-08 22:28 Cristian Ionescu-Idbohrn
2007-10-09 0:03 ` Alexander Kriegisch
0 siblings, 1 reply; 2+ messages in thread
From: Cristian Ionescu-Idbohrn @ 2007-10-08 22:28 UTC (permalink / raw)
To: buildroot
Is there a point (I'm missing) with that? The rm manpage on my box
states:
-f, --force
ignore nonexistent files, never prompt
Shouldn't every occurence of '-rm -f' be replaced with just 'rm -f'?
Even files with permission 000 (owned by me) can be removed with 'rm -f'
with the exit status 0. Of course one should not be able to remove files
owned by someone else (unless permission is given to so) and an error
status should be produced.
Isn't it so that we want to know if an attempt to remove unremovable files
occurs, instead of ignoring errors by using '-rm -f'?
Cheers,
--
Cristian
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Buildroot] usage of '-rm -f ...' in .mk files
2007-10-08 22:28 [Buildroot] usage of '-rm -f ...' in .mk files Cristian Ionescu-Idbohrn
@ 2007-10-09 0:03 ` Alexander Kriegisch
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Kriegisch @ 2007-10-09 0:03 UTC (permalink / raw)
To: buildroot
> Isn't it so that we want to know if an attempt to remove unremovable
> files occurs, instead of ignoring errors by using '-rm -f'?
I would say it depends on the situation. Normally the inability to
remove files during a cleanup might not be considered worthy of turining
into a show-stopper for the whole make process. In other cases that
might well be so, and I guess it should be up to the developer writing
the makefile to decide if she wants a possible error printed, but
continue with whatever target is being built, or if she regards a failed
unlink severe enough to yield an error.
Having said that, I concede that "rm -f" usually does not exit with an
error anyway, thus rendering "-rm -f" kind of useless. But on the other
hand, double safety never hurts, and explicit coding helps understand
what the author intends with a certain line of code. The leading dash is
a clear statement saying "whatever happens, go on". Furthermore, there
might be improbable cases in which a certain "rm" implementation might
yield an error anyway. Given the fact that Busybox sometimes is very
terse in error handling, leaving out improbable error conditions in
order to save space, I would not say that an error during "rm -f" is
absolutely impossible. I have not looked into the source code, though.
Regards
--
Alexander Kriegisch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-09 0:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-08 22:28 [Buildroot] usage of '-rm -f ...' in .mk files Cristian Ionescu-Idbohrn
2007-10-09 0:03 ` Alexander Kriegisch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox