From owner-freebsd-standards@FreeBSD.ORG Mon Jun 30 18:58:17 2008 Return-Path: Delivered-To: standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 325B2106568A for ; Mon, 30 Jun 2008 18:58:17 +0000 (UTC) (envelope-from kris@FreeBSD.org) Received: from weak.local (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 6D73E8FC0A; Mon, 30 Jun 2008 18:58:16 +0000 (UTC) (envelope-from kris@FreeBSD.org) Message-ID: <48692CC5.4030308@FreeBSD.org> Date: Mon, 30 Jun 2008 20:58:13 +0200 From: Kris Kennaway User-Agent: Thunderbird 2.0.0.14 (Macintosh/20080421) MIME-Version: 1.0 To: Garrett Wollman References: <48691D31.9010202@FreeBSD.org> <18537.9084.554477.556052@khavrinen.csail.mit.edu> In-Reply-To: <18537.9084.554477.556052@khavrinen.csail.mit.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: standards@freebsd.org Subject: Re: mkdir -p through a dangling symlink X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2008 18:58:17 -0000 Garrett Wollman wrote: > < 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