News for hackers. Stuff that matters.
Re:Did Pixar accidentally delete Toy Story 2 during producti... by knodi123 on Tuesday January 17, 2017 @09:52AM (#13417978)
As a linux neophyte, I once struggled to remember whether the trailing slash on a directory was important. So I typed "rm -rf", and pasted the directory name "schoolwork/project1 " (with a trailing space), but then I waffled and decided to add a trailing slash. So I changed it to "rm -rf schoolwork/project1 /".

That's my theory as to what they did.

Re:Did Pixar accidentally delete Toy Story 2 during producti... by Symbiote on Tuesday January 17, 2017 @10:08AM (#13418116)

  rm -Rf test /
  rm: it is dangerous to operate recursively on ‘/’
  rm: use --no-preserve-root to override this failsafe
GNU rm, but I don't know when it was introduced.
Re:Did Pixar accidentally delete Toy Story 2 during producti... by r3bl on Tuesday January 17, 2017 @10:19AM (#13418200)
Quick googling around, and it seems like this behavior (in Ubuntu) changed somewhere near the end of 2008: https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/174...

tl;dr That's when coreutils Ubuntu package switched from "--no-preserve-root" to "--preserve-root" by default.

Re:Did Pixar accidentally delete Toy Story 2 during producti... by blitzkrieg3 on Tuesday January 17, 2017 @10:57AM (#13418545)
This is relatively recent, and caused quite a stir when it was introduced. Certainly not around during Toy Story 2.

edit: More info:

https://lwn.net/Articles/327141/

Re:Did Pixar accidentally delete Toy Story 2 during producti... by coldpie on Tuesday January 17, 2017 @11:10AM (#13418670)
One feature I've always wanted is to make a directory non-deletable without otherwise changing the directory's functionality. So if I do "rm -rf ~/work" I don't lose anything, but I can still do "touch ~/work/whatever". As far as I know, this is impossible.
Re:Did Pixar accidentally delete Toy Story 2 during producti... by slau on Tuesday January 17, 2017 @12:46PM (#13419474)
You don't actually need write access to a file/directory to delete it. You only need write access to the parent (removing or adding a file modifies the container, not the contained).

Remove write access to the parent directory, while keeping traversal and read rights, and you'll be sorted.

Re:Did Pixar accidentally delete Toy Story 2 during producti... by coldpie on Tuesday January 17, 2017 @01:43PM (#13419943)
But then I can't add files to my home directory...
Re:Did Pixar accidentally delete Toy Story 2 during producti... by vidarh on Tuesday January 17, 2017 @02:17PM (#13420245)
So don't put the stuff you want to protect this way in your home directory, but somewhere else, and symlink the relevant directories to your home directory.
Re:Did Pixar accidentally delete Toy Story 2 during producti... by coldpie on Tuesday January 17, 2017 @03:32PM (#13420896)
Quite clumsy, but I guess it works. I'll keep it in mind, thanks for the idea.
Re:Did Pixar accidentally delete Toy Story 2 during producti... by slau on Tuesday January 17, 2017 @02:05PM (#13420138)
You said it was impossible. I simply indicated it wasn't.
Re:Did Pixar accidentally delete Toy Story 2 during producti... by coldpie on Tuesday January 17, 2017 @03:06PM (#13420679)
The question was perhaps imprecisely phrased, but I think you can figure out what I'm trying to accomplish.
Re:Did Pixar accidentally delete Toy Story 2 during producti... by knodi123 on Tuesday January 17, 2017 @02:32PM (#13420372)
# mkdir /tmp/foo

# touch /tmp/foo/.immutable

# chattr +i /tmp/foo/.immutable

# rm -rf /tmp/foo

It's not EXACTLY what you asked for, but the .immutable file cannot be deleted until you call chattr -i on it, which protects the directory....

Re:Did Pixar accidentally delete Toy Story 2 during producti... by coldpie on Tuesday January 17, 2017 @03:05PM (#13420675)
That doesn't protect siblings of <foo/.immutable>...
Re:Did Pixar accidentally delete Toy Story 2 during producti... by alephnil on Tuesday January 17, 2017 @02:07PM (#13420159)
If I remember correctly, they were using Solaris at the time, and I know for sure that Solaris did not have this safety net, nor did Linux at the time. The requirement of --no-preserve-root was introduced almost a decade later.