5 ms·
.* will be expanded by the shell to . .. and all local files beginning with . the BSD version of rm will never remove . or .. see: https://github.com/freebsd
by nikcub 14y ago
.* will be expanded by the shell to . ..
and all local files beginning with .
the BSD version of rm will never remove . or .. see:
https://github.com/freebsd/freebsd/blob/master/bin/rm/rm.c#L583 https://github.com/freebsd/freebsd/blob/master/bin/rm/rm.c#L...
checkdot is called against all argv:
https://github.com/freebsd/freebsd/blob/master/bin/rm/rm.c#L150 https://github.com/freebsd/freebsd/blob/master/bin/rm/rm.c#L...
any version of rm that does remove '.' or '..' is not POSIX compliant.
The GNU coreutils version of rm does not contain this check:
http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/rm.c;h=02809f21452c56cef035c653ef1686f1a747bca5;hb=master http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f...
(edit: it does - thanks, was running from memory and didn't actually check it)
- caf 14y agoThe GNU version of rm does contain this check - it's in remove.c, not rm.c: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/remove.c;h=f44a9821b6e5f2d43bbcc444893746be2576c3c7;hb=master#l477 http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f...