On 10/10/2012 11:29 PM, Manuel Zerpies wrote:
hej john,

i edited less-444/configure, and when i wanted to :wq vi claimed:
"file is read-only".

so i changed the perms in another shell to 755.
retrying :wq yielded the same error again.

after closing vi with :q! and opening it again, i was able to save it.

i had to redo all previous changes of course...

yes. but that is kind of "normal" behavior.

declaring that behaviour as "normal" seems weird, since it is totally unintuitive.


try the following:

$ touch test.txt
$ chmod 444 test.txt

now the file is readonly and you got the situation as mentioned.
it is not relevant whether you use vim or vi

$ vi test.txt

vim shows a red "warning: file is in read only mode!" when i open it.
it immediately jumps into the eye.
is is: VIM - Vi IMproved 7.3 (2010 Aug 15)

busybox vi shows no warning at all.

you could type a long long letter for hours, and when you want to save it, you are fsck'd.


edit the text file and try to close with ":wq". won't work - as
intended.

(other shell)
chmod 755 test.txt

back to vi(m) ":wq" won't work, because you opened the file
readonly. so where is the bug?

wrong, vim shows in red:
E45: 'readonly' option is set (add ! to override)

using :wq! the file gets written to disk, including my changes.


you don't open the file, but the filedescriptor. the file is not
harmed yet. so what you get is a readonly filedescriptor.

this sounds weird, if the editor would show a live view of what is contained under a fd, it had to write the entire file on every inserted character, and you had no way of exiting the editor without overwriting. you definitely have to open the file, buffer its contents (at least partially), and possibly open it again to write its content.

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to