Re:Diaspora-common: does 'rm -rf /' on purge
by tremon on Thursday March 23, 2017 @11:13AM
(#13940418)
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.
Re:Diaspora-common: does 'rm -rf /' on purge
by rwmj on Thursday March 23, 2017 @11:49AM
(#13940828)
Coreutils 'rm' has a --preserve-root option (the default) which does exactly this.
https://www.gnu.org/software/coreutils/manual/html_node/Trea...
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.)