Red Hat Bugzilla – Bug 37293
vi broken by overly restrictive umask
Last modified: 2007-04-18 12:32:49 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.2 i686)
vi creates temporary directories in /tmp, and blindly uses the 'umask'
sanity-checking the value, resulting in directories it can't use.
Steps to Reproduce:
1. umask 177
2. vi /some/file that has multiple paragraphs in it.
3. Use '!}fmt' to format a paragraph.
Actual Results: "/tmp/v91406/0" Can't open file for writing
Can't create file /tmp/v91406/0
Hit ENTER or type command to continue
Expected Results: A formatted paragraph....
I found this while using nmh. The 'repl' command finds that the default
for MH files is 600, so it does a umask(0177) (which is reasonable enough,
as that's what you need to force a mode 600 file) and then launches the
editor (vi by default).
But look at the permissions vi assigns to its temporary directory:
[~/Mail/inbox]1 ls -lgd /tmp/v91406
drw------- 2 valdis valdis 48 Apr 24 00:03 /tmp/v91406
If you manually 'chmod 700' that directory from another window, !}fmt
starts working just fine. I suspect a missing 'fchmod(fd,0700)' right
after the mkdir() call....
I've just tested this with vim-6.1-5, the bug is not reproducable anymore.