zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Vin Shelton <acs@alumni.princeton.edu>
Cc: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: Re: pwd -r vs. pwd test failure
Date: Thu, 26 Mar 2020 22:02:50 +0000	[thread overview]
Message-ID: <20200326220250.11861abd@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CACeGjnVRZsvUuWTSWL9Hq-LbnqLVAHqR0Jia2Ax6a4MmfcBVug@mail.gmail.com>

Vin Shelton wrote on Thu, 26 Mar 2020 08:22 -0400:
> I got a test failure in B13 today:
> 

Thanks for the report.

> Test ../../../src/zsh-2020-03-26/Test/B13whence.ztst failed: output differs
> from expected as shown above for:
>   (
>     path=( $PWD/whence.tmp $path )
>     whence -S step1
>     whence -s step1
>   )
> Was testing: whence symlink resolution
> ../../../src/zsh-2020-03-26/Test/B13whence.ztst: test failed.
> 
> Looking at the diff, I realized that my build directory is under a symlink;
> /opt -> /SSD-2/opt. The test uses $PWD, which resolves to
> /opt/build/zsh-2020-03-26, but pwd -r correct identifies the path as
> /SSD-2/opt/build/zsh-2020-03-26; sure enough, if I run the test from
> /SSD-2/opt/build/zsh-2020-03-26, the test passes. Is the right thing to fix
> the test, or should $PWD track realpath?

I don't see any reason to change the semantics of $PWD, so let's fix
the test:

8<--
From a3c664f6bede4c33eb57a7a76134c1121069970b Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <d.s@daniel.shahaf.name>
Date: Thu, 26 Mar 2020 21:41:49 +0000
Subject: [PATCH] Fix new test when ${PWD}'s value contains symlinks.

---
 Test/B13whence.ztst | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Test/B13whence.ztst b/Test/B13whence.ztst
index ea0a4dae5..5993c2247 100644
--- a/Test/B13whence.ztst
+++ b/Test/B13whence.ztst
@@ -1,7 +1,10 @@
 %prep
 
   mkdir whence.tmp
-  pushd whence.tmp
+  ln -s . whence.tmp/cwd
+  # cd through the symlink in order to test the case that ${prefix} and
+  # ${prefix:P} are different
+  pushd whence.tmp/cwd
   ln -s real step3
   ln -s step3 step2
   ln -s step2 step1
@@ -21,8 +24,8 @@
     whence -s step1
   )
 0q:whence symlink resolution
->$prefix/step1 -> $prefix/step2 -> $prefix/step3 -> $prefix/real
->$prefix/step1 -> $prefix/real
+>${prefix:P}/step1 -> ${prefix:P}/step2 -> ${prefix:P}/step3 -> ${prefix:P}/real
+>${prefix:P}/step1 -> ${prefix:P}/real
 
   (
     path=( $PWD/whence.tmp $path )

Thanks again,

Daniel

  reply	other threads:[~2020-03-26 22:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 12:22 Vin Shelton
2020-03-26 22:02 ` Daniel Shahaf [this message]
2020-03-27 11:56   ` Vin Shelton
2020-03-27 23:11     ` Daniel Shahaf
2020-03-28  0:20       ` Vin Shelton
2020-03-28  0:57         ` Daniel Shahaf
2020-03-28  1:17           ` Vin Shelton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200326220250.11861abd@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=acs@alumni.princeton.edu \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).