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

To reply to this bug, email your comments to 19605 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#19605; Package coreutils. (Thu, 15 Jan 2015 11:51:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 15 Jan 2015 11:51:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-coreutils <at> gnu.org
Subject: cp -v vs LC_ALL vs. quote marks
Date: Thu, 15 Jan 2015 19:38:23 +0800
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.




Information forwarded to bug-coreutils <at> gnu.org:
bug#19605; Package coreutils. (Thu, 15 Jan 2015 12:31:01 GMT) Full text and rfc822 format available.

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/ {} +




Information forwarded to bug-coreutils <at> gnu.org:
bug#19605; Package coreutils. (Thu, 15 Jan 2015 16:02:01 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 19605 <at> debbugs.gnu.org
Subject: Re: bug#19605: cp -v vs LC_ALL vs. quote marks
Date: Fri, 16 Jan 2015 00:01:50 +0800
I'm saying please don't force me to need LC_ALL=C to make the quotes
U+0027 APOSTROPHE always.

Long ago there were no quotes.

Then somebody thought quotes looked pretty, so they added U+0027
APOSTROPHE always.

Then somebody else thought `....' looks cooler than '....' and made it
that way.

Then somebody thought that might make more work when copy and pasting
when sending that to the shell, and needing to fix it if three clicks
got the quotes too, so made it back to U+0027 APOSTROPHE. Good.

Except they forget to fix it back for other locales.




Information forwarded to bug-coreutils <at> gnu.org:
bug#19605; Package coreutils. (Thu, 15 Jan 2015 16:59:02 GMT) Full text and rfc822 format available.

Message #14 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>
Cc: 19605 <at> debbugs.gnu.org
Subject: Re: bug#19605: cp -v vs LC_ALL vs. quote marks
Date: Thu, 15 Jan 2015 16:58:32 +0000
On 15/01/15 16:01, 積丹尼 Dan Jacobson wrote:
> I'm saying please don't force me to need LC_ALL=C to make the quotes
> U+0027 APOSTROPHE always.
> 
> Long ago there were no quotes.
> 
> Then somebody thought quotes looked pretty, so they added U+0027
> APOSTROPHE always.
> 
> Then somebody else thought `....' looks cooler than '....' and made it
> that way.

That _looked_ better on some old fonts/systems.

> Then somebody thought that might make more work when copy and pasting
> when sending that to the shell, and needing to fix it if three clicks
> got the quotes too, so made it back to U+0027 APOSTROPHE. Good.

Ah you mean double clicking to select the word?
Single quotes are generally excluded from that auto selection,
while ‘locale specific’ quotes can be included which _is_ awkward.

Now that's terminal dependent. I notice xterm is more restrictive
in what it auto selects and will exclude the locale quotes (and . too),
while gnome terminal will include the locale quotes.
That's just a bug in gnome terminal though, as it should
add common quoting chars to its delimiter list.

> Except they forget to fix it back for other locales.

As mentioned before, to have it independent of locales we could
use the "shell-always" quoting style for files.  Note that would have
the small caveat that the quotes would not be included in a double click.

A larger caveat is that it 'shell-always' quoting provides
no protection for the terminal from control chars in a file name.
You can test that out by creating variously named files and using:

  ls -1 --quoting='shell-always' --show-control-chars

Hmm, I wonder could we augment the shell quoting to
add the $'\001' and $'\n' escape formats, which would
both provide the protection and be generally cut and pasteable.

Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#19605; Package coreutils. (Thu, 15 Jan 2015 17:29:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 19605 <at> debbugs.gnu.org
Subject: Re: bug#19605: cp -v vs LC_ALL vs. quote marks
Date: Fri, 16 Jan 2015 01:28:07 +0800
All I know is in xterm I click three times and all of '...' including
the quotes gets copied, which is fine with me. Just keep it all 0x27.




Information forwarded to bug-coreutils <at> gnu.org:
bug#19605; Package coreutils. (Thu, 15 Jan 2015 19:56:02 GMT) Full text and rfc822 format available.

Message #20 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>
Cc: 19605 <at> debbugs.gnu.org
Subject: Re: bug#19605: cp -v vs LC_ALL vs. quote marks
Date: Thu, 15 Jan 2015 19:55:01 +0000
On 15/01/15 17:28, 積丹尼 Dan Jacobson wrote:
> All I know is in xterm I click three times and all of '...' including
> the quotes gets copied, which is fine with me. Just keep it all 0x27.

Ah right that's an xterm specific feature. See XTerm*on3Clicks here:
http://lukas.zapletalovi.com/2013/07/hidden-gems-of-xterm.html




Information forwarded to bug-coreutils <at> gnu.org:
bug#19605; Package coreutils. (Fri, 16 Jan 2015 17:50:02 GMT) Full text and rfc822 format available.

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

From: Bob Proulx <bob <at> proulx.com>
To: 19605 <at> debbugs.gnu.org
Cc: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#19605: cp -v vs LC_ALL vs. quote marks
Date: Fri, 16 Jan 2015 10:49:51 -0700
Pádraig Brady wrote:
> Dan Jacobson wrote:
> > All I know is in xterm I click three times and all of '...' including
> > the quotes gets copied, which is fine with me. Just keep it all 0x27.
> 
> Ah right that's an xterm specific feature. See XTerm*on3Clicks here:
> http://lukas.zapletalovi.com/2013/07/hidden-gems-of-xterm.html

Actually no.  Triple click to select the full line is a standard
feature of X Windows since forever.  I use it all of the time in
Firefox and Chromium for instance.  Every X widget should support it
natively.

Since triple clicks copy the entire line then the `...' being part of
the entire line will get copied too.  But I don't think the ` is the
worst part of that.  The worst part is the -> part.  You wouldn't want
to be pasting that part into a shell.  Selecting the entire line would
be useful for pasting as plain text such as into an editor.  (I am not
suggesting changing the -> but just pointing it out.)

FWIW regardless of the historical font (that I have never seen in my
lifetime) of ` and ' being symmetrical I have never liked the use of
the `...' in quote context.  I would prefer to have the quoted strings
use '...' too.  I know several projects have gone that way.  It looks
better and is more useful both at the same time.

Bob




Information forwarded to bug-coreutils <at> gnu.org:
bug#19605; Package coreutils. (Mon, 19 Jan 2015 08:56:03 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Bob Proulx <bob <at> proulx.com>
Cc: 19605 <at> debbugs.gnu.org
Subject: Re: bug#19605: cp -v vs LC_ALL vs. quote marks
Date: Mon, 19 Jan 2015 16:54:52 +0800
About the -> stuff, maybe just output "sh -x" style output instead that
could be better digested if copy pasted back to the shell.

$ cp -v m n
‘m’ -> ‘n’
$ set -x
$ cp m p
+ cp m p

(Hmmm... better I suppose, but sort of looks like I have some tty echoing
enabled and am not so confident the command completed.)




Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 21 Oct 2018 22:10:02 GMT) Full text and rfc822 format available.

Changed bug title to 'quotes: cp: use ASCII single-quotes in "cp -v"' from 'cp -v vs LC_ALL vs. quote marks' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 21 Oct 2018 22:10:02 GMT) Full text and rfc822 format available.

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.