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

Alexander Griesser alexander.griesser at lkh-vil.or.at
Mon Mar 27 13:00:46 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all!

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.

It took me quite a while to find out what was wrong because I thought
I definetly made some modifications to a file and after reboot the same
errors that should have been gone using the modifications still were
there.

So, in short, here's a patch that fixes the ZZ command to not quit when
the file is read-only but instead show an error message that the file
is read-only and continue editing.

As my last patch to :wn didn't apply to the current release, I'm asking
you what did I wrong?

This patch is against busybox 1.1.1 which I downloaded about three days
ago, so I hope it applies.

ciao,
- --
Alexander Griesser (Netzwerkadministration)
E-Mail: alexander.griesser at lkh-vil.or.at | Web: http://www.lkh-vil.or.at
KABEG LKH Villach | Nikolaigasse 43 | 9500 Villach
Tel.:   +43 4242 208 3061 | Fax.:   +43 4242 971 3061
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEJ+H+66HVD6KUm1oRAjxnAJ0fH3opPQxw8wCO1NyoIHKkY4hpjwCfaDV4
Yfm3bF/6rWMzeOWGtOsHtJ0=
=7/i3
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vi-ro-ZZ-issue.diff
Type: text/x-patch
Size: 294 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060327/fa219b21/attachment.bin 


More information about the busybox mailing list