|
|
Log in / Subscribe / Register

Wheeler: Fixing Unix/Linux/POSIX Filenames

Wheeler: Fixing Unix/Linux/POSIX Filenames

Posted Mar 25, 2009 18:43 UTC (Wed) by danielthaler (guest, #24764)
In reply to: Wheeler: Fixing Unix/Linux/POSIX Filenames by rsidd
Parent article: Wheeler: Fixing Unix/Linux/POSIX Filenames

I just tested this, as I remeber doing this a few times without any catastrophic removals of "..". I got:

rm: cannot remove directory `.'
rm: cannot remove directory `..'

so something did prevent it from happening...


to post comments

Wheeler: Fixing Unix/Linux/POSIX Filenames

Posted Mar 25, 2009 21:43 UTC (Wed) by mjthayer (guest, #39183) [Link] (1 responses)

I believe that GNU rm does a few additional sanity checks.

Wheeler: Fixing Unix/Linux/POSIX Filenames

Posted Mar 25, 2009 22:46 UTC (Wed) by nix (subscriber, #2304) [Link]

A *few*? Have a read of coreutils-7.1/src/remove.c one of these days. 50K
of mostly sanity checks and fantastically elaborate code for portably and
securely recursing down directory trees, even those longer than PATH_MAX.

GNU coreutils, like gnulib, is a goldmine of fantastic tricks (and evil
ones that it's best to, ahem, admire from a distance: e.g. the less said
about NEED_REWIND and the need for rm running everywhere to work around a
MacOS X bug, the better).


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds