bug#47642: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#47642: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

Jean Louis

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




Reply | Threaded
Open this post in threaded view
|

bug#47642: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

Eli Zaretskii
> From: Jean Louis <[hidden email]>
> 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.



Reply | Threaded
Open this post in threaded view
|

bug#47642: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

Juri Linkov-2
In reply to this post by Jean Louis
> 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.



Reply | Threaded
Open this post in threaded view
|

bug#47642: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

Lars Ingebrigtsen
Juri Linkov <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

bug#47642: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

Juri Linkov-2
>> 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?



Reply | Threaded
Open this post in threaded view
|

bug#47642: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

Jean Louis
In reply to this post by Eli Zaretskii
* Eli Zaretskii <[hidden email]> [2021-04-07 23:03]:

> > From: Jean Louis <[hidden email]>
> > 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.




Reply | Threaded
Open this post in threaded view
|

bug#47642: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

Lars Ingebrigtsen
In reply to this post by Juri Linkov-2
Juri Linkov <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

bug#47642: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

Juri Linkov-2
>> 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:


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)
Reply | Threaded
Open this post in threaded view
|

bug#47642: 28.0.50; (error "Selection owner couldn't convert" UTF8_STRING)

Juri Linkov-2
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.