[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] Fix cross testing for posix/globtest.out



I've applied this patch to fix cross testing of the posix/globtest.out 
test.  "echo -n" is not portable, and when $word is "-e" it simply doesn't 
work; if echo accepts one option it will accept the other.  "-e" is an 
option passed to a test program in this test.  Thus I've replaced most 
uses of echo with printf in this script.

Note that for this test, and some others, to work reliably with an NFS 
shared filesystem, the board must mount it with options including 
acdirmax=0,acdirmin=0, so that directory changes made by the test script 
(run on the host) can reliably be seen immediately on the board.

Index: scripts/cross-test-ssh.sh
===================================================================
--- scripts/cross-test-ssh.sh	(revision 2008)
+++ scripts/cross-test-ssh.sh	(working copy)
@@ -76,7 +76,7 @@
 
 # Return all input as a properly quoted Bourne shell string.
 bourne_quote () {
-    echo -n '"'
+    printf '%s' '"'
     sed -n \
         -e '1h' \
         -e '2,$H' \
@@ -84,7 +84,7 @@
               s/["$\`]/\\&/g
               p
              }'
-    echo -n '"'
+    printf '%s' '"'
 }
 
 # Echo all lines of input except those starting with 'export VAR=',
@@ -109,8 +109,8 @@
 # Transform the current argument list into a properly quoted Bourne shell
 # command string.
 command="$(for word in "$@"; do
-               echo -n "$word" | bourne_quote
-               echo -n ' '
+               printf '%s' "$word" | bourne_quote
+               printf '%s' ' '
            done)"
 
 # Add commands to set environment variables and the current directory.
@@ -122,4 +122,4 @@
 # passes them to some shell.  We want to force the use of /bin/sh,
 # so we need to re-quote the whole command to ensure it appears as
 # the sole argument of the '-c' option.
-$ssh "$host" /bin/sh -c "$(echo "${command}" | bourne_quote)"
+$ssh "$host" /bin/sh -c "$(printf '%s\n' "${command}" | bourne_quote)"
Index: ChangeLog.eglibc
===================================================================
--- ChangeLog.eglibc	(revision 2008)
+++ ChangeLog.eglibc	(working copy)
@@ -1,3 +1,7 @@
+2007-04-18  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* scripts/cross-test-ssh.sh: Use printf in place of echo.
+
 2007-04-16  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/powerpc/fpu/bits/fenvinline.h: Test _SOFT_FLOAT together

-- 
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx