Fix for broken usepipes
authorAndrew Strong <andrew.david.strong@gmail.com>
Tue, 7 Apr 2015 09:27:25 +0000 (19:27 +1000)
committerAndrew Strong <andrew.david.strong@gmail.com>
Tue, 7 Apr 2015 09:27:25 +0000 (19:27 +1000)
'Usepipes' has been broken for many years, this patch simply
represents a partial revert for the original breakage:

Commit: 900a8efeddb238a1e67fec41857e3d2594227dde

This allows usepipes to run again but exposes abcde to the
issue on macosx10 which this commit tried to rectify:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=527191

So some more attention will be required here. Tested with
cdparanoia and cdda2wav which were both fine, I presume
icedax is also fine. dagrab failed but I see that is also
broken in release version 2.6. Pird and cddafs remain
to be tested.

abcde

diff --git a/abcde b/abcde
index 8c33b09..65b25c3 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -3027,7 +3027,7 @@ do_cdread ()
        if [ "$USEPIPES" = "y" ]; then
                TEMPARG="PIPERIPPER_$CDROMREADERSYNTAX"
                FILEARG="$( eval echo "\$$TEMPARG" )"
        if [ "$USEPIPES" = "y" ]; then
                TEMPARG="PIPERIPPER_$CDROMREADERSYNTAX"
                FILEARG="$( eval echo "\$$TEMPARG" )"
-               REDIR="y"
+               REDIR=""
                PIPE_MESSAGE="and encoding "
        else
                WAVDATA="$ABCDETEMPDIR/track$UTRACKNUM.wav"
                PIPE_MESSAGE="and encoding "
        else
                WAVDATA="$ABCDETEMPDIR/track$UTRACKNUM.wav"
@@ -3043,7 +3043,7 @@ do_cdread ()
                                FILEARG="$WAVDATA"
                                ;;
                esac
                                FILEARG="$WAVDATA"
                                ;;
                esac
-               REDIR="n"
+               REDIR=">&2"
        fi
        if [ "$1" = "onetrack" ]; then
                echo "Grabbing ${PIPE_MESSAGE}tracks $UTRACKNUM - $LASTTRACK as one track ..." >&2
        fi
        if [ "$1" = "onetrack" ]; then
                echo "Grabbing ${PIPE_MESSAGE}tracks $UTRACKNUM - $LASTTRACK as one track ..." >&2
@@ -3059,16 +3059,11 @@ do_cdread ()
                ### FIXME ### use an exception for flac, since it uses -o
                ### FIXME ### Shall we just use -o $FILEARG ??
                flac)
                ### FIXME ### use an exception for flac, since it uses -o
                ### FIXME ### Shall we just use -o $FILEARG ??
                flac)
-                       # Avoid problems wit math expressions by unpadding the given UTRACKNUM
+                       # Avoid problems with math expressions by unpadding the given UTRACKNUM
                        STRIPTRACKNUM=$(expr $UTRACKNUM + 0)
                        nice $READNICE $FLAC -d -f --cue=${READTRACKNUMS:-$STRIPTRACKNUM.1-$(($STRIPTRACKNUM + 1)).0} "$FILEARG" "$CDROM" ;;
                cdparanoia)
                        STRIPTRACKNUM=$(expr $UTRACKNUM + 0)
                        nice $READNICE $FLAC -d -f --cue=${READTRACKNUMS:-$STRIPTRACKNUM.1-$(($STRIPTRACKNUM + 1)).0} "$FILEARG" "$CDROM" ;;
                cdparanoia)
-                       if [ "$REDIR" = "y" ]; then
-                               nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG" >&2
-                       else
-                               nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG"
-                       fi;;
-
+                       nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG" $REDIR ;;
                cdda2wav | icedax)
                        if [ "$OSFLAVOUR" = "OSX" ] ; then
                                # Hei, we have to unmount the device before running anything like cdda2wav/icedax in OSX
                cdda2wav | icedax)
                        if [ "$OSFLAVOUR" = "OSX" ] ; then
                                # Hei, we have to unmount the device before running anything like cdda2wav/icedax in OSX
@@ -3084,25 +3079,11 @@ do_cdread ()
                                        CDDA2WAVCDROM="$CDROMID"
                                fi
                        fi
                                        CDDA2WAVCDROM="$CDROMID"
                                fi
                        fi
-                       if [ "$REDIR" = "y" ]; then
-                               nice $READNICE $CDROMREADER -D $CDDA2WAVCDROM -t ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG" >&2
-                       else
-                               nice $READNICE $CDROMREADER -D $CDDA2WAVCDROM -t ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG"
-                       fi ;;
+                       nice $READNICE $CDROMREADER -D $CDDA2WAVCDROM -t ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG" $REDIR ;;
                ## FIXME ## We have an exception for dagrab, since it uses -f
                ## FIXME ## Shall we just use -f $FILEARG ??
                ## FIXME ## We have an exception for dagrab, since it uses -f
                ## FIXME ## Shall we just use -f $FILEARG ??
-               dagrab)
-               if [ "$REDIR" = "y" ]; then
-                               nice $READNICE $CDROMREADER -d "$CDROM" -v $UTRACKNUM "$FILEARG" >&2
-                       else
-                               nice $READNICE $CDROMREADER -d "$CDROM" -v $UTRACKNUM "$FILEARG"
-                       fi ;;
-               pird)
-                       if [ "$REDIR" = "y" ]; then
-                               nice $READNICE $CDROMREADER -j ${READTRACKNUMS:-$UTRACKNUM} "$CDROM" "$FILEARG"
-                       else
-                               nice $READNICE $CDROMREADER -j ${READTRACKNUMS:-$UTRACKNUM} "$CDROM" "$PIPERIPPER_pird" > "$FILEARG"
-                       fi ;;
+               dagrab) nice $READNICE $CDROMREADER -d "$CDROM" -v $UTRACKNUM "$FILEARG" $REDIR;;
+               pird) nice $READNICE $CDROMREADER -j ${READTRACKNUMS:-$UTRACKNUM} "$CDROM" "$FILEARG" $REDIR ;;
                cddafs)
                        # Find the track's mounted path
                        REALTRACKNUM=$(expr $UTRACKNUM + 0)
                cddafs)
                        # Find the track's mounted path
                        REALTRACKNUM=$(expr $UTRACKNUM + 0)
@@ -3110,20 +3091,11 @@ do_cdread ()
                        FILEPATH=$(find "$FILEPATH" | grep "/$REALTRACKNUM ");
                        # If the file exists, copy it
                        if [ -e "$FILEPATH" ] ; then
                        FILEPATH=$(find "$FILEPATH" | grep "/$REALTRACKNUM ");
                        # If the file exists, copy it
                        if [ -e "$FILEPATH" ] ; then
-                               if [ "$REDIR" = "y" ]; then
-                                       nice $READNICE $CDROMREADER "$FILEPATH" "$FILEARG" >&2
-                               else
-                                       nice $READNICE $CDROMREADER "$FILEPATH" "$FILEARG"
-                               fi
+                               nice $READNICE $CDROMREADER "$FILEPATH" "$FILEARG" $REDIR
                        else
                                false
                        fi ;;
                        else
                                false
                        fi ;;
-               debug)
-                       if [ "$REDIR" = "y" ]; then
-                               nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" -w $UTRACKNUM-[:1] "$FILEARG" >&2
-                       else
-                               nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" -w $UTRACKNUM-[:1] "$FILEARG"
-                       fi ;;
+               debug) nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" -w $UTRACKNUM-[:1] "$FILEARG" $REDIR ;;
        esac
        RETURN=$?
        # If we get some error or we get some missing wav
        esac
        RETURN=$?
        # If we get some error or we get some missing wav