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

Re: PATH: autoload with explicit path



On Sun, 29 Jan 2017 16:53:01 -0500
Vin Shelton <acs@xxxxxxxxxxxxxxxxxxxx> wrote:
> (Peter I copied you directly because email from my gmail account has been
> bouncing.)
> 
> I am seeing two failures with the latest updates, see below.  Please let me
> know if you need more info.
> /opt/src/zsh-2017-01-29/Test/C04funcdef.ztst: starting.
> --- /tmp/zsh.ztst.11675/ztst.out 2017-01-29 16:48:50.438882533 -0500
> +++ /tmp/zsh.ztst.11675/ztst.tout 2017-01-29 16:48:50.442882549 -0500
> @@ -1 +1 @@
> -oops is a shell function from CURDIR/oops
> +oops is a shell function from /SSD-2TBCURDIR/oops
> /opt/src/zsh-2017-01-29/Test/V06parameter.ztst: starting.
> --- /tmp/zsh.ztst.14908/ztst.out 2017-01-29 16:48:55.798904574 -0500
> +++ /tmp/zsh.ztst.14908/ztst.tout 2017-01-29 16:48:55.802904591 -0500
> @@ -3,8 +3,8 @@
>  Inside function fn
>  2 + ./functrace.zsh:10 + ./functrace.zsh:5
>  Inside autofn
> -2 + ./functrace.zsh:20 + CURDIR/autofn:0
> +2 + ./functrace.zsh:20 + /SSD-2TB/opt/build/zsh-2017-01-29/Test/autofn:0
>  Inside autofn
> -2 + ./functrace.zsh:21 + CURDIR/autofn:0
> +2 + ./functrace.zsh:21 + /SSD-2TB/opt/build/zsh-2017-01-29/Test/autofn:0
>  In sourced file
>  2 + ./functrace.zsh:22 + ./sourcedfile:0

Let's try the following trick, which has been in use in B01cd.ztst for
some time so presumably works.

pws

diff --git a/Test/C04funcdef.ztst b/Test/C04funcdef.ztst
index 176841d..0cf2b58 100644
--- a/Test/C04funcdef.ztst
+++ b/Test/C04funcdef.ztst
@@ -2,6 +2,10 @@
 
   mkdir funcdef.tmp
   cd funcdef.tmp
+  setopt chaselinks
+  cd .
+  unsetopt chaselinks
+  mydir=$PWD
 
 %test
 
@@ -325,10 +329,10 @@
     printf '%s\n' 'oops(){}' 'ninjas-earring(){}' 'oops "$@"' >oops
     autoload oops
     oops
-    whence -v oops | sed -e "s%$PWD%CURDIR%"
+    whence -v oops
   )
-0:whence -v of zsh-style autoload
->oops is a shell function from CURDIR/oops
+0q:whence -v of zsh-style autoload
+>oops is a shell function from $mydir/oops
 
   (
     fpath=(.)
diff --git a/Test/V06parameter.ztst b/Test/V06parameter.ztst
index c2a2a4d..10e0a27 100644
--- a/Test/V06parameter.ztst
+++ b/Test/V06parameter.ztst
@@ -1,15 +1,22 @@
+%prep
+
+  setopt chaselinks
+  cd .
+  unsetopt chaselinks
+  mydir=$PWD
+
 %test
 
   print 'print In sourced file
-  print $LINENO + $functrace + ${funcsourcetrace/#$PWD/CURDIR}
+  print $LINENO + $functrace + ${funcsourcetrace}
   ' >sourcedfile
   print -r -- 'print Started functrace.zsh
   module_path=(./Modules)
-  print $LINENO + $functrace + ${funcsourcetrace/#$PWD/CURDIR}
+  print $LINENO + $functrace + ${funcsourcetrace}
   :
   fn() {
     print Inside function $0
-    print $LINENO + $functrace + ${funcsourcetrace/#$PWD/CURDIR}
+    print $LINENO + $functrace + ${funcsourcetrace}
   }
   :
   fn
@@ -17,7 +24,7 @@
   fpath=(. $fpath)
   :
   echo '\''print Inside $0
-    print $LINENO + $functrace + ${funcsourcetrace/#$PWD/CURDIR}
+    print $LINENO + $functrace + ${funcsourcetrace}
   '\'' >autofn
   :
   autoload autofn
@@ -26,15 +33,15 @@
   autofn
   . ./sourcedfile' >functrace.zsh
   $ZTST_testdir/../Src/zsh +Z -f ./functrace.zsh
-0:Function tracing
+0q:Function tracing
 >Started functrace.zsh
 >3 + +
 >Inside function fn
 >2 + ./functrace.zsh:10 + ./functrace.zsh:5
 >Inside autofn
->2 + ./functrace.zsh:20 + CURDIR/autofn:0
+>2 + ./functrace.zsh:20 + $mydir/autofn:0
 >Inside autofn
->2 + ./functrace.zsh:21 + CURDIR/autofn:0
+>2 + ./functrace.zsh:21 + $mydir/autofn:0
 >In sourced file
 >2 + ./functrace.zsh:22 + ./sourcedfile:0
 
@@ -70,14 +77,14 @@
     fpath=($PWD)
     print "print I have been autoloaded" >myfunc
     autoload $PWD/myfunc
-    print ${functions_source[myfunc]/#$PWD/CURDIR}
+    print ${functions_source[myfunc]}
     myfunc
-    print ${functions_source[myfunc]/#$PWD/CURDIR}
+    print ${functions_source[myfunc]}
   )
-0: $functions_source
->CURDIR/myfunc
+0q: $functions_source
+>$mydir/myfunc
 >I have been autoloaded
->CURDIR/myfunc
+>$mydir/myfunc
 
 %clean
 



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