bugGNU Core Utilities - Bugs: bug #28891, Fix all code that sets the umask...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #28891: Fix all code that sets the umask to zero

Submitter:  Matt McCutchen <hashproduct>
Submitted:  Sat 13 Feb 2010 09:51:29 PM UTC
Votes: 20
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Sat 13 Feb 2010 09:51:29 PM UTC, original submission:  

Several pieces of code in coreutils set the umask to zero in order to create files with specific permissions:


$ git grep -n 'umask (0)'
src/chmod.c:532:      umask_value = umask (0);
src/copy.c:2358:      mask = umask (0);
src/install.c:458:  umask (0);
src/mkdir.c:195:      mode_t umask_value = umask (0);
src/mkfifo.c:124:      newmode = mode_adjust (newmode, false, umask (0), change, NULL);
src/mknod.c:130:      newmode = mode_adjust (newmode, false, umask (0), change, NULL);


Code that takes this approach generally doesn't handle default ACLs properly.  Here's an example with mkdir(1):


$ mkdir plain defacl
$ setfacl -k plain
$ setfacl -dm u::7,g::0,o::0 defacl
$ mkdir -m 755 plain/subdir defacl/subdir
$ ls -ld */subdir
drwx------+ 2 matt matt 48 2010-02-13 16:49 defacl/subdir
drwxr-xr-x  2 matt matt 48 2010-02-13 16:49 plain/subdir


The code should be fixed to call chmod(2) on the created files, and then the umask is no longer relevant.

Matt McCutchen <hashproduct>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chewi
  • -email is unavailable- added by mjo
  • -email is unavailable- added by hashproduct (Voted in favor of this item)
  • -email is unavailable- added by hashproduct (Submitted the item)
  •  

    There are 20 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-09-09 chewi Carbon-Copy- Added chewi
    2012-08-08 mjo Carbon-Copy- Added mjo
    2010-02-13 hashproduct Carbon-Copy- Added hashproduct

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code