ctdb-tools: Drop separate parallel+verbose stdout/stderr filtering
authorMartin Schwenke <martin@meltin.net>
Fri, 28 Jun 2019 05:46:57 +0000 (15:46 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 5 Jul 2019 05:03:22 +0000 (05:03 +0000)
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 <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tools/onnode

index 863b8b393c53e4f6035291130cc46b8b41e24edf..e143ba2d4d42a0bb3b5685ceeb6bcb08bfb83939 100755 (executable)
@@ -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