The Wanderer <wande...@fastmail.fm> writes:

> On 11/22/2014 at 03:44 AM, Philip Hands wrote:
>
>> Hi Simon,
>> 
>> Thanks for the explanation -- all makes a lot more sense now.
>> 
>> I'm much less tempted to rant about how large chunks of /lib should
>> be moved to /etc (which is very good, because I don't suppose I'd be
>> the first to suggest it ;-) )
>> 
>> Simon McVittie <s...@debian.org> writes:
>> 
>>> On 21/11/14 17:07, Philip Hands wrote:
>>>> Is there any way this isn't going to be an enormous surprise to
>>>> people that are used to the way that Debian usually treats /etc?
>>> 
>>> I do get your point; editing the (underlying file for the) .service
>>> is unnecessary and undesirable for systemd, and if you blindly do
>>> "vi /etc/.../thing.service" and don't realise you're following a
>>> symlink, that would be a bad idea.
>> 
>> Given that, it occurs to me that it might be wise to make these files
>> in /lib read-only.
>> 
>> If, when attempting to save the .service file, I'd been presented
>> with a warning about it being read-only I think it would have been
>> enough of a nudge to make me look a bit more closely at what was
>> going on with the files (or not) under /etc.
>
> It wouldn't have been enough for me; I would have just tried again as
> root, on the assumption that it was a simple user-permissions issue, and
> that would have succeeded since of course root can write data to a-w
> files.

Root can, but vim and emacs both tell you that you're writing to a
read-only file, and you have to force it -- if you walk past that
warnings without pausing for thought, well that's up to you.

> That's assuming I hadn't been trying the edit as root to begin with -
> which is more likely in any case, since I know quite well that most
> files under /etc aren't ordinary-user-writable.
>
>> Even if it didn't actually save the stumbling user from falling over,
>> at least when they start shouting about it the bugs can be closed
>> with "Well, we did try to stop you, but you ignored the read-only
>> safety catch, and shot your foot anyway".
>
> That sounds like an unfriendly approach, to say the least.

Not if you take into account the fact that someone will have had to do
something like  :wq! to get past the read-only state of the file.

vim put's a [RO] after the filename when you open it, and says this when
you try to write it:

  E45: 'readonly' option is set (add ! to override)             

in emacs, you get %% in the status line, and it tells you the file's
read-only when you start trying to edit it, and refuses to do so until
you type C-x C-q to flip it's read-only status.

nano sadly doesn't seem to notice :-/

no idea about other editors.

I guess that given the fact that nano doesn't protect users, one doesn't
get to be rude to them -- oh well  ;-)

That's probably a bug in nano.

I think that for the people that will use an editor that will mention
that you're trying to fiddle with a read-only file, it would be helpful,
and we could always fix editors that fail to mention that.

Cheers, Phil.
-- 
|)|  Philip Hands  [+44 (0)20 8530 9560]  HANDS.COM Ltd.
|-|  http://www.hands.com/    http://ftp.uk.debian.org/
|(|  Hugo-Klemm-Strasse 34,   21075 Hamburg,    GERMANY

Attachment: pgpljdjPRnhn8.pgp
Description: PGP signature

Reply via email to