Mistakes editors can make that disqualify them as sysadmin editors

November 4, 2008

A sysadmin editor needs slightly more than to be a fast-starting thing that needs a minimal environment. It turns out that sysadmins are picky people (well, at least I am), and there are some small mistakes that otherwise competent editors can make that, unfortunately, make them non-starters for the job.

The first and the most classic mistake is automatically changing tabs to spaces or spaces to tabs. Just like programmers working on makefiles, sysadmins edit files where tabs are not interchangeable with spaces; an editor that thinks they are is a great way to blow your foot off some day.

(This is why to this day I wince any time someone says that they edit with pico, which was infamous for this behavior at one time. I believe that the pico people fixed it pretty promptly, but these things stick in people's memories.)

The other mistake is not overwriting files in place, or at a minimum not doing so when they have hardlinks. Because it is the best way to save files, any number of editors always save to a temporary file and then rename it over top of the real one; this is beautifully safe but explodes if the real file had additional links, because you've just broke those links. Some editors will notice this and revert to overwriting the file directly if it has hardlinks, but unfortunately hard links aren't the only case these days when preserving the exact file is important; consider security contexts.

(In theory editors can look for every last possible special attribute a file could have that means it should be updated in place. In practice there are too many of them and they keep growing.)

I maintain that there is also a third mistake, that of being too UTF-8 aware (or arguably, being UTF-8 aware at all). One of the important general virtues of a sysadmin editor is leaving strictly alone any bytes that you didn't actually edit. Unfortunately, most UTF-8 aware editors will rewrite any invalid UTF-8 sequences that they encounter, which can mangle your files in various ways (some of which are sometimes important). This generally doesn't bother me because I am so old fashioned that I still use the C locale, but it's something to watch out for.

(I do use one editor that always works in UTF-8 regardless of your locale, and every so often it does mangle text that I didn't want mangled. Fortunately it is not a sysadmin editor, since it requires X.)

Written on 04 November 2008.
« Why vi has become my sysadmin's editor
An issue with quotas on ZFS pools »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue Nov 4 00:34:11 2008
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.