[BUG] vi does not recognize changed permissions on read only files

Manuel Zerpies manuel.f.zerpies at ww.stud.uni-erlangen.de
Wed Oct 10 21:29:00 UTC 2012


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.

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

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?

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

does your example work with the version of vi shipped by your
distribution in your /bin or /usr/bin folder?

greets,
manuel


More information about the busybox mailing list