mmstick/parallel

--dry-run isn't what gets executed

mqudsi opened this issue · 4 comments

~>> echo ./zoomed\ in.png
./zoomed in.png
~> echo ./zoomed\ in.png | parallel 'file -ib "{}"'
parallel: reading inputs from standard input
cannot open `"./zoomed in.png"' (No such file or directory)
~> echo ./zoomed\ in.png | parallel --dry-run 'file -ib "{}"'
parallel: reading inputs from standard input
file -ib "./zoomed in.png"
~> file -ib "./zoomed in.png"
image/png; charset=binary

Any idea why parallel isn't working here? The output of --dry-run is correct.

@mqudsi have you tried running this without double quotes around {}? I assume they are shell escaping, that doesn't work in parallel.

mqudsi@ZBook /m/c/U/M/Downloads> echo ./zoomed\ in.png | parallel --dry-run 'file -ib {}'
parallel: reading inputs from standard input
file -ib ./zoomed in.png
mqudsi@ZBook /m/c/U/M/Downloads> echo ./zoomed\ in.png | parallel 'file -ib {}'
parallel: reading inputs from standard input
cannot open `./zoomed' (No such file or directory)
cannot open `in.png' (No such file or directory)
ghuls commented

@mqudsi Your issue is not directly related to --dry-run, but to the fact that this implementation of parallel splits lines from stdin and from files on whitespace instead of on newline characters as described in issue #61.

@ghuls
That is definitely not the issue here, the file command accepts multiple files as arguments. That means:

$ file badfile1 badfile2
badfile1: cannot open `badfile1' (No such file or directory)
badfile2: cannot open `badfile2' (No such file or directory)

I can't test this now, but it might be related to the current working directory being changed by parallel.

The input is definitely not parsed as file -ib '"./zoomed' 'in.png"', as file would output cannot open `"./zoomed` (no such file or directory)