[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: visudo with Emacs
From: |
Sven Joachim |
Subject: |
Re: visudo with Emacs |
Date: |
Sun, 19 Jun 2011 23:25:50 +0200 |
User-agent: |
Gnus/5.110017 (No Gnus v0.17) Emacs/23.3.50 (gnu/linux) |
On 2011-06-19 22:46 +0200, MON KEY wrote:
> On Sat, Jun 18, 2011 at 10:54 PM, Eli Zaretskii <address@hidden> wrote:
>>> AFAICT the stray /etc/sudoers.tmp~ is not in keeping with the
>>> spirit of visudo. Emacs should operate equivalently with vi.
>>
>> ??? Why? what's wrong with leaving backup files in these use cases?
>
> AIUI visudo is an abstraction of an "atomic commit".
>
> - When invoked visudo visits /etc/sudoers.tmp
> - Edits are made.
> - When the file is saved (read committed) it is verified for
> correctness.
> - If the the commit is successful, visudo writes to /etc/sudoers and
> /etc/sudoers.tmp is removed.
More exactly, visudo renames /etc/sudoers.tmp to /etc/sudoers so that
the commit is indeed atomic.
> My impression is that neither /etc/sudoers.tmp nor the backup file
> /etc/sudoers.tmp~ are meant to be retained.
Since it serves as a lockfile, /etc/sudoers.tmp must not be retained
(visudo either renames or unlinks it, depending on whether you have made
changes or not), but /etc/sudoers.tmp~ does no harm.
>> If nothing else, you get for free the ability to easily restore the
>> original files, if you happen to screw up.
>
> Restoring from /etc/sudoers.tmp~ would amount to restoring from the
> lock file not /etc/sudoers !
And? /etc/sudoers.tmp~ is still a backup file of /etc/sudoers and so
might be useful.
Cheers,
Sven