News for hackers. Stuff that matters.
Re:Diaspora-common: does 'rm -rf /' on purge by LyndsySimon on Thursday March 23, 2017 @09:17AM (#13939440)
From reddit:

> It's actually rm -rf /bin.

> Seems to be caused by the same reason as the famous Steam bug - using an undefined variable. Plus the default bash behavior that simply ignores the fact that it doesn't exist and treats it like an empty string.

> tl;dr flamebait: The Unix way™ of "everything is just text" strikes again. (EDIT: yes this a gross over-generalization)

source: https://www.reddit.com/r/programming/comments/610z2f/858521_...

Re:Diaspora-common: does 'rm -rf /' on purge by megous on Thursday March 23, 2017 @09:55AM (#13939715)
Creating the same bug in a code tree editor would certainly not help anything.
Re:Diaspora-common: does 'rm -rf /' on purge by thinkmoore on Thursday March 23, 2017 @10:45AM (#13940145)
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.)

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

Re:Diaspora-common: does 'rm -rf /' on purge by Ericson2314 on Thursday March 23, 2017 @10:46AM (#13940157)
A language with more rigor about path concatenation (and undefined variables) would. (Yes set -e, but it's little used for better or worse.)
Re:Diaspora-common: does 'rm -rf /' on purge by comex on Thursday March 23, 2017 @05:04PM (#13944260)
Indeed. When you write "$foo/bin", you're looking for a specific operation: get the path "bin" relative to the directory $foo. Ideally this should be expressed in such a way that even if $foo somehow acquires a null or "default" value (which hopefully requires more than just naming an undefined variable, as in bash), you get an error trying to lookup relative to null, rather than the slash silently turning into the root directory.