Subject: Re: bug#19605: cp -v vs LC_ALL vs. quote marks

From: Pádraig Brady <[email-masked]>
Date: Thu, 15 Jan 2015 12:30:25 +0000

On 15/01/15 11:38, 積丹尼 Dan Jacobson wrote:
> I am glad that these days plain "'" is being used instead of goofy "`'"
> $ LC_ALL=C cp -v /dev/null /tmp/$RANDOM 2>&1
> '/dev/null' -> '/tmp/29920'
> 
> That way one can not worry about copy and pasting them with the mouse.
> 
> The problem is, if I don't use LC_ALL=C then I get the goofy ones, even
> high bit too. Please just use ASCII "'", thanks.
> 
> # find /mnt/usb/thumb/backups/ -mtime -2 -type f -exec cp -av {} /jidanni_backups/ \;
> ‘/mnt/usb/thumb/backups/root_bkp2015-01-14-10-11-29.bz2’ -> ‘/jidanni_backups/root_bkp2015-01-14-10-11-29.bz2’
> 
> cp (GNU coreutils) 8.23
> P.S., I bet other coreutils programs do this too.

What's the exact problem with copy/paste?
Are you suggesting that all quoted files
should use shell quoting so that they can be directly
copy/pasted back to a shell. There is some merit in that alright.

Note above you could pass LC_ALL=C with sh -c ...,
or with a separate xargs process, or just directly to find like:
  LC_ALL=C find ... -exec cp ...

Note also that LC_ALL=C isn't ideal for non English users
as you then lose the localized messages, and it isn't enough
to just set LC_CTYPE=C as that just represents the translated
quote in unibyte.

cheers,
Pádraig

p.s. the above command starts a cp process per file.
It would be much more efficient to do:

  find ... -exec cp -av --target=/jidanni_backups/ {} +