Bug 79015

Summary: umask is not working properly - /usr/lib/perl5/5.6.1/i386-linux/auto/POSIX/umask.al
Product: [Retired] Red Hat Linux Reporter: Andrew Plata <andrew_plata>
Component: perlAssignee: Chip Turner <cturner>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3Keywords: Security
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-12-18 18:41:28 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 Andrew Plata 2002-12-04 16:20:33 UTC
Description of Problem:

When I run the umask command as root the output is 0022 but when I create a file
as root the permissions are -rw-r--r--. Based on the documentation I have read
the permissions should be -rwx-rx-rx based on that umask.
Also, when I run the umask command as aplata (my user login) the output is 0002
but when I create a file the permissions are -rw-rw-r--. Shouldn't it be
-rwx-rwx-rx based on that umask? I'm confused. The strange thing is when I run
umask -S the output displayed is what I think the file permissions should be. So
why dosen't the shell create my file with the proper permissions? I also set the
umask for all users in the /etc/profile and I still get the same thing.

Another thing I noticed is that when I set the umask to 002 in root's
.bash_profile and restarted .bash_profile for root the umask would change to
0002 only if I logged in as root in text mode by hitting CTRL+ALT+F1 but would
not change when using Konsole in KDE and remained at 0022. What I mentioned in
the first paragraph also remained the same.

Your help is much appreciated.


Version-Release number of selected component (if applicable):

/usr/lib/perl5/5.6.1/i386-linux/auto/POSIX/umask.al

How Reproducible:


Steps to Reproduce:
1. edit /etc/profile to add umask of 002 or add umask 002 to Root's .bash_profile.
2. restart computer or restart .bash_profile if Root. 
3. create file using touch filename as user or as Root.

Actual Results:

File permissions are rw-rw-r-- when file is created.
(If done as Root you will only see this if logged into text mode)

Expected Results:
As the user or Root the permissions should be u=rwx,g=rwx,o=rx

Additional Information:

When replying back to me can you please CC: aplata

Comment 1 Miloslav Trmac 2002-12-05 18:19:10 UTC
Nothing in this "bug" AFAICS relates to perl.
Anyhow, if you want to know how umask works, see
 man creat
 man 2 mkdir
etc. In short, the umask is a *mask* of what is specified by the program that
creates the file. So if the program tells not to set --x--x--x, it won't be.

Comment 2 Alan Cox 2002-12-18 18:41:28 UTC
Not a bug

The umask is applied to the permissions the program requests. Perl like most
apps says create with rw-rw-rw  and the umask turns it to rw-rw----

Alan