bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Matt McCutchen
Subject: [bug #28891] Fix all code that sets the umask to zero
Date: Sat, 13 Feb 2010 21:51:30 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2) Gecko/20100210 Fedora/3.6.1-1.matt1.fc12 Namoroka/3.6

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/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]