Bug 107 - Album art is not written when OUTPUTFORMAT contains special characters
Summary: Album art is not written when OUTPUTFORMAT contains special characters
Status: CONFIRMED
Alias: None
Product: abcde
Classification: Unclassified
Component: Album art (show other bugs)
Version: unspecified
Hardware: All Linux
: Normal normal
Assignee: Andrew Strong
URL:
Depends on:
Blocks:
 
Reported: 2020-02-25 05:15 GMT by spam
Modified: 2020-02-25 05:30 GMT (History)
1 user (show)

See Also:


Attachments
Patch file for ALBUMARTDIR (850 bytes, application/octet-stream)
2020-02-25 05:15 GMT, spam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description spam 2020-02-25 05:15:13 GMT
Created attachment 80 [details]
Patch file for ALBUMARTDIR

Album art is not written when `OUTPUTFORMAT` contains special characters.

Example:

```OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE} - ${ALBUMFILE} (${CDYEAR})/${TRACKNUM}.${TRACKFILE}'```

results in the following message:

```
/usr/bin/abcde: eval: line 3253: syntax error near unexpected token `('
/usr/bin/abcde: eval: line 3253: `echo ${OUTPUT}/${ARTISTFILE} - ${ALBUMFILE} (${CDYEAR})/${TRACKNUM}.${TRACKFILE}'
/usr/bin/abcde: eval: line 3253: syntax error near unexpected token `('
/usr/bin/abcde: eval: line 3253: `echo ${OUTPUT}/${ARTISTFILE} - ${ALBUMFILE} (${CDYEAR})/${TRACKNUM}.${TRACKFILE}'
```

Fix: change `/usr/bin/abcde`, line 3253, from

```
ALBUMARTDIR="$(eval echo "$VAOUTPUTFORMAT")"
```

should be

```
ALBUMARTDIR="$(eval echo \""$VAOUTPUTFORMAT"\")"
```


I attached a patch file for `ALBUMARTDIR`. There are probably more cases when escaping is not safe:

```
$ grep -nP 'eval\s+echo\s+[^\\]' /usr/bin/abcde
797:    COMMENTOUTPUT="$(eval echo ${COMMENT})"
917:                                    if [ "$(eval echo ${COMMENT})" != "" ]; then
963:                    if [ "$(eval echo ${COMMENT})" != "" ]; then
1137:           IN="$( eval echo "\$$TEMPARG" )"
1258:                           if [ "$(eval echo ${COMMENT})" != "" ]; then
1715:                   PLAYLISTFILE="$(eval echo "$VAPLAYLISTFORMAT")"
1717:                   PLAYLISTFILE="$(eval echo "$PLAYLISTFORMAT")"
1861:           eval echo -n "\" \$TRACK$j\""
3303:           FILEARG="$( eval echo "\$$TEMPARG" )"
4724:   decho "PIPERIPPERSVARCHECK: $( eval echo "\$$PIPERIPPERSVARCHECK" )"
4725:   if [ "$( eval echo "\$$PIPERIPPERSVARCHECK" )" = "$" ] || \
4726:      [ "$( eval echo "\$$PIPERIPPERSVARCHECK" )" = "" ] ; then
4731:   decho "PIPEENCODERSVARCHECK: $( eval echo "\$$PIPEENCODERSVARCHECK" )"
4732:   if [ "$( eval echo "\$$PIPEENCODERSVARCHECK" )" = "$" ] || \
4733:      [ "$( eval echo "\$$PIPEENCODERSVARCHECK" )" = "" ] ; then
```
Comment 1 spam 2020-02-25 05:30:07 GMT
Patch file is against 2.8.1, bug is still present on 2.9.3
Related:
- https://abcde.einval.com/bugzilla/show_bug.cgi?id=11
- https://abcde.einval.com/bugzilla/show_bug.cgi?id=12