`tmsu tag -` scripting doesn't completely handle escaped spaces
Steps to reproduce:
-
cd /tmp; tmsu init . -
touch "foo bar" -
tmsu tags "foo bar" - (Result should be nothing)
- Create the file
tscript - Add this line exactly as shown:
foo\ bar atag btag some\ other\ tag -
tmsu tag - < tscript -
tmsu tags "foo bar" - (Result should be
atag btag some\ other\ tag, but is nothing)
Here is another interesting case, B, that can be checked after the first one:
-
touch foo - Change tscript to read
foo bar atag btag some\ other\ tag(this is intentionally ambiguous about filename) -
tmsu tag - < tscript -
tmsu tags foo - (Result is nothing! As is the result for
tmsu tags "foo bar", just to be complete.)
Just to verify that scripting works at all, I did echo "foo bar" | tmsu tag - -- this tagged foo with the tag bar, as expected.
I'm not 100% sure exactly what is happening here, particularly since the following case, C, demonstrates that some escape handling is being done.
-
tmsu untag --all foo - Change tscript to have two lines, the first reading
foo bad\ lineand the second readingfoo goodline. Ensure the final line has a newline too (otherwise it won't be processed) -
tmsu tag - < tscript -
tmsu tags foo-->bad\ line goodline.. which is correct! (compare this with the failed case B.. line structure and contents only differ in that there are more tags AFAICS)
I have no more time to test right now, so I'll just note that using --verbose shows exactly what you would expect -- in the case where tags are applied, it's noted, and in the cases where they should but aren't, no attempt to apply them is made at all...
and summarize:
- It is possible to apply tags containing spaces, but not always (?)
- It doesn't seem possible to apply tags to files whose names contain spaces, regardless of whether those spaces are escaped
- When tags are successfully applied, escapes in tag names are correctly interpreted.
- My best guess at cause is naive escape-unaware splitting of the line (this does not fully explain case B, though)
Thanks for reporting. I'll try to get this fixed soon.