Bug in vi-applet: ZZ command does not recognize read-only files

Bernhard Fischer rep.nop at aon.at
Mon Mar 27 06:32:27 PST 2006


On Mon, Mar 27, 2006 at 08:36:43AM -0500, Paul Fox wrote:
> > 
> > When I open a file in vi and modify it in the buffer (although it's
> > readonly) and afterwards try to save it using the ":wq" command, I get
> > the error message that the file is read-only. If I do ":wq!", I get
> > another error message from the write command itself that the file can't
> > be written, so far so good.
> > 
> > When I do the same with the "ZZ" command (which should be an equivalent
> > to :wq or :x) I don't get an error message that the file is not
> > writable, vi simply quits and returns 0 to the shell and makes me think
> > that everything is ok.
>
>i'll take a look at this.  when i fixed the read-only behavior of
>:wq last year, i didn't notice that ZZ had the same problem.
>
>i'll look at your ":wn" as well.

I rediffed the :wn patch (see patch #1) and corrected the :version
command (see patch #2) here:
http://busybox.net/lists/busybox/2006-March/019494.html

Please apply if you think it makes sense, TIA.

PS: perhaps it would make sense to convert the other strncasecmp to the
expanded checks as the latter did produce slightly smaller code for me
(see numbers in the mail above).


More information about the busybox mailing list