sharkdp / fd

A simple, fast and user-friendly alternative to 'find'
Apache License 2.0
33.61k stars 803 forks source link

[BUG] Single quotes inside double quotes with exec on MSYS2 #1585

Open EJammy opened 3 months ago

EJammy commented 3 months ago

Checks

Describe the bug you encountered:

When running exec, single quote inside double quote doesn't seem to work:

$ fd -x echo "hello'world'"
helloworld ./b
helloworld ./b/file2.txt
helloworld ./file.txt

However, it is fine when there's a space in between:

$ fd -x echo "hello 'world'"
hello 'world' ./b/file2.txt
hello 'world' ./b
hello 'world' ./file.txt

Trying to escape with backslash yields weird results:

fd -x echo "hello\'world\'"
hello\world' ./file.txt
hello\world' ./b
hello\world' ./b/file2.txt

I also can not reproduce this bug on Linux.

Describe what you expected to happen:

Using find:

$ find . -exec echo "hello'world'" {} \;
hello'world' .
hello'world' ./b
hello'world' ./b/file2.txt
hello'world' ./file.txt

Using gnu parallel:

$ fd | parallel echo "hello\'world\'"
hello'world' b/
hello'world' b/file2.txt
hello'world' file.txt

What version of fd are you using?

fd 10.1.0

Which operating system / distribution are you on?

$ uname -srm
MINGW64_NT-10.0-22631 3.5.3.x86_64 x86_64