Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: pwd -r vs. pwd test failure



Vin Shelton wrote on Fri, 27 Mar 2020 07:56 -0400:
> Almost, but not quite:

Does this work better?  I added another :P.  This catches the case that
the source directory isn't a realpath.  (The case that the _build_ directory
isn't a realpath worked since day one.)

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

---
 Test/B13whence.ztst | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Test/B13whence.ztst b/Test/B13whence.ztst
index ea0a4dae5..3b35835fe 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
@@ -16,13 +19,13 @@
 %test
 
   (
-    path=( $PWD/whence.tmp $path )
+    path=( ${PWD:P}/whence.tmp $path )
     whence -S step1
     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 )

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author