URL:
<http://savannah.gnu.org/bugs/?28891>
Summary: Fix all code that sets the umask to zero
Project: GNU Core Utilities
Submitted by: hashproduct
Submitted on: Sat 13 Feb 2010 09:51:29 PM GMT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
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.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?28891>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/