Bug 37293 - vi broken by overly restrictive umask
vi broken by overly restrictive umask
Product: Red Hat Linux
Classification: Retired
Component: vim (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2001-04-24 00:12 EDT by Valdis Kletnieks
Modified: 2007-04-18 12:32 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-01-24 17:56:33 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Valdis Kletnieks 2001-04-24 00:12:57 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'
value without
sanity-checking the value, resulting in directories it can't use.

Reproducible: Always
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....
Comment 1 Karsten Hopp 2002-06-25 15:57:40 EDT
I've just tested this with vim-6.1-5, the bug is not reproducable anymore.

Note You need to log in before you can comment on or make changes to this bug.