GNU bug report logs - #9563
dired-copy-filename-as-kill doesn't copy file names to PRIMARY selection

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Tue, 20 Sep 2011 16:46:01 UTC

Severity: normal

Tags: wontfix

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9563 in the body.
You can then email your comments to 9563 AT debbugs.gnu.org in the normal way.

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-gnu-emacs <at> gnu.org:
bug#9563; Package emacs. (Tue, 20 Sep 2011 16:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 20 Sep 2011 16:46:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: bug-gnu-emacs <at> gnu.org
Subject: dired-copy-filename-as-kill doesn't copy file names to PRIMARY
	selection
Date: Tue, 20 Sep 2011 19:20:30 +0300
The default behavior is dangerous now on GNU/Linux,
it may delete random files.

Steps to reproduce the problem:

1. emacs -Q
2. Open a shell script, mark a multi-line region with a few commands
   and copy it with `M-w'.
3. Forget it.
4. Open a Dired buffer.
5. Copy a file name with `M-0 w'.
6. Open xterm.
7. Paste the copied file name with `S-Insert'.

Instead of pasting the copied file name
it starts executing random commands,
i.e. if text copied at step 2 contains newlines,
it's submitted for execution to the shell.

The problem is that `M-w' puts copied text to the primary selection
while `M-0 w' in Dired does not.

I think `dired-copy-filename-as-kill' should do the same
as `deactivate-mark' does with (x-set-selection 'PRIMARY ...)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9563; Package emacs. (Sat, 14 Jul 2012 01:56:01 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 9563 <at> debbugs.gnu.org
Subject: Re: bug#9563: dired-copy-filename-as-kill doesn't copy file names to
	PRIMARY selection
Date: Sat, 14 Jul 2012 09:50:02 +0800
Juri Linkov <juri <at> jurta.org> writes:

> 1. emacs -Q
> 2. Open a shell script, mark a multi-line region with a few commands
>    and copy it with `M-w'.
> 3. Forget it.
> 4. Open a Dired buffer.
> 5. Copy a file name with `M-0 w'.
> 6. Open xterm.
> 7. Paste the copied file name with `S-Insert'.
>
> Instead of pasting the copied file name it starts executing random
> commands, i.e. if text copied at step 2 contains newlines, it's
> submitted for execution to the shell.
>
> I think `dired-copy-filename-as-kill' should do the same as
> `deactivate-mark' does with (x-set-selection 'PRIMARY ...)

Hmm, I don't think this is a real issue.  You can come up with similar
scenarios in other applications.

- Select some text in one Firefox window
- In another Firefox window, click and drag some text with the mouse (so
  it's now on the primary selection)
- Re-select the first window and type Control-c
- Click mouse-2 to in an xterm
    => the text from the second window (which still holds the primary
       selection) gets pasted

Granted, Emacs has more ways to "silently" put things on the clipboard
or primary selection, i.e. without having to drag the mouse first.  But
I think it is overstepping the bounds of expectation for us to clobber
the primary selection while putting text in the clipboard, just to
prevent the user from doing something that might or might not be an
error (e.g. the user may really want to paste the primary selection).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9563; Package emacs. (Sat, 14 Jul 2012 09:52:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: Chong Yidong <cyd <at> gnu.org>
Cc: 9563 <at> debbugs.gnu.org
Subject: Re: bug#9563: dired-copy-filename-as-kill doesn't copy file names to
	PRIMARY selection
Date: Sat, 14 Jul 2012 12:37:10 +0300
> Granted, Emacs has more ways to "silently" put things on the clipboard
> or primary selection, i.e. without having to drag the mouse first.  But
> I think it is overstepping the bounds of expectation for us to clobber
> the primary selection while putting text in the clipboard, just to
> prevent the user from doing something that might or might not be an
> error (e.g. the user may really want to paste the primary selection).

Yes, there are more ways to screw up things.  For instance, C-k
puts text only on the clipboard that can't be pasted to xterm, etc.
So e.g. typing C-k in Emacs on X can't yank that text with C-y
in another Emacs instance in xterm.  Too bad.

Perhaps changing the default value of `x-select-enable-primary' to t
(and keeping `x-select-enable-clipboard' t by default)
will help to avoid these problems.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9563; Package emacs. (Sun, 15 Jul 2012 08:47:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: Chong Yidong <cyd <at> gnu.org>
Cc: 9563 <at> debbugs.gnu.org
Subject: Re: bug#9563: dired-copy-filename-as-kill doesn't copy file names to
	PRIMARY selection
Date: Sun, 15 Jul 2012 11:37:06 +0300
> Perhaps changing the default value of `x-select-enable-primary' to t
> (and keeping `x-select-enable-clipboard' t by default)
> will help to avoid these problems.

Oh no, I tried to enable both `x-select-enable-primary'
and `x-select-enable-clipboard', and this breaks copy operations
that become unusable.  For instance, I select a region
and type C-y to replace it with the text from the clipboard,
but it inserts the same region back, instead of inserting
text from the clipboard.  Maybe this is a bug?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9563; Package emacs. (Sun, 28 Jan 2018 21:30:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: 9563 <at> debbugs.gnu.org
Subject: Re: bug#9563: dired-copy-filename-as-kill doesn't copy file names to
 PRIMARY selection
Date: Sun, 28 Jan 2018 23:14:36 +0200
tags 9563 wontfix
close 9563
quit

Sorry for leaving this report open for so long.
I see nothing that could be done here.  Whoever wants
to sync clipboard with primary selection can customize
‘select-active-regions’ and ‘select-enable-primary’.
Also it's possible in xterm to use ‘S-C-v’ instead of ‘S-Insert’.




Added tag(s) wontfix. Request was from Juri Linkov <juri <at> jurta.org> to control <at> debbugs.gnu.org. (Sun, 28 Jan 2018 21:30:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 9563 <at> debbugs.gnu.org and Juri Linkov <juri <at> jurta.org> Request was from Juri Linkov <juri <at> jurta.org> to control <at> debbugs.gnu.org. (Sun, 28 Jan 2018 21:30:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 26 Feb 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 174 days ago.

Previous Next


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