From patchwork Sat Nov 21 09:35:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 547139 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D79CF1402A9 for ; Sat, 21 Nov 2015 20:35:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=iwnNdkiE; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=QTpQV pmPcoi5NtxHYIix+DqRgpH4CaBjp1as+t1ss4bULEKmXgjxDAczHzYUjPkuv5Plx Uf69/VoGd67yb1BB7ANgoVj1K3l24HBePRsdVwQmpLiUybDxIqRm5H5mCrTYBHsD HEHm5nWrxmHkmBEsTuQX+qDyTUq4BKZznu4DeE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=vtC+ftzcpps M7i1wj3JyFoVfDXo=; b=iwnNdkiEIyeN1eoaebShAGVAe3Ykg/i4L7fsh0riQ8I QRO5BYH0/ryNT1rTg1nEw6O3p/P3PUXfyWT7df/jXa/ZKSfG33QBVAYMJcKjSHby fC/0ms+B3n7TrJepU+PFk8VBbgvl22A9P7zFFczcT/HBCSOXulCgLAjmo61ZstuU = Received: (qmail 124271 invoked by alias); 21 Nov 2015 09:35:17 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 124258 invoked by uid 89); 21 Nov 2015 09:35:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS, URIBL_BLACK autolearn=no version=3.3.2 X-HELO: eggs.gnu.org From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Joseph Myers Cc: Subject: [PATCH v2] Rely on the shell's built-in 'pwd' command. References: <87610xisjp.fsf@gnu.org> <87poz5j83g.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 1 Frimaire an 224 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x3D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Sat, 21 Nov 2015 10:35:07 +0100 In-Reply-To: (Joseph Myers's message of "Fri, 20 Nov 2015 11:46:48 +0000") Message-ID: <87mvu7d7as.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e Joseph Myers skribis: > On Fri, 20 Nov 2015, Ludovic Courtès wrote: > >> Joseph Myers skribis: >> >> > On Thu, 19 Nov 2015, Ludovic Courtès wrote: >> > >> >> AFAIK insisting on /bin/pwd is unnecessary nowadays. Autoconf-generated >> >> scripts have been using the shell’s built-in ‘pwd’ for a long time. >> > >> > The point of at least some of these uses of pwd is to get the physical >> > directory with symlinks resolved, not the shell's notion of the directory >> > that may involve symlinks. It would need to be pwd -P, if that's >> > sufficiently portable. >> >> It’s not clear to which of these uses want the canonical directory >> name. Which ones did you have in mind? > > I think all of those uses need the canonical name. How about this variant? Thanks, Ludo’. ChangeLog: 2015-11-21 Ludovic Courtès * configure.ac: Use 'pwd -P' instead of '/bin/pwd'. * configure: Regenerate. * io/ftwtest-sh: Use 'pwd -P' instead of '/bin/pwd'. * scripts/rellns-sh: Likewise. Remove 'pwd' variable. configure | 2 +- configure.ac | 2 +- io/ftwtest-sh | 8 ++++---- scripts/rellns-sh | 18 +++++------------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/configure b/configure index 90953f0..ae8f69b 100755 --- a/configure +++ b/configure @@ -3228,7 +3228,7 @@ if test $libc_cv_cxx_link_ok != yes; then : CXX= fi -if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then +if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then as_fn_error $? "you must configure in a separate build directory" "$LINENO" 5 fi diff --git a/configure.ac b/configure.ac index cd37433..d5ab8f0 100644 --- a/configure.ac +++ b/configure.ac @@ -80,7 +80,7 @@ LDFLAGS="$old_LDFLAGS" AC_LANG_POP([C++])]) AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=]) -if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then +if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then AC_MSG_ERROR([you must configure in a separate build directory]) fi diff --git a/io/ftwtest-sh b/io/ftwtest-sh index 8669eab..f3e3597 100644 --- a/io/ftwtest-sh +++ b/io/ftwtest-sh @@ -135,7 +135,7 @@ $testprogram --chdir $tmpdir | sort > $testout # perhaps $tmp involves some symlinks... -tmpreal=`cd $tmp; /bin/pwd 2>/dev/null || /usr/bin/pwd` +tmpreal=`cd $tmp; pwd -P 2>/dev/null` cat </dev/null || /usr/bin/pwd` +curwd=`pwd -P 2>/dev/null` cd "$tmp" $testprogram --chdir ftwtest.d | sort > $testout @@ -175,7 +175,7 @@ base = "ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, cwd = $tm EOF rm $testout -curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` +curwd=`pwd -P` cd "$tmp" $testprogram --chdir ftwtest.d/. | sort > $testout @@ -197,7 +197,7 @@ base = "ftwtest.d/./foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, cwd = $ EOF rm $testout -curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` +curwd=`pwd -P 2>/dev/null` cd "$tmp" $testprogram --chdir ftwtest.d/foo/lvl1/link@1 | sort > $testout diff --git a/scripts/rellns-sh b/scripts/rellns-sh index f107433..9c733b5 100755 --- a/scripts/rellns-sh +++ b/scripts/rellns-sh @@ -30,23 +30,15 @@ if test $# -ne 2; then exit 1 fi -if test -x /bin/pwd; then - pwd=/bin/pwd -elif test -x /usr/bin/pwd; then - pwd=/usr/bin/pwd -else - pwd='pwd' -fi - # Make both paths absolute. if test -d $1; then - to=`cd $1 && $pwd` + to=`cd $1 && pwd -P` else temp=`echo $1 | sed 's%/*[^/]*$%%'` if test -z "$temp"; then - to=`$pwd` + to=`pwd -P` else - to=`cd $temp && $pwd` + to=`cd $temp && pwd -P` fi to="$to/`echo $1 | sed 's%.*/\([^/][^/]*\)$%\1%'`" fi @@ -59,9 +51,9 @@ else fi if test -z "$from"; then - from=`$pwd | sed 's%^/%%'` + from=`pwd -P | sed 's%^/%%'` else - from=`cd $from && $pwd | sed 's%^/%%'` + from=`cd $from && pwd -P | sed 's%^/%%'` fi while test -n "$to" && test -n "$from"; do -- 2.6.3