There are a number of non-portable idioms in the test scripts:

- "tar -z" is only supported by GNU tar, whose name we cannot depend on
(when it is available, it is usually called gtar everywhere but on
GNU-based platforms)
- I know $(...) is POSIX, and I do find this syntax invaluable compared to
the traditional backquote one, but if we do not want to play substitution
games more than really needed, we'd better not use it, especially since
there is no need for nested constructs in these scripts
- the shells on Solaris have a strange way of quoting things, so every
instance of "sh -c" needs an extra level of quotes.  That was part of the
remarks I had years ago when I ported fakeroot, but this time I have a
hack that works on both platforms.  I do agree it is not a very clean
solution, though.  Strangely, this behaviour is consistent between
/bin/sh, /usr/xpg4/bin/sh, and bash.

The only remaining issues are:

- echoarg failure is not caught on Solaris, as withough the $Q hack we see:
make  check-TESTS
RET=
PASS: t.echoarg

- probably not with the tests themselves, I'll look at it later:

ld.so.1: sort: fatal: .../fakeroot-1.3/.libs/libfakeroot.so.0: wrong ELF
class: ELFCLASS32
FAIL: t.tar
diff -ruN fakeroot-1.3.orig/scripts/fakeroot.in fakeroot-1.3/scripts/fakeroot.in
--- fakeroot-1.3.orig/scripts/fakeroot.in       2005-05-09 17:53:43.000000000 
+0200
+++ fakeroot-1.3/scripts/fakeroot.in    2005-06-28 10:39:27.594507000 +0200
@@ -6,7 +6,7 @@
 usage () {
 cat - >&2 <<EOF
 fakeroot, create a fake root environment.
-   usage: fakeroot [-l|--lib fakerootlib] [-r|--faked fakedbin]
+   usage: fakeroot [-l|--lib fakerootlib] [-f|--faked fakedbin]
                    [-i file] [-s file] [-u|--unknown-is-real]
                   [-b|--fd-base fd] [-h|--help] [-v|--version]
                    [--] [command]
@@ -122,9 +122,9 @@
 PID=`echo $KEY_PID|cut -d: -f2`
 
 if [ "$WAITINTRAP" -eq 0 ]; then
-  trap "kill -s TERM $PID" EXIT INT
+  trap "kill -TERM $PID" EXIT INT
 else
-  trap "kill -s TERM $PID ; wait $PID >/dev/null 2>&1" EXIT INT
+  trap "kill -TERM $PID ; wait $PID >/dev/null 2>&1" EXIT INT
 fi
 
 if test -z "$FAKEROOTKEY" || test -z "$PID"; then
diff -ruN fakeroot-1.3.orig/test/compare-tar fakeroot-1.3/test/compare-tar
--- fakeroot-1.3.orig/test/compare-tar  2004-06-18 21:42:10.000000000 +0200
+++ fakeroot-1.3/test/compare-tar       2005-06-28 15:11:17.378475000 +0200
@@ -2,8 +2,8 @@
 set -e
 echo compare-tar:
 
-tar -tvzf $1 |perl -p -e 's/^((.*?)(\t+|\s\s+)\d+).*\s(\S+)$/$1 $4/' |sort > 
tmp-1
-tar -tvzf $2 |perl -p -e 's/^((.*?)(\t+|\s\s+)\d+).*\s(\S+)$/$1 $4/' |sort > 
tmp-2
+gzip -dc $1 | tar -tvf - |perl -p -e 's/^((.*?)(\t+|\s\s+)\d+).*\s(\S+)$/$1 
$4/' |sort > tmp-1
+gzip -dc $2 | tar -tvf - |perl -p -e 's/^((.*?)(\t+|\s\s+)\d+).*\s(\S+)$/$1 
$4/' |sort > tmp-2
 
 diff -u tmp-1 tmp-2 > tmp-diff
 
diff -ruN fakeroot-1.3.orig/test/t.echoarg fakeroot-1.3/test/t.echoarg
--- fakeroot-1.3.orig/test/t.echoarg    2004-06-18 21:42:10.000000000 +0200
+++ fakeroot-1.3/test/t.echoarg 2005-06-28 16:03:39.390848000 +0200
@@ -1,4 +1,7 @@
 #!/bin/sh
 
+Q=
+[ `uname -s` != SunOS ] || Q="'"
+
 ../scripts/fakeroot${tcp} -f ../faked${tcp} -l ../.libs/${libfakeroot} -- \
- sh -c 'RET="$('"${srcdir}"'/echo_arg 3 a b c d e)"; echo RET=$RET; test 
"$RET" = "b"'
+ /usr/xpg4/bin/sh -c "$Q"'RET="`'"${srcdir}"'/echo_arg 3 a b c d e`"; echo 
RET=$RET; test "$RET" = "b"'"$Q"
diff -ruN fakeroot-1.3.orig/test/t.mknod fakeroot-1.3/test/t.mknod
--- fakeroot-1.3.orig/test/t.mknod      2004-06-18 21:42:10.000000000 +0200
+++ fakeroot-1.3/test/t.mknod   2005-06-28 15:37:04.016414000 +0200
@@ -1,4 +1,7 @@
 #!/bin/sh
 
+Q=
+[ `uname -s` != SunOS ] || Q="'"
+
 ../scripts/fakeroot${tcp} -f ../faked${tcp} -l ../.libs/${libfakeroot} -- \
- sh -c 'mknod hda3 b 3 1; ls -l hda3' | grep "^b"
+ bash -c "${Q}mknod hda3 b 3 1; ls -l hda3${Q}" | grep "^b"
diff -ruN fakeroot-1.3.orig/test/t.tar fakeroot-1.3/test/t.tar
--- fakeroot-1.3.orig/test/t.tar        2004-06-18 21:42:10.000000000 +0200
+++ fakeroot-1.3/test/t.tar     2005-06-28 15:04:31.633346000 +0200
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-tdir=$(cd ..; pwd -P)
+tdir=`cd ..; pwd -P`
 
 ../scripts/fakeroot${tcp} -f ${tdir}/faked${tcp} -l 
${tdir}/.libs/${libfakeroot} -- \
  ${srcdir}/tartest
diff -ruN fakeroot-1.3.orig/test/t.touchinstall fakeroot-1.3/test/t.touchinstall
--- fakeroot-1.3.orig/test/t.touchinstall       2004-06-18 21:42:10.000000000 
+0200
+++ fakeroot-1.3/test/t.touchinstall    2005-06-28 15:36:19.595301000 +0200
@@ -1,8 +1,12 @@
 #!/bin/sh
 
+Q=
+[ `uname -s` != SunOS ] || Q="'"
+
+rm -rf tmp
 mkdir tmp
 ../scripts/fakeroot${tcp} -f ../faked${tcp} -l ../.libs/${libfakeroot} -- \
- sh -c "touch tmp/iamnotuser; ls -al tmp/iamnotuser" | grep root
+ sh -c "${Q}touch tmp/iamnotuser; ls -al tmp/iamnotuser${Q}" | grep root
 TEMP=$?
 rm -r tmp
 exit $TEMP
diff -ruN fakeroot-1.3.orig/test/tartest fakeroot-1.3/test/tartest
--- fakeroot-1.3.orig/test/tartest      2004-06-22 19:15:56.000000000 +0200
+++ fakeroot-1.3/test/tartest   2005-06-28 16:00:20.183647000 +0200
@@ -1,8 +1,8 @@
-#!/bin/sh -x
+#!/bin/sh
 set -e
 echo tartest:
 TMP=./tmp
-SRCDIR=$(cd ${srcdir}; pwd -P)
+SRCDIR=`cd ${srcdir}; pwd -P`
 PATH=$PATH:/usr/bin/X11
 export PATH
 umask 022
@@ -31,7 +31,7 @@
 #do some mv/rm stuff. 
 #The "mv" part used to confuse fakeroot_0.0-6 
 #   (inodes weren't removed from cache)
-FILES=$(for f in $LIST; do for c in mv rm ; do echo $c.$f ; done ; done)
+FILES=`for f in $LIST; do for c in mv rm ; do echo $c.$f ; done ; done`
 touch $FILES
 chown daemon:sys $FILES
 for f in $LIST; do
@@ -63,7 +63,7 @@
 rm -f tartest.tar.gz
 uudecode ${SRCDIR}/tartest.tar.gz.uue 
 
-tar -czf faketar.tar.gz tar
+tar -cf - tar | gzip -9 > faketar.tar.gz
 
 ${SRCDIR}/compare-tar tartest.tar.gz faketar.tar.gz 
  
@@ -74,8 +74,8 @@
 
 rm -rf tar
 
-tar -xzf tartest.tar.gz
-tar -czf tartest.test.tar.gz tar
+gzip -dc tartest.tar.gz | tar xf -
+tar cf - tar | gzip -9 >tartest.test.tar.gz
 
 ${SRCDIR}/compare-tar tartest.tar.gz tartest.test.tar.gz 
 

Reply via email to