Re: Security question: "Text file busy" overwriting executables but not shared libraries?

From: Jamie Lokier (
Date: Mon Oct 15 2001 - 07:29:03 EST

Alexander Viro wrote:
> > This does not work. Example:
> >
> > 1. JamieEmacs loads file using MAP_PRIVATE.
> > 2. Something else writes to the file.
> > 3. Scroll to the bottom of the file in JamieEmacs. It displays some
> > of the newly written data, though not all of it.
> >
> > --> Wrong editor semantics.
> --> Wrong permissions or hopelessly crappy source control system.
> At point 2 you are _already_ screwed. Depending on who hits (hell,
> what's the equivalent of :x in Emacsese?) first, one of you is
> going to lose results of editing. Doctor, it hurts when I do it...

I am _not_ saving anything. Viewing
/home/web/automatically_generated_every_hour.html from a particular
moment is a perfectly reasonable thing to do in Emacs, and it's a
perfectly reasonable thing to do in Less and Midnight Commander and
Mozilla for that matter.

_If_ I hit :x (in Vi-mode in Emacs ;-) then I expect the editor to warn
me that the file was updated by some other program. Some editors will
warn before that. Some will reload the file automatically if I haven't
made changed within the editor.

However, at all times I expect a consistent display of the file either
from read time, or from the current time. _Never_ some unparsable,
invalid, mixed up combination of pages.

> If you want versioning - use source control system. Or go play
> with DEC cra^WOSes. In RSX that "feature" sucked (and so did
> editor semantics, but that's a separate story).

I do _not_ want versioning. I want to load a file into an editor and
look at _that_ snapshot, at my leisure. (Almost) every editor ever
written works this way, and I am quite happy with it.

read() gives the correct semantics.

There is potential to make read() more efficient, both in execution time
and in memory consumption.

Enjoy :-)

-- Jamie
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Oct 15 2001 - 21:00:57 EST