bug-coreutils
[Top][All Lists]
Advanced

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

Re: `install -d -m MODE dir' doesn't honor MODE [Re: Bug#37150...


From: Paul Eggert
Subject: Re: `install -d -m MODE dir' doesn't honor MODE [Re: Bug#37150...
Date: Fri, 16 Dec 2005 17:00:45 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Jim Meyering <address@hidden> writes:

> Or maybe the documentation should simply admit that when using -d, certain
> directory attributes (e.g., for ACLs, too) may be inherited.  One argument
> in favor of this approach is that Solaris 9's /usr/sbin/install also
> works this way.

But when I tried Solaris 9's /usr/sbin/install, the setgid bit was not
inherited:

$ ls -ld .
drwxrwsr-x   2 eggert   eggert       512 Dec 13 11:46 .
$ /usr/sbin/install -d -m 0755 foo
directory foo created
263-pete $ ls -ld foo
drwxr-xr-x   2 eggert   eggert       512 Dec 16 16:31 foo

Perhaps you were using /usr/ucb/install?  That does behave like coreutils
install:

$ rmdir foo
$ /usr/ucb/install -d -m 0755 foo
260-pete $ ls -ld foo
drwxr-sr-x   2 eggert   eggert       512 Dec 16 16:31 foo


> Maybe the code needs to use chmod in this case.

For what it's worth, Solaris /usr/ucb/install does use chmod, but it
expliclty preserves the setgid bit.  It does this as follows (assuming
you specify -d -m 700):

mkdir("foo", 0777)                              = 0
stat64("foo", 0xFFBFF818)                       = 0
chmod("foo", 02700)                             = 0

Obviously this is unsafe.

In contrast, /usr/sbin/install, which is a shell script, does something
like this:

mkdir -p foo 
chgrp 30 foo 
chown eggert foo 
chmod 0700 foo 

Obviously this is unsafe as well.

I just checked FreeBSD install, and it does this:

mkdir("foo", 0755)
chmod("foo", 0700)

This is also unsafe.  But it behaves more like Solaris 10
/usr/sbin/install.

For what it's worth, gnulib install.sh behaves like FreeBSD and Solaris 10.

I tend to think that the gnulib / FreeBSD / Solaris /usr/sbin/install
is probably more what users expect; if so, we should fix the code
accordingly.  I'll volunteer to do that if there is consensus.

I don't know about ACLs, though -- I expect they'd be inherited, since
-m doesn't really talk about ACLs.




reply via email to

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