Package: abcde
Version: 2.4.2-1
Severity: normal

This happened to me again and today I figured out the cause.  The
problematic part of the code is this one:


do_tag ()
{
#...

        for OUTPUT in $(echo $OUTPUTTYPE | tr , \ )
        do
                case "$OUTPUT" in
                mp3)
#...

                flac)
                        (
                        echo ARTIST="$TRACKARTIST"
                        echo ALBUM="$DALBUM"
                        echo TITLE="$TRACKNAME"
                        if [ -n "$CDYEAR" ]; then
#...
                        ) | run_command tagtrack-$OUTPUT-$1 nice $ENCNICE 
$METAFLAC $METAFLACOPTS 
${IMPORTCUESHEET:+--import-cuesheet-from="$ABCDETEMPDIR/$CUEFILE"} 
--import-tags-from=- "$ABCDETEMPDIR/track$1.$FLACOUTPUTCONTAINER"
                        ;;
#...
               esac
#...
       done


Simplifying the above, it looks like this

( some commands ) | run_command tagtrack-$OUTPUT-$1 .....

The run_command function sets the variable RETURN when something goes
wrong.  But this is not guaranteed to work in a POSIX shell, and in
fact in Bash it doesn't.  The problem is that when the shell executes
the pipeline "a|b" it's not guaranteed which part of the pipeline is
executed in the context of the current shell.  Here, it happens to be
the case that b is executed in a subshell, and so setting $RETURN in
that subshell has no effect on the abcde program once the subshell
exits.

There are several possible remedies for this problem.  The obvious one
is to create a temporary file to contain the tag data.  A second
option is to use a named pipe like this:

run_command $METAFLAC ... <(
 echo ARTIST="$TRACKARTIST"
 echo ALBUM="$DALBUM"
 echo TITLE="$TRACKNAME"
 if [ -n "$CDYEAR" ]; then
 #...
)

A number of shells do not support the <(...) construct, however.

A third option is to have run_command emit some data on stdout (or any
other file descriptor) to indicate the success/failure of the
function, but the problem with this of course is that it requires more
extensive code changes (to update the callers).




-- System Information:
Debian Release: 6.0.6
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_IE.utf8, LC_CTYPE=en_IE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages abcde depends on:
ii  cd-discid                1.1-1           CDDB DiscID utility
ii  cdparanoia               3.10.2+debian-9 audio extraction tool for sampling
ii  flac                     1.2.1-2+b1      Free Lossless Audio Codec - comman
ii  lame                     3.98.4-0.0      LAME Ain't an MP3 Encoder
ii  vorbis-tools             1.4.0-1         several Ogg Vorbis tools
ii  wget                     1.12-2.1        retrieves files from the web

Versions of packages abcde recommends:
ii  vorbis-tools                  1.4.0-1    several Ogg Vorbis tools

Versions of packages abcde suggests:
pn  distmp3       <none>                     (no description available)
ii  eject         2.1.5+deb1+cvs20081104-7.1 ejects CDs and operates CD-Changer
pn  eyed3         <none>                     (no description available)
pn  id3           <none>                     (no description available)
pn  id3v2         <none>                     (no description available)
pn  mkcue         <none>                     (no description available)
pn  mp3gain       <none>                     (no description available)
pn  normalize-aud <none>                     (no description available)
pn  python-musicb <none>                     (no description available)
pn  vorbisgain    <none>                     (no description available)

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to