Bug 37293

Summary: vi broken by overly restrictive umask
Product: [Retired] Red Hat Linux Reporter: Valdis Kletnieks <valdis.kletnieks>
Component: vimAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-01-24 22:56:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Valdis Kletnieks 2001-04-24 04:12:57 UTC
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
permissions
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 19:57:40 UTC
I've just tested this with vim-6.1-5, the bug is not reproducable anymore.