From owner-freebsd-standards@FreeBSD.ORG Mon Jun 30 18:41:07 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 D7827106564A; Mon, 30 Jun 2008 18:41:07 +0000 (UTC) (envelope-from wollman@khavrinen.csail.mit.edu) Received: from khavrinen.csail.mit.edu (khavrinen.csail.mit.edu [128.30.28.20]) by mx1.freebsd.org (Postfix) with ESMTP id 92D8F8FC15; Mon, 30 Jun 2008 18:41:06 +0000 (UTC) (envelope-from wollman@khavrinen.csail.mit.edu) Received: from khavrinen.csail.mit.edu (localhost.csail.mit.edu [127.0.0.1]) by khavrinen.csail.mit.edu (8.14.2/8.14.2) with ESMTP id m5UIIaLF070528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL CN=khavrinen.csail.mit.edu issuer=Client+20CA); Mon, 30 Jun 2008 14:18:36 -0400 (EDT) (envelope-from wollman@khavrinen.csail.mit.edu) Received: (from wollman@localhost) by khavrinen.csail.mit.edu (8.14.2/8.14.2/Submit) id m5UIIaX2070525; Mon, 30 Jun 2008 14:18:36 -0400 (EDT) (envelope-from wollman) From: Garrett Wollman MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18537.9084.554477.556052@khavrinen.csail.mit.edu> Date: Mon, 30 Jun 2008 14:18:36 -0400 To: Kris Kennaway In-Reply-To: <48691D31.9010202@FreeBSD.org> References: <48691D31.9010202@FreeBSD.org> X-Mailer: VM 7.17 under 21.4 (patch 21) "Educational Television" XEmacs Lucid X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-3.0 (khavrinen.csail.mit.edu [127.0.0.1]); Mon, 30 Jun 2008 14:18:37 -0400 (EDT) Cc: standards@freebsd.org Subject: 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:41:07 -0000 < 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.) -GAWollman