On Wed, Feb 08, 2012 at 08:56:30AM +0100, Andreas Bießmann wrote:
> Hi again ...
> 
> On 08.02.12 08:40, Andreas Bießmann wrote:
> > Hi Michael,
> > 
> > On 08.02.12 08:05, Michael Olbrich wrote:
> >> On Tue, Feb 07, 2012 at 11:40:37PM +0100, Andreas Bießmann wrote:
> >>> Signed-off-by: Andreas Bießmann <[email protected]>
> >>
> >> Does this mean the uname patch is not needed? I don't mind applying this
> >> patch either way, but I'd like know if the original problem still exists.
> > 
> > I could really not reproduce the 'umask' problem at home (OS X; GNU
> > coreutils mkdir 8.12) but will retry at work where the problem came up.
> > Will send more info today.
> 
> sorry but _I can reproduce it_ on OS X (I forgot to set umask of 0077):
> 
> ---8<---
> andreas-mbp:OSELAS.Toolchain andreas$ ../ptxdist/bin/ptxdist go
> 
> error:
> '/opt/OSELAS.Toolchain-2011.11.0/i586-unknown-linux-gnu/gcc-4.6.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized'
>            does not exist and cannot be created!
>            Please create that dir with write permissions for you.
> 
> press enter to let sudo do that job!
> 
> sudo mkdir -p
> /opt/OSELAS.Toolchain-2011.11.0/i586-unknown-linux-gnu/gcc-4.6.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized
> sudo chown 502
> /opt/OSELAS.Toolchain-2011.11.0/i586-unknown-linux-gnu/gcc-4.6.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized
> 
> error:
> '/opt/OSELAS.Toolchain-2011.11.0/i586-unknown-linux-gnu/gcc-4.6.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized'
>            does exist, but is not writable.
>            Change the permissions and try again.
> 
> press enter to let sudo do the job!
> 
> sudo chown 502
> /opt/OSELAS.Toolchain-2011.11.0/i586-unknown-linux-gnu/gcc-4.6.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized
> sudo chmod u+w
> /opt/OSELAS.Toolchain-2011.11.0/i586-unknown-linux-gnu/gcc-4.6.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized
> 
> error: cannot make
> '/opt/OSELAS.Toolchain-2011.11.0/i586-unknown-linux-gnu/gcc-4.6.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized'
> writable, giving up
> 
> andreas-mbp:OSELAS.Toolchain andreas$ umask
> 0077
> --->8---
> 
> So the problem is this way:
> 
> - umask is 0077
> - check_dirs_mkdir() will test to mkdir -m755 -p
>   /opt/OSELAS.../<arch>.../gcc-<version>... -> fails
> - check_dirs_mkdir() provide sudo mkdir ... (note! without -m755)
>   -> success BUT:
> 
> ---8<---
> andreas-mbp:OSELAS.Toolchain andreas$ ls -la
> /opt/OSELAS.Toolchain-2011.11.0/
> total 0
> drwxr-xr-x  8 root  wheel  272  8 Feb 08:48 .
> drwxr-xr-x@ 4 root  wheel  136 20 Dez 23:58 ..
> drwxr-xr-x  3 root  wheel  102 19 Jan 10:02 arm-cortexa8-linux-gnueabi
> drwxr-xr-x  3 root  wheel  102  9 Jan 08:22 arm-v4t-linux-gnueabi
> drwxr-xr-x  3 root  wheel  102 18 Jan 18:33 arm-v5te-linux-gnueabi
> drwxr-xr-x  3 root  wheel  102 11 Jan 00:32 avr
> drwx------  3 root  wheel  102  8 Feb 08:48 i586-unknown-linux-gnu
> drwxr-xr-x  3 root  wheel  102  7 Feb 23:46 x86_64-unknown-linux-gnu
> andreas-mbp:OSELAS.Toolchain andreas$ ls -la
> /opt/OSELAS.Toolchain-2011.11.0/i586-unknown-linux-gnu/
> ls: : Permission denied
> andreas-mbp:OSELAS.Toolchain andreas$ sudo ls -la
> /opt/OSELAS.Toolchain-2011.11.0/i586-unknown-linux-gnu/
> total 0
> drwx------  3 root     wheel  102  8 Feb 08:48 .
> drwxr-xr-x  8 root     wheel  272  8 Feb 08:48 ..
> drwxr-xr-x  2 andreas  wheel   68  8 Feb 08:48
> gcc-4.6.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized
> --->8---
>   -> (note: this was patched bin/ptxdist with '-m755' in sudo mkdir
>      path)
>   -> therefore next commands can not access subdirs of
>      /opt/OSELAS.Toolchain-2011.11.0/i586-unknown-linux-gnu/ (chmod,
>      chown)
> 
> I guess the problem is directories on the way (= 'parents') are created
> with default credentials -> umask has an effect. But the last directory
> in path is set to given parameters (-m755).
> 
> Can you reproduce this too?

Yes, I can. The problem is not actually the umask, but the fact, that we're
creating several directory levels with sudo but only change the ownership
of the last one.
I think we should use 'install -m0755 -d ${dir}' instead. That sets the
correct permissions for the parent directories without messing with umask

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
[email protected]

Reply via email to