From: Martin Schwenke Date: Fri, 28 Jun 2019 05:46:57 +0000 (+1000) Subject: ctdb-tools: Drop separate parallel+verbose stdout/stderr filtering X-Git-Tag: samba-4.11.0rc1~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6478d65a2f1bc79040753f4dae952c638fcb64e2;p=thirdparty%2Fsamba.git ctdb-tools: Drop separate parallel+verbose stdout/stderr filtering This has been broken for 10 years since commit 9616959bd6938e4c5c3713fe986c1e17cbdc574c, which introduced the separate filtering. This commit was missing a redirect of the output of stderr_filter() to stderr. Since nobody depends on the separate filtering (i.e. nobody reported a bug), just return to combining stdout and stderr, and filtering them together. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tools/onnode b/ctdb/tools/onnode index 863b8b393c5..e143ba2d4d4 100755 --- a/ctdb/tools/onnode +++ b/ctdb/tools/onnode @@ -269,24 +269,6 @@ push() done } -stdout_filter () -{ - if $verbose && $parallel ; then - sed -e "s@^@[$n] @" - else - cat - fi -} - -stderr_filter () -{ - if $verbose && $parallel ; then - sed -e "s@^@[$n] @" - else - cat - fi -} - ###################################################################### parse_options "$@" @@ -331,21 +313,13 @@ retcode=0 for n in $nodes ; do set -o pipefail 2>/dev/null - # The following code applies stdout_filter and stderr_filter to - # the relevant streams. Both filters are at the end of pipes so - # they read from stdin and (by default) write to stdout. To allow - # the filters to operate independently, the output of - # stdout_filter is sent to a temporary file descriptor (3), which - # is redirected back to stdout at the outermost level. ssh_cmd="$ONNODE_SSH $ssh_opts $ONNODE_SSH_OPTS" if $parallel ; then - { - exec 3>&1 - { - $ssh_cmd "$n" "$command" 3>&- | - stdout_filter >&3 - } 2>&1 | stderr_filter - } & + if $verbose ; then + $ssh_cmd "$n" "$command" 2>&1 | sed -e "s@^@[$n] @" + else + $ssh_cmd "$n" "$command" + fi & pids="${pids} $!" else if $verbose ; then