Hacker News new | ask | show | jobs
by thinkmoore 3370 days ago
I think the alternative being suggested is that rm shouldn't accept a string that magically can reference anything in the filesystem...

In our capability-based shell scripting language Shill (shill-lang.org) for example, you could prevent this sort of bug by giving the script a capability for just the diaspora_home directory, and deriving the child directories from that capability. (Of course, you still need to make sure you pass in the right directory in the first place.)

2 comments

I think the alternative being suggested is that rm shouldn't accept a string that magically can reference anything in the filesystem...

That suggestion fails to grasp the basics of Unix shells however: parameter expansion as well as globbing is performed by the shell, rm "sees" nothing but fully-expanded paths.

Coreutils 'rm' has a --preserve-root option (the default) which does exactly this.

https://www.gnu.org/software/coreutils/manual/html_node/Trea...