GNU bug report logs - #19605
quotes: cp: use ASCII single-quotes in "cp -v"

Previous Next

Package: coreutils;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Thu, 15 Jan 2015 11:51:01 UTC

Severity: wishlist

Full log


Message #8 received at 19605 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>, 
 19605 <at> debbugs.gnu.org
Subject: Re: bug#19605: cp -v vs LC_ALL vs. quote marks
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/ {} +




This bug report was last modified 6 years and 242 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.