News for hackers. Stuff that matters.
Re:Unix Recovery Legend (1986) by TheLoneWolfling on Wednesday September 02, 2015 @05:02PM (#10161875)
Personally, I wish two things:

1) that rm had a (configurable) number of files / directories above which it'll ask you to double-check.

2) that files had a "pleasedontdelete" flag that rm would check and ask about.

Re:Unix Recovery Legend (1986) by derefr on Wednesday September 02, 2015 @05:34PM (#10162028)
> pleasedontdelete flag

For some programs (rm isn't one of them), removing the write permission is sufficient to get an interactive prompt when you try to overwrite/truncate/delete the file.

I really like OSX's current metaphor, where files that haven't been touched in a while get "locked", and must then be "unlocked" to modify them further. Phrasing it in terms of stability rather than permission makes a lot of sense to me. It's too bad the metaphor isn't echoed in the CLI.

Re:Unix Recovery Legend (1986) by alcari on Wednesday September 02, 2015 @06:07PM (#10162214)
`rm` is definitely one of them, it's just suppressed by the `-f` flag. (examples from Ubuntu)

    $ touch foo
    $ chmod -w foo
    $ rm foo
    rm: remove write-protected regular empty file ‘foo’?
There's also the immutable attribute many modern filesystems support, which prevents the file from being modified unless the attribute is removed.

    $ sudo chattr +i foo
    $ rm foo
    rm: remove write-protected regular empty file ‘foo’? y
    rm: cannot remove ‘foo’: Operation not permitted
Re:Unix Recovery Legend (1986) by ethbro on Wednesday September 02, 2015 @06:12PM (#10162244)
That's a surprisingly good idea for UAC too. People would hate that it's non-deterministic (from "how will my program run on a user's system" perspective), but makes more sense than other approaches.

If I'm tapping a file that's been sitting there since the OS was installed and hasn't been touched since... Probably fair to ask me to confirm!

Re:Unix Recovery Legend (1986) by Zenst on Wednesday September 02, 2015 @05:14PM (#10161926)
You can script that all up and call it rm and pop it higher up the user PATH and if you need the pure rm command without the wrapper protection (for say scripts) then can just point to that with the full path.
Re:Unix Recovery Legend (1986) by JoshTriplett on Thursday September 03, 2015 @12:19AM (#10163321)
> 1) that rm had a (configurable) number of files / directories above which it'll ask you to double-check.

Install safe-rm; it does exactly that.