Bug 12 - Inconsistent handling of backslashes in OUTPUTFORMAT
Summary: Inconsistent handling of backslashes in OUTPUTFORMAT
Alias: None
Product: abcde
Classification: Unclassified
Component: Ripping (show other bugs)
Version: unspecified
Hardware: All Linux
: Normal minor
Assignee: Steve McIntyre
Depends on:
Reported: 2015-10-10 04:49 BST by campbell
Modified: 2016-12-17 18:00 GMT (History)
3 users (show)

See Also:

Patch to fix eval echo calls (5.42 KB, patch)
2016-12-17 18:00 GMT, John A.

Note You need to log in before you can comment on or make changes to this bug.
Description campbell 2015-10-10 04:49:07 BST
In 2.7.1 (have not tested older versions), if I have parens in my OUTPUTFORMAT path, when abcde tries to get album art, I get the error: 

/usr/local/bin/abcde: eval: line 3186: syntax error near unexpected token `('
/usr/local/bin/abcde: eval: line 3186: `echo ${OUTPUT}/${ARTISTFILE} - ${YEAR} - ${ALBUMFILE} (P)/${TRACKNUM} - ${TRACKFILE}'

If I try and escape those parens with backslashes, the error goes away and the album art shows up in the correct folder, but the songs show up in a different folder that has the backslashes themselves in the title. This is because do_getalbumart is parsing OUTPUTFORMAT differently than other places in the script. 

In do_getalbumart, line 3186 looks like:


while a similar line in do_move (line 1565) looks like:


I'm not sure which of those styles is supposed to be correct, but it seems like a bug that they're different.
Comment 1 John A. 2016-12-17 17:58:24 GMT
I was just bitten by this issue as well, using 2.7.2. In my case, I use semicolons in the *OUTPUTFORMATs between the artist and album names. I escaped the semicolons but the inconsistent calls to eval echo caused issues where sometimes the semicolon was properly escaped and others where it was treated literally as \; in the dir name.

Hoping to help, I've created a patch that may address this. In it, I've created a new function __format_to_path() that can be used in most if not all places that explicitly called eval echo. I've also made a quick sweep through the code and converted most of the eval echo calls to use __format_to_path() instead.

I've only tested it with my limited setup (works with albumart and move at least) so some additional testing may be required to make sure it doesn't break other things.

Hope this helps!
Comment 2 John A. 2016-12-17 18:00:57 GMT
Created attachment 39 [details]
Patch to fix eval echo calls