From 9bc7e5b404d7d4f45a54e4d44d7a75f1c486810b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 5 Sep 2018 17:58:04 +0100 Subject: 43375 with fix from 43390: fix #! tests. Don't assume path to sh and echo, instead work it out. --- ChangeLog | 5 +++++ Test/A05execution.ztst | 18 +++++++++++------- 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 + + * 43375 with fix from 43390: Test/A05execution.ztst: don't + assume path for sh and echo, work it out. + 2018-09-05 Daniel Shahaf * 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) -- cgit 1.4.1