GNU bug report logs - #47642
28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

Previous Next

Package: emacs;

Reported by: Jean Louis <bugs <at> gnu.support>

Date: Wed, 7 Apr 2021 17:57:01 UTC

Severity: minor

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

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 47642 in the body.
You can then email your comments to 47642 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#47642; Package emacs. (Wed, 07 Apr 2021 17:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean Louis <bugs <at> gnu.support>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 07 Apr 2021 17:57:02 GMT) Full text and rfc822 format available.

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

From: Jean Louis <bugs <at> gnu.support>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)
Date: Wed, 07 Apr 2021 20:51:05 +0300
I never had this error. It now happens in the longer running instance,
it started suddenly. I don;t remember using any chars outside of
ASCII. It is invoked when I pres C-k or C-y -- it started mysteriously
and then after a while it stopped.

I cannot replicate it in 'emacs -Q'.

Debugger entered--Lisp error: (error "Selection owner couldn't convert" UTF8_STRING)
  x-get-selection-internal(CLIPBOARD UTF8_STRING nil nil)
  #f(compiled-function (selection-symbol target-type &optional time-stamp terminal) #<bytecode -0x8b1a39ee5967b2d>)(CLIPBOARD UTF8_STRING)
  apply(#f(compiled-function (selection-symbol target-type &optional time-stamp terminal) #<bytecode -0x8b1a39ee5967b2d>) (CLIPBOARD UTF8_STRING))
  gui-backend-get-selection(CLIPBOARD UTF8_STRING)
  gui-get-selection(CLIPBOARD UTF8_STRING)
  gui--selection-value-internal(CLIPBOARD)
  gui-selection-value()
  kill-new("0786111111 contact-JIJI ")
  kill-region(12 36)
  kill-line(nil)
  funcall-interactively(kill-line nil)
  call-interactively(kill-line nil nil)
  command-execute(kill-line)
  read-string("Last name: " "0786111111 contact-JIJI " nil nil)
  (if area (read-from-buffer value (format "%s ID %s" column id) mode) (read-string comment value nil nil))
  (cond ((member column columns-to-choose-contact) (let* ((query (read-from-minibuffer "Find person: ")) (id (string-to-number (cf-search-id query)))) id)) ((and foreign-key (string= type "integer")) (if (member foreign-table foreign-tables-to-ignore) (read-number comment value) (rcd-db-combo-selection foreign-table))) ((string= type "integer") (read-number comment value)) ((string-match "numeric" type) (read-number comment value)) ((string= type "text") (if area (read-from-buffer value (format "%s ID %s" column id) mode) (read-string comment value nil nil))) ((string= type "date") (read-string comment value nil value)) ((string-match "varying" type) (read-string comment value nil value)) ((string-match "array" type) (read-string comment (if value value "{}") nil value)) ((string= type "timestamp without time zone") (read-string comment value nil value)) ((string= type "timestamp with time zone") (read-string comment value nil value)) ((string= type "boolean") (read-boolean comment value)))
  (let ((new-value (cond ((member column columns-to-choose-contact) (let* ((query ...) (id ...)) id)) ((and foreign-key (string= type "integer")) (if (member foreign-table foreign-tables-to-ignore) (read-number comment value) (rcd-db-combo-selection foreign-table))) ((string= type "integer") (read-number comment value)) ((string-match "numeric" type) (read-number comment value)) ((string= type "text") (if area (read-from-buffer value (format "%s ID %s" column id) mode) (read-string comment value nil nil))) ((string= type "date") (read-string comment value nil value)) ((string-match "varying" type) (read-string comment value nil value)) ((string-match "array" type) (read-string comment (if value value "{}") nil value)) ((string= type "timestamp without time zone") (read-string comment value nil value)) ((string= type "timestamp with time zone") (read-string comment value nil value)) ((string= type "boolean") (read-boolean comment value))))) (rcd-db-update-entry table column id new-value *cf*))
  (let* ((type (rcd-db-column-type table column *cf*)) (comment (rcd-db-column-comment table column *cf*)) (foreign (rcd-db-foreign-table-column table column *cf*)) (value (rcd-db-get-entry table column id *cf*)) (size (if (eq (type-of value) 'string) (length value) nil)) (foreign-key (if foreign t nil)) (foreign-table (or (car foreign) nil)) (area (or (rcd/column-area-p table column *cf*) (and size (> size 80)))) (comment (append-colon-space comment))) (let ((new-value (cond ((member column columns-to-choose-contact) (let* (... ...) id)) ((and foreign-key (string= type "integer")) (if (member foreign-table foreign-tables-to-ignore) (read-number comment value) (rcd-db-combo-selection foreign-table))) ((string= type "integer") (read-number comment value)) ((string-match "numeric" type) (read-number comment value)) ((string= type "text") (if area (read-from-buffer value ... mode) (read-string comment value nil nil))) ((string= type "date") (read-string comment value nil value)) ((string-match "varying" type) (read-string comment value nil value)) ((string-match "array" type) (read-string comment (if value value "{}") nil value)) ((string= type "timestamp without time zone") (read-string comment value nil value)) ((string= type "timestamp with time zone") (read-string comment value nil value)) ((string= type "boolean") (read-boolean comment value))))) (rcd-db-update-entry table column id new-value *cf*)))
  rcd/edit-entry("people" "people_lastname" 359712)
  (let* ((id (tabulated-list-get-id)) (id (split-string id ":")) (table (car id)) (column (car (cdr id))) (id (car (cdr (cdr id)))) (id (string-to-number id)) (point (point))) (rcd/edit-entry table column id) (kill-this-buffer) (rcd-db-tabulated-table-edit table id) (goto-char point))
  rcd-db-tabulated-edit-value()
  funcall-interactively(rcd-db-tabulated-edit-value)
  call-interactively(rcd-db-tabulated-edit-value nil nil)
  command-execute(rcd-db-tabulated-edit-value)



In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars)
 of 2021-04-05 built on protected.rcdrun.com
Repository revision: a44d423a5aaf97790ce95350a38590fbb17b3220
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
Configured using:
 'configure --prefix=/package/text/emacs --with-x-toolkit=lucid'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY
PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XAW3D XDBE
XIM XPM LUCID ZLIB

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: @im=exwm-xim
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 53549 8043)
 (symbols 48 7031 1)
 (strings 32 19837 1894)
 (string-bytes 1 640374)
 (vectors 16 13037)
 (vector-slots 8 174775 11503)
 (floats 8 23 51)
 (intervals 56 406 44)
 (buffers 992 11))

-- 
Thanks,
Jean Louis

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47642; Package emacs. (Wed, 07 Apr 2021 19:59:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jean Louis <bugs <at> gnu.support>
Cc: 47642 <at> debbugs.gnu.org
Subject: Re: bug#47642: 28.0.50;
 (error "Selection owner couldn't convert" UTF8_STRING)
Date: Wed, 07 Apr 2021 22:37:32 +0300
> From: Jean Louis <bugs <at> gnu.support>
> Date: Wed, 07 Apr 2021 20:51:05 +0300
> 
> 
> I never had this error. It now happens in the longer running instance,
> it started suddenly. I don;t remember using any chars outside of
> ASCII. It is invoked when I pres C-k or C-y -- it started mysteriously
> and then after a while it stopped.
> 
> I cannot replicate it in 'emacs -Q'.
> 
> Debugger entered--Lisp error: (error "Selection owner couldn't convert" UTF8_STRING)

Why do you think it's an Emacs problem?  The error message points to
an external program, which owns the selection.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47642; Package emacs. (Wed, 07 Apr 2021 20:17:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Jean Louis <bugs <at> gnu.support>
Cc: 47642 <at> debbugs.gnu.org
Subject: Re: bug#47642: 28.0.50; (error "Selection owner couldn't convert"
 UTF8_STRING)
Date: Wed, 07 Apr 2021 22:58:34 +0300
> I cannot replicate it in 'emacs -Q'.
>
> Debugger entered--Lisp error: (error "Selection owner couldn't convert" UTF8_STRING)
>   x-get-selection-internal(CLIPBOARD UTF8_STRING nil nil)

I can replicate exactly the same error:

Debugger entered--Lisp error: (error "Selection owner couldn't convert" UTF8_STRING)
  x-get-selection-internal(CLIPBOARD UTF8_STRING nil nil)
  #f(compiled-function (selection-symbol target-type &optional time-stamp terminal) ...)
  apply(#f(compiled-function (selection-symbol target-type &optional time-stamp terminal) ...)
  gui-backend-get-selection(CLIPBOARD UTF8_STRING)
  gui-get-selection(CLIPBOARD UTF8_STRING)
  gui--selection-value-internal(CLIPBOARD)

after copying an image in Gimp, then exiting Gimp, and trying to paste in Emacs.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47642; Package emacs. (Mon, 12 Apr 2021 10:12:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 47642 <at> debbugs.gnu.org, Jean Louis <bugs <at> gnu.support>
Subject: Re: bug#47642: 28.0.50; (error "Selection owner couldn't convert"
 UTF8_STRING)
Date: Mon, 12 Apr 2021 12:11:28 +0200
Juri Linkov <juri <at> linkov.net> writes:

> after copying an image in Gimp, then exiting Gimp, and trying to paste
> in Emacs.

I was unable to reproduce that (on Debian/bullseye) -- I just get nil
back from

(x-get-selection-internal 'CLIPBOARD 'UTF8_STRING nil nil)

no matter whether Gimp is running or not (after choosing Edit -> Copy).

In any case -- I'm not sure there's anything we can do on the Emacs
side...  except perhaps change the error message?  "Couldn't convert"
isn't really informative.  "Couldn't get selection from selection
owner", perhaps?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47642; Package emacs. (Mon, 12 Apr 2021 16:15:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 47642 <at> debbugs.gnu.org, Jean Louis <bugs <at> gnu.support>
Subject: Re: bug#47642: 28.0.50; (error "Selection owner couldn't convert"
 UTF8_STRING)
Date: Mon, 12 Apr 2021 19:03:48 +0300
>> after copying an image in Gimp, then exiting Gimp, and trying to paste
>> in Emacs.
>
> I was unable to reproduce that (on Debian/bullseye) -- I just get nil
> back from
>
> (x-get-selection-internal 'CLIPBOARD 'UTF8_STRING nil nil)
>
> no matter whether Gimp is running or not (after choosing Edit -> Copy).

Here is a complete test case with 100% reproducibility:

1. In GIMP 2.10.18 on Ubuntu create a new image
2. Select a rectangle
3. Copy with Ctrl+C or Edit -> Copy

4. in 'emacs -Q' version 28, GTK+ version 3.24.20
5. evaluating (x-get-selection-internal 'CLIPBOARD 'UTF8_STRING nil nil)
   returns nil

6. quit Gimp
7. evaluate the same (x-get-selection-internal 'CLIPBOARD 'UTF8_STRING nil nil)
8. it fails with

Debugger entered--Lisp error: (error "Selection owner couldn't convert" UTF8_STRING)
  x-get-selection-internal(CLIPBOARD UTF8_STRING nil nil)
  (progn (x-get-selection-internal 'CLIPBOARD 'UTF8_STRING nil nil))
  eval((progn (x-get-selection-internal 'CLIPBOARD 'UTF8_STRING nil nil)) t)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

This is strange since there is no owner anymore, the selection owner was closed.

It's a big problem for me because I customized
save-interprogram-paste-before-kill to t, and I can't
use copy/paste in Emacs anymore after this error,
because I raises the same error on trying to copy a new text,
so even can't overwrite the old unavailable selection
with a new one in Emacs.  Then I need to switch to
some other app, copy some text from it to the clipboard,
that fixes the broken state of copy/paste in Emacs.

> In any case -- I'm not sure there's anything we can do on the Emacs
> side...  except perhaps change the error message?  "Couldn't convert"
> isn't really informative.  "Couldn't get selection from selection
> owner", perhaps?

I wonder why this error should be raised at all
instead of just returning nil?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47642; Package emacs. (Tue, 13 Apr 2021 05:39:02 GMT) Full text and rfc822 format available.

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

From: Jean Louis <bugs <at> gnu.support>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 47642 <at> debbugs.gnu.org
Subject: Re: bug#47642: 28.0.50; (error "Selection owner couldn't convert"
 UTF8_STRING)
Date: Tue, 13 Apr 2021 08:37:22 +0300
* Eli Zaretskii <eliz <at> gnu.org> [2021-04-07 23:03]:
> > From: Jean Louis <bugs <at> gnu.support>
> > Date: Wed, 07 Apr 2021 20:51:05 +0300
> > 
> > 
> > I never had this error. It now happens in the longer running instance,
> > it started suddenly. I don;t remember using any chars outside of
> > ASCII. It is invoked when I pres C-k or C-y -- it started mysteriously
> > and then after a while it stopped.
> > 
> > I cannot replicate it in 'emacs -Q'.
> > 
> > Debugger entered--Lisp error: (error "Selection owner couldn't convert" UTF8_STRING)
> 
> Why do you think it's an Emacs problem?  The error message points to
> an external program, which owns the selection.

I get it, this is clear and may be closed.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47642; Package emacs. (Tue, 13 Apr 2021 07:32:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 47642 <at> debbugs.gnu.org, Jean Louis <bugs <at> gnu.support>
Subject: Re: bug#47642: 28.0.50; (error "Selection owner couldn't convert"
 UTF8_STRING)
Date: Tue, 13 Apr 2021 09:31:32 +0200
Juri Linkov <juri <at> linkov.net> writes:

> Here is a complete test case with 100% reproducibility:

I tried the recipe with Gimp 2.10.22 on Debian/bullseye, but I just get
nil, so I guess there's some difference in how this is handled...

> I wonder why this error should be raised at all
> instead of just returning nil?

That's a really good point -- this low-level error surely can't be of
interest to the Emacs user.  So you're right -- it should just return
nil here.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47642; Package emacs. (Tue, 13 Apr 2021 16:22:03 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 47642 <at> debbugs.gnu.org, Jean Louis <bugs <at> gnu.support>
Subject: Re: bug#47642: 28.0.50; (error "Selection owner couldn't convert"
 UTF8_STRING)
Date: Tue, 13 Apr 2021 19:20:47 +0300
[Message part 1 (text/plain, inline)]
>> I wonder why this error should be raised at all
>> instead of just returning nil?
>
> That's a really good point -- this low-level error surely can't be of
> interest to the Emacs user.  So you're right -- it should just return
> nil here.

Here's the patch that does this:

[selection_owner.patch (text/x-diff, inline)]
diff --git a/src/xselect.c b/src/xselect.c
index 030f624071..cd6d86bdf4 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1482,14 +1482,21 @@ x_get_window_property_as_lisp_data (struct x_display_info *dpyinfo,
 	= XGetSelectionOwner (display, selection_atom) != 0;
       unblock_input ();
       if (there_is_a_selection_owner)
-	signal_error ("Selection owner couldn't convert",
-		      actual_type
-		      ? list2 (target_type,
-			       x_atom_to_symbol (dpyinfo, actual_type))
-		      : target_type);
+	{
+	  AUTO_STRING (format, "Selection owner couldn't convert: %s");
+	  CALLN (Fmessage, format,
+		 actual_type
+		 ? list2 (target_type,
+			  x_atom_to_symbol (dpyinfo, actual_type))
+		 : target_type);
+	  return Qnil;
+	}
       else
-	signal_error ("No selection",
-		      x_atom_to_symbol (dpyinfo, selection_atom));
+	{
+	  AUTO_STRING (format, "No selection: %s");
+	  CALLN (Fmessage, format, x_atom_to_symbol (dpyinfo, selection_atom));
+	  return Qnil;
+	}
     }
 
   if (actual_type == dpyinfo->Xatom_INCR)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47642; Package emacs. (Wed, 14 Apr 2021 18:24:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 47642 <at> debbugs.gnu.org, Jean Louis <bugs <at> gnu.support>
Subject: Re: bug#47642: 28.0.50; (error "Selection owner couldn't convert"
 UTF8_STRING)
Date: Wed, 14 Apr 2021 21:23:23 +0300
tags 47642 fixed
close 47642 28.0.50
quit

>>> I wonder why this error should be raised at all
>>> instead of just returning nil?
>>
>> That's a really good point -- this low-level error surely can't be of
>> interest to the Emacs user.  So you're right -- it should just return
>> nil here.
>
> Here's the patch that does this:

Pushed now.




Added tag(s) fixed. Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Wed, 14 Apr 2021 18:24:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.0.50, send any further explanations to 47642 <at> debbugs.gnu.org and Jean Louis <bugs <at> gnu.support> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Wed, 14 Apr 2021 18:24:02 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. (Thu, 13 May 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 342 days ago.

Previous Next


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