about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2018-09-05 17:58:04 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2018-09-05 17:58:41 +0100
commit9bc7e5b404d7d4f45a54e4d44d7a75f1c486810b (patch)
tree154fb6b560c5c8b839b76b080bb32c91a28a327e
parent55f1afcec83629a089fd96bc64b4005960eebe90 (diff)
downloadzsh-9bc7e5b404d7d4f45a54e4d44d7a75f1c486810b.tar.gz
zsh-9bc7e5b404d7d4f45a54e4d44d7a75f1c486810b.tar.xz
zsh-9bc7e5b404d7d4f45a54e4d44d7a75f1c486810b.zip
43375 with fix from 43390: fix #! tests.
Don't assume path to sh and echo, instead work it out.
-rw-r--r--ChangeLog5
-rw-r--r--Test/A05execution.ztst18
2 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 199364de3..eb185f4e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-05  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 43375 with fix from 43390: Test/A05execution.ztst: don't
+	assume path for sh and echo, work it out.
+
 2018-09-05  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* unposted (cf 43373): Etc/creating-a-release.txt: Add two
diff --git a/Test/A05execution.ztst b/Test/A05execution.ztst
index fb39d0589..567bd2530 100644
--- a/Test/A05execution.ztst
+++ b/Test/A05execution.ztst
@@ -6,16 +6,20 @@
 
   cd command.tmp
 
-  print '#!/bin/sh\necho This is top' >tstcmd
+  shcmd="$(which sh)"
+  shpath=${shcmd:h}
+  echocmd="$(which -p echo)"
+  echopath=${echocmd:h}
+  print "#!${shcmd}\necho This is top" >tstcmd
 
-  print '#!/bin/sh\necho This is dir1' >dir1/tstcmd
+  print "#!${shcmd}\necho This is dir1" >dir1/tstcmd
 
-  print '#!/bin/sh\necho This is dir2' >dir2/tstcmd
+  print "#!${shcmd}\necho This is dir2" >dir2/tstcmd
 
   print -n '#!sh\necho This is slashless' >tstcmd-slashless
   print -n '#!echo foo\necho This is arg' >tstcmd-arg
   print '#!xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxnyyy' >tstcmd-interp-too-long
-  print '#!/bin/sh\necho should not execute; exit 1' >xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxn
+  print "#!${sh}\necho should not execute; exit 1" >xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxn
 
   chmod 755 tstcmd dir1/tstcmd dir2/tstcmd
   chmod 755 tstcmd-slashless tstcmd-arg tstcmd-interp-too-long
@@ -40,15 +44,15 @@
 0:path (2)
 >This is top
 
-  PATH=/bin:${ZTST_testdir}/command.tmp/ tstcmd-slashless
+  PATH=${shpath}:${ZTST_testdir}/command.tmp/ tstcmd-slashless
 0:path (3)
 >This is slashless
 
-  PATH=/bin:${ZTST_testdir}/command.tmp tstcmd-arg
+  PATH=${echopath}:${ZTST_testdir}/command.tmp tstcmd-arg
 0:path (4)
 *>foo */command.tmp/tstcmd-arg
 
-  path=(/bin ${ZTST_testdir}/command.tmp/)
+  path=($shpath $echopath ${ZTST_testdir}/command.tmp/)
   tstcmd-interp-too-long 2>&1; echo "status $?"
   path=($storepath)
 0:path (5)