Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jun 2008 20:58:13 +0200
From:      Kris Kennaway <kris@FreeBSD.org>
To:        Garrett Wollman <wollman@csail.mit.edu>
Cc:        standards@freebsd.org
Subject:   Re: mkdir -p through a dangling symlink
Message-ID:  <48692CC5.4030308@FreeBSD.org>
In-Reply-To: <18537.9084.554477.556052@khavrinen.csail.mit.edu>
References:  <48691D31.9010202@FreeBSD.org> <18537.9084.554477.556052@khavrinen.csail.mit.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Garrett Wollman wrote:
> <<On Mon, 30 Jun 2008 19:51:45 +0200, Kris Kennaway <kris@freebsd.org> said:
> 
>> Suppose you do this:
>> gohan20# ln -sf /y/portbuild /var/portbuild
>> gohan20# mkdir -p /var/portbuild/scripts
>> mkdir: /var/portbuild: No such file or directory
> 
>> (because /y/portbuild doesn't exist yet).
> 
>> Is this the correct behaviour, or should mkdir -p be creating 
>> /var/portbuild/ before failing?
> 
> This is the correct behavior.  The semantics of the -p option are
> defined lexically on the arguments provided, not on the contents of
> the filesystem.  See XCU page 635 lines 24488ff:
> 
> # For each dir operand that does not name an existing directory,
> # effects equivalent to those caused by the following command shall
> # occur:
> 
> #	mkdir -p -m $(umask -S),u+wx $(dirname dir) &&
> #	mkdir [-m mode] dir
> 
> # where the -m mode option represents that option supplied to the original
> # invocation of mkdir, if any.
> 
> (References are for the 2001 final published standard.)

Thanks!

Kris



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48692CC5.4030308>