[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r4829 - in /trunk/libc: ChangeLog.eglibc scripts/cross-test-ssh.sh
- To: commits@xxxxxxxxxx
- Subject: [commits] r4829 - in /trunk/libc: ChangeLog.eglibc scripts/cross-test-ssh.sh
- From: dan@xxxxxxxxxx
- Date: Wed, 09 Jan 2008 17:11:31 -0000
Author: dan
Date: Wed Jan 9 09:11:30 2008
New Revision: 4829
Log:
* scripts/cross-test-ssh.sh (env_blacklist): Add TERM, TERMCAP, PWD.
(remove_newlines): New.
(blacklist_exports): Unset blacklisted variables and use export.
(Top level): Use remove_newlines.
Modified:
trunk/libc/ChangeLog.eglibc
trunk/libc/scripts/cross-test-ssh.sh
Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Wed Jan 9 09:11:30 2008
@@ -1,3 +1,10 @@
+2008-01-09 Daniel Jacobowitz <dan@xxxxxxxxxxxxxxxx>
+
+ * scripts/cross-test-ssh.sh (env_blacklist): Add TERM, TERMCAP, PWD.
+ (remove_newlines): New.
+ (blacklist_exports): Unset blacklisted variables and use export.
+ (Top level): Use remove_newlines.
+
2007-12-13 Sandra Loosemore <sandra@xxxxxxxxxxxxxxxx>
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Make strfmon
Modified: trunk/libc/scripts/cross-test-ssh.sh
==============================================================================
--- trunk/libc/scripts/cross-test-ssh.sh (original)
+++ trunk/libc/scripts/cross-test-ssh.sh Wed Jan 9 09:11:30 2008
@@ -3,7 +3,7 @@
# Run with --help flag to get more detailed help.
progname="$(basename $0)"
-env_blacklist='HOME LOGNAME MAIL PATH SHELL SHLVL SSH_CLIENT SSH_CONNECTION USER'
+env_blacklist='HOME LOGNAME MAIL PATH SHELL SHLVL SSH_CLIENT SSH_CONNECTION USER TERM TERMCAP PWD'
usage="usage: ${progname} [--ssh SSH] HOST COMMAND ..."
help="Run an EGLIBC test COMMAND on the remote machine HOST, via ssh,
@@ -87,24 +87,32 @@
printf '%s' '"'
}
-# Echo all lines of input except those starting with 'export VAR=',
-# where VAR is a blacklisted variable. Turn lines starting with
-# 'declare -x VAR=' into the analogous export commands, before
-# blacklisting.
+# Remove unnecessary newlines from a Bourne shell command sequence.
+remove_newlines () {
+ sed -n \
+ -e '1h' \
+ -e '2,$H' \
+ -e '${g
+ s/\([^\]\)\n/\1; /g
+ p
+ }'
+}
+
+# Unset all variables from the blacklist. Then echo all exported
+# variables. This should be run in a subshell. The 'export -p'
+# command adds backslashes for environment variables which contain
+# newlines.
blacklist_exports () {
- local pat
- pat="$(for var in ${env_blacklist}; do
- echo "^export ${var}="
- done)"
- sed -e 's|^declare -x |export |' \
- | grep -v -e "$pat"
+ local var
+ for var in ${env_blacklist}; do
+ unset $var
+ done
+ export -p
}
# Produce properly quoted Bourne shell arguments for 'env' to carry
# over the current environment, less blacklisted variables.
-# The 'export -p' command munges the values of environment variables if
-# they contain newlines.
-exports="$(export -p | blacklist_exports)"
+exports="$( (blacklist_exports) | sed -e 's|^declare -x |export |')"
# Transform the current argument list into a properly quoted Bourne shell
# command string.
@@ -122,4 +130,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 "$(printf '%s\n' "${command}" | bourne_quote)"
+$ssh "$host" /bin/sh -c "$(printf '%s\n' "${command}" | bourne_quote | remove_newlines)"