Nemo Actions simply unable to handle spaces in filenames
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linux Mint |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
On Mint 17 (Cinnamon, 32 bit, i386) Nemo Actions %F field simply is incapable of handling filenames\ with\ spaces!
I am trying to use with pdftk to merge two pdfs via single mouse click w Nemo Actions. A common enough use case.
My Exec field calls a local wrapper bash script to convert the %F filename array (which Nemo presents with plain spaces in filenames and not escaped (ie w backslash "\") in manner in which pdftk (or any linux command) would like it).
eg actions file
Exec=./wrapper.sh %F
selection=m
extensions=pdf;
eg. wrapper.sh:
#!/bin/bash
IFS=$(echo -e "\t") # to delineate variables by unique "tab" char rather #than mere spaces which confuses shell
echo "$@" #for debug purposes
FILES=$(echo "$@" | sed -e 's:[^ ]*:&\\:g' -e 's:.pdf\\:.pdf:g' -e 's: /: /:g') #clean up %F variable passed to shell script with "\
# and tabs between filename arguments to ease separation
echo $FILES #debug purposes
pdftk $FILES cat output combinedfiles.pdf
The above converts the filename array passed by %F to a properly backslashed filename separated by tabs between filenames, and tells shell to expect tabs as a argument separator (via IFS).
But pdftk still is unable to process the argument passed in.
Apparently the problem is MUCH deeper.
For eg, Running wrapper.sh with trial arguments from command line:
./wrapper.sh ~/.local/
(note, this is the exact SAME variable string which is generated by "%F" by actions)
the aboveproduces the following output and ensuing errors on terminal:
/home/kiers/
/home/kiers/
Error: Unable to find file.
Error: Failed to open PDF file:
/home/
Error: Unable to find file.
Error: Failed to open PDF file:
/home/
Errors encountered. No output created.
Done. Input errors, so no output created.
However, please note the above paths to "Nigeria Article.pdf" and "Putin Article.pdf" are indeed valid and the files are there but pdftk is simply unable to handle the passed in arguments as the errors show.
It appears the passing of variables between nemo and the command line has some type of bug in it
It is TOO LATE in the evolution in Linux to still expect people NOT HAVING SPACES IN THEIR FILENAMES and integrated functionality in Mint 17 (LTS), such as NEMO ACTIONS, being simply UNABLE TO PROCESS TYPICAL FILENAMES.
No need to be dramatic about it, thanks for the report.