Age | Commit message (Collapse) | Author |
|
|
|
Instead of unlink() && check errno, call lstat() explicitly to check
file existence if "-f" is specified.
There is a regression when if the path to be removed is nonexistence
and within a readonly filesystem, then unlink() could set the EROFS
errno instead of ENOENT, thus screwing up the output of `rm`.
|
|
|
|
|
|
|
|
Before:
$ ./rm
rm: Needs 1 argument
$ ./rmdir
rmdir: Needs 1 argument (see "rmdir --help")
After:
$ ./rm
rm: Needs 1 argument (see "rm --help")
|
|
Gentoo removes verbosely when building packages, for example vim-core:
https://github.com/gentoo/gentoo/blob/665eaa8/app-editors/vim-core/vim-core-8.1.0648.ebuild#L120
Implement like toy cp, without prepending an escape sign to quotation
marks in filenames. Document in a test this difference from coreutils
but similarity to busybox. How do other implementations handle such
escapes? If it matters, would you approach it with a loop and multiple
prints or somehow else?
Short help description follows 141a075, consistent with other commands.
|
|
Be consistent about upper versus lower case. (Upper seems to have the
majority, so I went with that, though I'm happy to provide the opposite
patch as long as we're consistent!)
Be consistent about using \t. (Though saving a few bytes seems like it
might be better done in the code that generates help.h rather than
directly in the source, since tabs make careful ASCII art layout hard
enough that we regularly have things misaligned.)
Remove trailing periods (most of which seem to have been added by me).
Always use the US "human readable" rather than my British
"human-readable", and be more consistent about declaring whether we're
showing multiples of 1000 or 1024.
Just say "verbose" rather than adding a useless "mode" or "output".
|
|
line aren't filtered out. Audited all the callers and removed redundant
calls, adjusted call sequence, etc. (And let rm _not_ do this, because posix.)
|
|
checking, and fix up format checking complaints.
Added out(type, value) function to stat to avoid a zillion printf typecasts.
|
|
This fixes the build break, the change to yesno() prototype accidentally got
checked in last commit. (Oops, sorry.)
|
|
(If you had a chmod 000 directory and did rm -r on it without -f, after the prompt it would complain it was a directory.)
|
|
faccessat(AT_SYMLINK_NOFOLLOW) is not supported.
|
|
search.
(Fixes messages about not being able to delete directories when running make test).
|
|
"does it exist" test (to avoid errors on rm -f of nonexistent files) said it didn't.
The fix: replace the access() with unlink(), which produces the same "does not
exist" errno and has the added bonus of acting as a fastpath for rm -f on
non-directories. (And since it produces a different error on directories,
falls through to the old behavior there.)
Most of this commit is comment updates explaining being subtle. :)
|
|
open, and add dir->again variable to distinguish second call instead of checking for -1 filehandle.
|
|
|
|
|
|
Previous version didn't delete it, but exited without error. Neither was right.
|
|
other places that were setting it that no longer need to.
|
|
apparently is not an error.
|
|
supposed to implement this as a wrapper uClibc gets it wrong. So use the stat info about symlinks instead. (Doesn't check the parent directory, but if that's read only we can't delete the file anyway so prompting is moot.)
|
|
|
|
|