Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

.* 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#L...

checkdot is called against all argv:

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...

(edit: it does - thanks, was running from memory and didn't actually check it)



The 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...




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: