[vorbis-tools] 02/03: Fix vorbistagedit: Reading of file list from stdin was broken

Martin Steghöfer martin.steghoefer-guest at moszumanska.debian.org
Sat Nov 29 17:11:11 UTC 2014


This is an automated email from the git hooks/post-receive script.

martin.steghoefer-guest pushed a commit to branch master
in repository vorbis-tools.

commit 9d531ac7b1f8376a59deb1e0742706f81204f699
Author: Martin Steghöfer <martin at steghoefer.eu>
Date:   Sat Nov 29 17:48:07 2014 +0100

    Fix vorbistagedit: Reading of file list from stdin was broken
    
    The documentation claims that without input files given as
    command-line arguments the list of input filenames is read from stdin,
    and indeed there is code in the script to do so. However, that code is
    never actually executed. If there are no input files given as
    command-line arguments, the "usage" error message is shown and the
    script quits.
    
    I assume that the guard showing the "usage" information and exiting
    was introduced in order to avoid confusion for users that launch the
    script vorbistagedit without parameters and get a program that waits
    for input without saying anything. I worked around this confusion by
    adding an explanatory message in case that stdin comes from an
    interactive console. So the guard preventing input from stdin could be
    removed. The "usage" error message is only shown, if *after* reading
    from stdin the filename list is still empty.
    
    Closes: #771448
---
 debian/extra/vorbistagedit | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/debian/extra/vorbistagedit b/debian/extra/vorbistagedit
index 50e9073..e78016e 100644
--- a/debian/extra/vorbistagedit
+++ b/debian/extra/vorbistagedit
@@ -27,11 +27,6 @@ usage() {
   echo is read from stdin, one per line. >&2
 }
 
-if [ $# -eq 0 ]; then
-  usage
-  exit 1
-fi
-
 # process and reorder arguments using "getopt"
 eval set -- $(getopt -s sh -n $ME -l version,help -o Vh? -- "$@")
 
@@ -73,10 +68,17 @@ fi
 old_IFS="$IFS"
 IFS="
 "
-[ $# -eq 0 ] && set -- $(cat)
+if [ $# -eq 0 ]; then
+  if [ -t 0 ]; then
+    # if stdin is bound to an interactive shell, tell the user what input we're expecting
+    echo "Please provide filenames (one file per line, terminate with Ctrl+D):" >& 2
+  fi
+  set -- $(cat)
+fi
 IFS="$old_IFS"
 
 if [ $# -eq 0 ]; then
+  usage
   exit 0
 fi
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-xiph/vorbis-tools.git



More information about the pkg-xiph-commits mailing list