[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: visudo with Emacs

Subject: Re: visudo with Emacs
Date: Sun, 19 Jun 2011 16:46:39 -0400

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
 - If the the commit is successful, visudo writes to /etc/sudoers and
   /etc/sudoers.tmp is removed.

My impression is that neither /etc/sudoers.tmp nor the backup file
/etc/sudoers.tmp~ are meant to be retained.

,---- (man "visudo")
| visudo locks the sudoers file against multiple simultaneous edits,
| provides basic sanity checks, and checks for parse errors.
| (...)
| visudo parses the sudoers file after the edit and will not save the
| changes if there is a syntax error.
| (...)
|         /etc/sudoers           List of who can run what
|         /etc/sudoers.tmp       Lock file for visudo

> 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 !

The state represented by /etc/sudoers.tmp might be representative of a
failed commit...

Note, at best I'm an occasional user of sudo/visudo.

It would be nice if a sudo/visudo-devel or well versed sys-admin
familiar with the intricacies of visudo could comment on the
efficacy of Emacs' retention of /etc/sudoers.tmp~


reply via email to

[Prev in Thread] Current Thread [Next in Thread]