Re:Casually removing root files
by etskinner on Wednesday August 16, 2017 @02:40PM
(#15029996)
The point seems to be that this isn't expected behavior in most people's minds, and that if someone truly wants to allow users to write to a directory, but not allow them to delete a file, that file must be flagged immutable. Just a quirky edge cases that people might not know about.
[ Parent
| on HN ]
It is expected behaviour if your mental model is accurate enough.
My mental model is that a directory is just a special file that links to other files.
Adding or deleting a file to a directory is just a case of writing to the "special file" to add or remove links to other files.
The statement 'it is the expected behavior if your mental model is accurate enough' is a tautology.
saying that tautologies are tautologies is tautological.
Re:Casually removing root files
by zaptheimpaler on Wednesday August 16, 2017 @10:07PM
(#15033189)
it only tautological to say "X is a tautology" to those who had recognized X as being a tautology.
Re:Casually removing root files
by PhasmaFelis on Wednesday August 16, 2017 @06:02PM
(#15031756)
The correct answer to "many people find this confusing" is never "I don't, so it's fine."
But there's a difference between confusion that arises because something is complex or inconsistent and confusion that arises because people have the wrong mental model.
"I assume that SQL tables are basically just fancy CSV files. Therefore strong invariants are obviously confusing."
Re:Casually removing root files
by PhasmaFelis on Thursday August 17, 2017 @03:46AM
(#15034583)
If most serious users have the wrong mental model about something, then either there's a serious documentation/training failure, or the correct model is non-obvious and counterintuitive (or both). Blaming the users for their ignorance is not productive in either case.
But if the file you are removing is the only reference (i.e. hard link) to that inode, you're not just modifying the directory's contents; you're also removing data from the filesystem as a whole.
Note that something else also happens to the inode when it's not the only reference: removing a file changes the "nlink" counter on the inode.
Re:Casually removing root files
by paulddraper on Wednesday August 16, 2017 @10:00PM
(#15033148)
Right. You are only affecting that directory listing.
Any other hardlinks in any other directories are completely unaffected.
Re:Casually removing root files
by libeclipse on Thursday August 17, 2017 @02:13AM
(#15034175)
That comment comes across as very arrogant. Of course if you're familiar enough with the system then you'll have no need to read this, and you can go off and seek gratification installing Gentoo and telling everyone about it.
But some people don't know, and benefit from learning it. So chill.
Re:Casually removing root files
by joelthelion on Wednesday August 16, 2017 @11:18PM
(#15033561)
How do you fit immutable files into that mental model?
I did not know about immutable, but I have noticed that c9.io uses another way to avoid modification of a file present in a directory that I own. It makes it a read only mount point:
/dev/mapper/volg1-lvdata on /home/ubuntu/.ssh/authorized_keys type ext4 (ro,relatime,data=ordered)