GNU bug report logs - #9498
"Not an in-range integer,..." when using Synergy

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Wed, 14 Sep 2011 04:38:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

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 9498 in the body.
You can then email your comments to 9498 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 04:38:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Eggert <eggert <at> cs.ucla.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 14 Sep 2011 04:38:01 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: "Not an in-range integer,..." when using Synergy
Date: Tue, 13 Sep 2011 21:32:45 -0700
[This bug report is copied here from
<http://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00337.html>.]

Date: Wed, 14 Sep 2011 11:36:19 +0900 (JST)
From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>

Hello,

With recent Emacs trunk, sometimes I see the following message in the
minibuffer:

Not an in-range integer, float, or cons of integers

I'm using Synergy (http://synergy-foss.org/) to share my keyboard and
mouse connected to FreeBSD 8.2 (amd64) with Windows 7 PC.  The error
occurs when the mouse pointer leaves FreeBSD desktop and enters to
Windows desktop.  Emacs is running on FreeBSD side.

debug-on-error is not helpful:

Debugger entered--Lisp error: (error "Not an in-range integer, float, or cons of integers")

It seems that it is clipboard related.  When I highlight some text on
Emacs, the error occurs.  But after I copy text on Windows, it doesn't
happen (until I select some text on Emacs again).  Clipboard is shared
by Synergy.

Any ideas?
-- Yoshiaki Kasahara Research Institute for Information Technology, Kyushu University kasahara <at> nc.kyushu-u.ac.jp 




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 04:57:01 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
Cc: 9498 <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: "Not an in-range integer,..." when using Synergy
Date: Tue, 13 Sep 2011 21:52:20 -0700
I created a bug report for this at
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9498>
and will follow up there.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 05:00:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
Cc: 9498 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Wed, 14 Sep 2011 00:54:53 -0400
> Date: Tue, 13 Sep 2011 21:32:45 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> 
> Debugger entered--Lisp error: (error "Not an in-range integer, float, or cons of integers")
> 
> It seems that it is clipboard related.  When I highlight some text on
> Emacs, the error occurs.  But after I copy text on Windows, it doesn't
> happen (until I select some text on Emacs again).  Clipboard is shared
> by Synergy.

Can you run Emacs on under a debugger?  If so, please put a breakpoint
in the function `error', reproduce the problem, and post here the
backtrace.  Judging by your description, I would guess that the error
is thrown from xselect.c, but that's a guess.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 05:08:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
Cc: 9498 <at> debbugs.gnu.org
Subject: Re: "Not an in-range integer,..." when using Synergy
Date: Tue, 13 Sep 2011 22:03:06 -0700
On 09/13/11 19:36, Yoshiaki Kasahara wrote:

> Not an in-range integer, float, or cons of integers

This message is generated by cons_to_unsigned or cons_to_signed
and indicates that an Emacs Lisp representation of a low-level
integer is out of that low-level integer's range.  Previously,
Emacs had undefined behavior if that happened (often, but not
always, wrapping the integer around), but now it attempts to
report the errors more systematically.

Can you please run the FreeBSD Emacs under GDB, put
a breakpoint on the 'error' function, make the bug happen,
and then send us a C backtrace?  Something like this:

$ gdb ./emacs
[lots of chatter]
(gdb) b error
(gdb) run
[make the error happen]
(gdb) where




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 08:24:02 GMT) Full text and rfc822 format available.

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

From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
To: eggert <at> cs.ucla.edu
Cc: 9498 <at> debbugs.gnu.org
Subject: Re: "Not an in-range integer,..." when using Synergy
Date: Wed, 14 Sep 2011 16:31:25 +0900 (JST)
On Tue, 13 Sep 2011 22:03:06 -0700,
	Paul Eggert <eggert <at> cs.ucla.edu> said:

> Can you please run the FreeBSD Emacs under GDB, put
> a breakpoint on the 'error' function, make the bug happen,
> and then send us a C backtrace?  Something like this:

% gdb ./emacs
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
DISPLAY = :0.0
TERM = xterm-256color
Breakpoint 1 at 0x4fbd30: file emacs.c, line 385.
Breakpoint 2 at 0x517a60: file sysdep.c, line 855.
(gdb) b error
Breakpoint 3 at 0x56d390: file eval.c, line 1972.
(gdb) run -Q
Starting program: /usr/local/src/Emacs24/emacs/src/emacs -Q
[New LWP 101693]
[New Thread ecbc00 (LWP 101693/initial thread)]
[New Thread f15400 (LWP 101465/emacs)]
[Switching to Thread ecbc00 (LWP 101693/initial thread)]

Breakpoint 3, error (
    m=0x5f3530 "Not an in-range integer, float, or cons of integers")
    at eval.c:1972
1972    {
(gdb) bt
#0  error (m=0x5f3530 "Not an in-range integer, float, or cons of integers")
    at eval.c:1972
#1  0x000000000055abbc in cons_to_signed (c=6239536, min=-2147483648,
    max=2147483647) at data.c:2430
#2  0x00000000004d4e52 in x_convert_selection (event=Variable "event" is not available.
) at xselect.c:1790
#3  0x00000000004d530a in x_handle_selection_event (event=0x7fffffffcff0)
    at xselect.c:858
#4  0x0000000000506d6c in swallow_events (do_display=1) at keyboard.c:4183
#5  0x00000000005aa662 in wait_reading_process_output (time_limit=30,
    microsecs=0, read_kbd=-1, do_display=1, wait_for_cell=10827826,
    wait_proc=0x0, just_wait_proc=0) at process.c:4695
#6  0x0000000000418a34 in sit_for (timeout=120, reading=1, do_display=1)
    at dispnew.c:5967
#7  0x000000000050ae06 in read_char (commandflag=1, nmaps=2,
    maps=0x7fffffffd760, prev_event=Variable "prev_event" is not available.
) at keyboard.c:2690
#8  0x000000000050c5f2 in read_key_sequence (keybuf=0x7fffffffd990,
    bufsize=30, prompt=10827826, dont_downcase_last=0,
    can_return_switch_frame=1, fix_current_buffer=1) at keyboard.c:9285
#9  0x000000000050e86f in command_loop_1 () at keyboard.c:1446
#10 0x00000000005703c4 in internal_condition_case (
    bfun=0x50e6c0 <command_loop_1>, handlers=10908418,
    hfun=0x5089f0 <cmd_error>) at eval.c:1491
#11 0x000000000050861a in command_loop_2 (ignore=Variable "ignore" is not available.
) at keyboard.c:1157
#12 0x00000000005704b8 in internal_catch (tag=Variable "tag" is not available.
) at eval.c:1248
#13 0x0000000000508c82 in recursive_edit_1 () at keyboard.c:1136
#14 0x0000000000508dcd in Frecursive_edit () at keyboard.c:820
#15 0x00000000004fce02 in main (argc=2, argv=0x7fffffffde40) at emacs.c:1706




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 08:35:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
Cc: 9498 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Wed, 14 Sep 2011 04:29:59 -0400
> Date: Wed, 14 Sep 2011 16:31:25 +0900 (JST)
> From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
> Cc: 9498 <at> debbugs.gnu.org
> 
> Breakpoint 3, error (
>     m=0x5f3530 "Not an in-range integer, float, or cons of integers")
>     at eval.c:1972
> 1972    {
> (gdb) bt
> #0  error (m=0x5f3530 "Not an in-range integer, float, or cons of integers")
>     at eval.c:1972
> #1  0x000000000055abbc in cons_to_signed (c=6239536, min=-2147483648,
>     max=2147483647) at data.c:2430
> #2  0x00000000004d4e52 in x_convert_selection (event=Variable "event" is not available.
> ) at xselect.c:1790

Thanks.  Please do

 (gdb) frame 0
 (gdb) p val
 (gdb) pp c
 (gdb) up
 (gdb) pp obj

and show the output.

In order for the "pp" command to work, you will need to start GDB from
the src directory of the Emacs source tree.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 08:37:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
Cc: 9498 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Wed, 14 Sep 2011 04:31:47 -0400
> Date: Wed, 14 Sep 2011 16:31:25 +0900 (JST)
> From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
> Cc: 9498 <at> debbugs.gnu.org

Sorry, the previous message was in error in the instructions I wrote.
Please use this one instead.

> Breakpoint 3, error (
>     m=0x5f3530 "Not an in-range integer, float, or cons of integers")
>     at eval.c:1972
> 1972    {
> (gdb) bt
> #0  error (m=0x5f3530 "Not an in-range integer, float, or cons of integers")
>     at eval.c:1972
> #1  0x000000000055abbc in cons_to_signed (c=6239536, min=-2147483648,
>     max=2147483647) at data.c:2430
> #2  0x00000000004d4e52 in x_convert_selection (event=Variable "event" is not available.
> ) at xselect.c:1790

Thanks.  Please do

 (gdb) frame 1
 (gdb) p val
 (gdb) pp c
 (gdb) up
 (gdb) pp obj

and show the output.

In order for the "pp" command to work, you will need to start GDB from
the src directory of the Emacs source tree.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 08:56:02 GMT) Full text and rfc822 format available.

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

From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
To: eliz <at> gnu.org
Cc: 9498 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Wed, 14 Sep 2011 17:51:17 +0900 (JST)
On Wed, 14 Sep 2011 04:31:47 -0400,
	Eli Zaretskii <eliz <at> gnu.org> said:

> Thanks.  Please do
> 
>  (gdb) frame 1
>  (gdb) p val
>  (gdb) pp c
>  (gdb) up
>  (gdb) pp obj
> 
> and show the output.
> 
> In order for the "pp" command to work, you will need to start GDB from
> the src directory of the Emacs source tree.

Thank you for the instruction.  But I couldn't get some of the values...

(gdb) frame 1
#1  0x000000000055abbc in cons_to_signed (c=6239536, min=-2147483648,
    max=2147483647) at data.c:2430
2430        error ("Not an in-range integer, float, or cons of integers");
(gdb) p val
Variable "val" is not available.
(gdb) pp c
1559884
(gdb) up
#2  0x00000000004d4e52 in x_convert_selection (event=Variable "event" is not available.
) at xselect.c:1790
1790          (*(long **) data_ret) [0] = cons_to_signed (obj, X_LONG_MIN, X_LONG_MAX);
(gdb) pp obj
No symbol "obj" in current context.

Do I need to recompile emacs without compiler optimization?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 09:40:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
Cc: 9498 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Wed, 14 Sep 2011 05:35:06 -0400
> Date: Wed, 14 Sep 2011 17:51:17 +0900 (JST)
> Cc: eggert <at> cs.ucla.edu, 9498 <at> debbugs.gnu.org
> From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
> 
> (gdb) p val
> Variable "val" is not available.
> (gdb) pp c
> 1559884
> (gdb) up
> #2  0x00000000004d4e52 in x_convert_selection (event=Variable "event" is not available.
> ) at xselect.c:1790
> 1790          (*(long **) data_ret) [0] = cons_to_signed (obj, X_LONG_MIN, X_LONG_MAX);
> (gdb) pp obj
> No symbol "obj" in current context.
> 
> Do I need to recompile emacs without compiler optimization?

Yes, please.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 10:29:01 GMT) Full text and rfc822 format available.

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

From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
To: eliz <at> gnu.org
Cc: 9498 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Wed, 14 Sep 2011 19:24:07 +0900 (JST)
On Wed, 14 Sep 2011 05:35:06 -0400,
	Eli Zaretskii <eliz <at> gnu.org> said:

>> Do I need to recompile emacs without compiler optimization?
> 
> Yes, please.

Ok.

Breakpoint 3, error (
    m=0x6e80b8 "Not an in-range integer, float, or cons of integers")
    at eval.c:1974
1974      va_start (ap, m);
(gdb) where
#0  error (m=0x6e80b8 "Not an in-range integer, float, or cons of integers")
    at eval.c:1974
#1  0x0000000000605166 in cons_to_signed (c=12826385284, min=-2147483648,
    max=2147483647) at data.c:2430
#2  0x0000000000526be7 in lisp_data_to_selection_data (display=0x10cc000,
    obj=12826385284, data_ret=0xc70680, type_ret=0xc70698, size_ret=0xc70688,
    format_ret=0xc70690, nofree_ret=0xc706a0) at xselect.c:1790
#3  0x0000000000524ee5 in x_convert_selection (event=0x7fffffffcbc0,
    selection_symbol=11922226, target_symbol=12298130, property=271,
    for_multiple=0, dpyinfo=0xfec400) at xselect.c:937
#4  0x0000000000524c77 in x_handle_selection_request (event=0x7fffffffcbc0)
    at xselect.c:858
#5  0x0000000000525180 in x_handle_selection_event (event=0x7fffffffcbc0)
    at xselect.c:1018
#6  0x000000000057cfa2 in swallow_events (do_display=1) at keyboard.c:4183
#7  0x0000000000682388 in wait_reading_process_output (time_limit=30,
    microsecs=0, read_kbd=-1, do_display=1, wait_for_cell=11855922,
    wait_proc=0x0, just_wait_proc=0) at process.c:4695
#8  0x000000000042284a in sit_for (timeout=120, reading=1, do_display=1)
    at dispnew.c:5967
#9  0x0000000000579c91 in read_char (commandflag=1, nmaps=2,
    maps=0x7fffffffd380, prev_event=11855922, used_mouse_menu=0x7fffffffd604,
    end_time=0x0) at keyboard.c:2690
#10 0x00000000005870e9 in read_key_sequence (keybuf=0x7fffffffd8a0,
    bufsize=30, prompt=11855922, dont_downcase_last=0,
    can_return_switch_frame=1, fix_current_buffer=1) at keyboard.c:9285
#11 0x0000000000577259 in command_loop_1 () at keyboard.c:1446
#12 0x000000000061d363 in internal_condition_case (
    bfun=0x576ea0 <command_loop_1>, handlers=11936514,
    hfun=0x576770 <cmd_error>) at eval.c:1491
#13 0x0000000000576b62 in command_loop_2 (ignore=11855922) at keyboard.c:1157
#14 0x000000000061ccd8 in internal_catch (tag=11928466,
    func=0x576b40 <command_loop_2>, arg=11855922) at eval.c:1248
#15 0x0000000000576b14 in command_loop () at keyboard.c:1136
#16 0x0000000000576272 in recursive_edit_1 () at keyboard.c:756
#17 0x000000000057641f in Frecursive_edit () at keyboard.c:820
#18 0x00000000005747e9 in main (argc=2, argv=0x7fffffffde40) at emacs.c:1706
(gdb) frame 1
#1  0x0000000000605166 in cons_to_signed (c=12826385284, min=-2147483648,
    max=2147483647) at data.c:2430
2430        error ("Not an in-range integer, float, or cons of integers");
(gdb) p val
$1 = 3206596321
(gdb) pp c
3206596321
(gdb) up
#2  0x0000000000526be7 in lisp_data_to_selection_data (display=0x10cc000,
    obj=12826385284, data_ret=0xc70680, type_ret=0xc70698, size_ret=0xc70688,
    format_ret=0xc70690, nofree_ret=0xc706a0) at xselect.c:1790
1790          (*(long **) data_ret) [0] = cons_to_signed (obj, X_LONG_MIN, X_LONG_MAX);
(gdb) pp obj
3206596321





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 12:15:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>,
	Jan Djärv <jan.h.d <at> swipnet.se> 
Cc: 9498 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Wed, 14 Sep 2011 08:10:00 -0400
> Date: Wed, 14 Sep 2011 19:24:07 +0900 (JST)
> Cc: eggert <at> cs.ucla.edu, 9498 <at> debbugs.gnu.org
> From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
> 
> 2430        error ("Not an in-range integer, float, or cons of integers");
> (gdb) p val
> $1 = 3206596321
> (gdb) pp c
> 3206596321
> (gdb) up
> #2  0x0000000000526be7 in lisp_data_to_selection_data (display=0x10cc000,
>     obj=12826385284, data_ret=0xc70680, type_ret=0xc70698, size_ret=0xc70688,
>     format_ret=0xc70690, nofree_ret=0xc706a0) at xselect.c:1790
> 1790          (*(long **) data_ret) [0] = cons_to_signed (obj, X_LONG_MIN, X_LONG_MAX);
> (gdb) pp obj
> 3206596321

Looks like garbage to me.  This value comes from here:

  lisp_selection
    = x_get_local_selection (selection_symbol, target_symbol,
			     0, dpyinfo);
  ...
  lisp_data_to_selection_data (SELECTION_EVENT_DISPLAY (event),
			       lisp_selection,
			       &(cs->data), &(cs->type),
			       &(cs->size), &(cs->format),
			       &(cs->nofree));

The commentary to x_get_local_selection says:

  /* Given a selection-name and desired type, look up our local copy of
     the selection value and convert it to the type.
     The value is nil or a string.

So we need to receive a string, not an integer.

Could you please go up one stack frame, to frame #3, and show the
value of lisp_selection (with the same "pp" command)?

Jan, feel free to chime in, as I'm already on unfamiliar turf.  I
smell a Synergy bug, but only an expert can tell for sure.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 15:04:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
Cc: eliz <at> gnu.org, eggert <at> cs.ucla.edu, 9498 <at> debbugs.gnu.org
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Wed, 14 Sep 2011 10:58:48 -0400
Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp> writes:

> #0  error (m=0x6e80b8 "Not an in-range integer, float, or cons of integers")
>     at eval.c:1974
> #1  0x0000000000605166 in cons_to_signed (c=12826385284, min=-2147483648,
>     max=2147483647) at data.c:2430
> #2  0x0000000000526be7 in lisp_data_to_selection_data (display=0x10cc000,
>     obj=12826385284, data_ret=0xc70680, type_ret=0xc70698, size_ret=0xc70688,
>     format_ret=0xc70690, nofree_ret=0xc706a0) at xselect.c:1790
> #3  0x0000000000524ee5 in x_convert_selection (event=0x7fffffffcbc0,
>     selection_symbol=11922226, target_symbol=12298130, property=271,
>     for_multiple=0, dpyinfo=0xfec400) at xselect.c:937
> #4  0x0000000000524c77 in x_handle_selection_request (event=0x7fffffffcbc0)
>     at xselect.c:858

Could you also do

f 3
pp selection_symbol




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Wed, 14 Sep 2011 15:58:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Jan Djär, 9498 <at> debbugs.gnu.org,
	v <jan.h.d <at> swipnet.se>,
	Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Wed, 14 Sep 2011 08:53:06 -0700
On 09/14/11 05:10, Eli Zaretskii wrote:

> Jan, feel free to chime in, as I'm already on unfamiliar turf.  I
> smell a Synergy bug, but only an expert can tell for sure.

Quite possibly it is a Synergy bug or something like that, but
in looking in the code I saw a related issue that may explain
the symptoms (even if it doesn't fix the bug).  Emacs was getting
data from X in the form of unsigned integers, but sending data to
X in the form of signed integers, and the mismatch was causing the
diagnostic.

I committed a fix for this symptom as bzr 105767 on the trunk.
Here's a copy, for convenience:

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2011-09-14 05:20:23 +0000
+++ src/ChangeLog	2011-09-14 15:47:21 +0000
@@ -1,3 +1,13 @@
+2011-09-14  Paul Eggert  <eggert <at> cs.ucla.edu>
+
+	* xselect.c: Use signed conversions more consistently (Bug#9498).
+	(selection_data_to_lisp_data): Assume incoming selection data are
+	signed integers, not unsigned.  This is to be consistent with
+	outgoing selection data, which was modified to use signed integers
+	in as part of the fix to Bug#9196 in response to Jan D.'s comment
+	in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9196#32> that X11
+	expects long, not unsigned long.
+
 2011-09-14  Eli Zaretskii  <eliz <at> gnu.org>
 
 	* xdisp.c (try_window_reusing_current_matrix): Fix incorrect

=== modified file 'src/xselect.c'
--- src/xselect.c	2011-09-09 01:06:52 +0000
+++ src/xselect.c	2011-09-14 15:47:21 +0000
@@ -1685,9 +1685,9 @@
      convert it to a cons of integers, 16 bits in each half.
    */
   else if (format == 32 && size == sizeof (int))
-    return INTEGER_TO_CONS (((unsigned int *) data) [0]);
+    return INTEGER_TO_CONS (((int *) data) [0]);
   else if (format == 16 && size == sizeof (short))
-    return make_number (((unsigned short *) data) [0]);
+    return make_number (((short *) data) [0]);
 
   /* Convert any other kind of data to a vector of numbers, represented
      as above (as an integer, or a cons of two 16 bit integers.)
@@ -1699,7 +1699,7 @@
       v = Fmake_vector (make_number (size / 2), make_number (0));
       for (i = 0; i < size / 2; i++)
 	{
-	  EMACS_INT j = ((unsigned short *) data) [i];
+	  EMACS_INT j = ((short *) data) [i];
 	  Faset (v, make_number (i), make_number (j));
 	}
       return v;
@@ -1711,7 +1711,7 @@
 				    make_number (0));
       for (i = 0; i < size / X_LONG_SIZE; i++)
 	{
-	  unsigned int j = ((unsigned int *) data) [i];
+	  int j = ((int *) data) [i];
 	  Faset (v, make_number (i), INTEGER_TO_CONS (j));
 	}
       return v;





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Thu, 15 Sep 2011 02:21:02 GMT) Full text and rfc822 format available.

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

From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
To: eliz <at> gnu.org
Cc: 9498 <at> debbugs.gnu.org, jan.h.d <at> swipnet.se, cyd <at> stupidchicken.com,
	eggert <at> cs.ucla.edu
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Thu, 15 Sep 2011 11:15:32 +0900 (JST)
On Wed, 14 Sep 2011 08:10:00 -0400,
	Eli Zaretskii <eliz <at> gnu.org> said:

> Could you please go up one stack frame, to frame #3, and show the
> value of lisp_selection (with the same "pp" command)?

(gdb) pp lisp_selection
3206596321

On Wed, 14 Sep 2011 10:58:48 -0400,
	Chong Yidong <cyd <at> stupidchicken.com> said:

> Could you also do
> 
> f 3
> pp selection_symbol

(gdb) pp selection_symbol
PRIMARY

Then I updated the source tree and tried again.


Breakpoint 3, error (
    m=0x6e7eb8 "Not an in-range integer, float, or cons of integers")
    at eval.c:1974
1974      va_start (ap, m);
(gdb) where
#0  error (m=0x6e7eb8 "Not an in-range integer, float, or cons of integers")
    at eval.c:1974
#1  0x00000000006050b6 in cons_to_signed (c=13044703648, min=-2147483648,
    max=2147483647) at data.c:2430
#2  0x0000000000526b37 in lisp_data_to_selection_data (display=0x10f1000,
    obj=13044703648, data_ret=0xbf8800, type_ret=0xbf8818, size_ret=0xbf8808,
    format_ret=0xbf8810, nofree_ret=0xbf8820) at xselect.c:1790
#3  0x0000000000524e25 in x_convert_selection (event=0x7fffffffcbc0,
    selection_symbol=11922226, target_symbol=12298082, property=271,
    for_multiple=0, dpyinfo=0x1003400) at xselect.c:937
#4  0x0000000000524bb7 in x_handle_selection_request (event=0x7fffffffcbc0)
    at xselect.c:858
#5  0x00000000005250c0 in x_handle_selection_event (event=0x7fffffffcbc0)
    at xselect.c:1018
#6  0x000000000057cef2 in swallow_events (do_display=1) at keyboard.c:4183
#7  0x00000000006822d8 in wait_reading_process_output (time_limit=30,
    microsecs=0, read_kbd=-1, do_display=1, wait_for_cell=11855922,
    wait_proc=0x0, just_wait_proc=0) at process.c:4695
#8  0x000000000042284a in sit_for (timeout=120, reading=1, do_display=1)
    at dispnew.c:5967
#9  0x0000000000579be1 in read_char (commandflag=1, nmaps=2,
    maps=0x7fffffffd380, prev_event=11855922, used_mouse_menu=0x7fffffffd604,
    end_time=0x0) at keyboard.c:2690
#10 0x0000000000587039 in read_key_sequence (keybuf=0x7fffffffd8a0,
    bufsize=30, prompt=11855922, dont_downcase_last=0,
    can_return_switch_frame=1, fix_current_buffer=1) at keyboard.c:9285
#11 0x00000000005771a9 in command_loop_1 () at keyboard.c:1446
#12 0x000000000061d2b3 in internal_condition_case (
    bfun=0x576df0 <command_loop_1>, handlers=11936514,
    hfun=0x5766c0 <cmd_error>) at eval.c:1491
#13 0x0000000000576ab2 in command_loop_2 (ignore=11855922) at keyboard.c:1157
#14 0x000000000061cc28 in internal_catch (tag=11928466,
    func=0x576a90 <command_loop_2>, arg=11855922) at eval.c:1248
#15 0x0000000000576a64 in command_loop () at keyboard.c:1136
#16 0x00000000005761c2 in recursive_edit_1 () at keyboard.c:756
#17 0x000000000057636f in Frecursive_edit () at keyboard.c:820
#18 0x0000000000574739 in main (argc=2, argv=0x7fffffffde40) at emacs.c:1706
(gdb) frame 1
#1  0x00000000006050b6 in cons_to_signed (c=13044703648, min=-2147483648,
    max=2147483647) at data.c:2430
2430        error ("Not an in-range integer, float, or cons of integers");
(gdb) p val
$1 = 3261175912
(gdb) pp c
3261175912
(gdb) up
#2  0x0000000000526b37 in lisp_data_to_selection_data (display=0x10f1000,
    obj=13044703648, data_ret=0xbf8800, type_ret=0xbf8818, size_ret=0xbf8808,
    format_ret=0xbf8810, nofree_ret=0xbf8820) at xselect.c:1790
1790          (*(long **) data_ret) [0] = cons_to_signed (obj, X_LONG_MIN, X_LONG_MAX);
(gdb) pp obj
3261175912
(gdb) up
#3  0x0000000000524e25 in x_convert_selection (event=0x7fffffffcbc0,
    selection_symbol=11922226, target_symbol=12298082, property=271,
    for_multiple=0, dpyinfo=0x1003400) at xselect.c:937
937       lisp_data_to_selection_data (SELECTION_EVENT_DISPLAY (event),
(gdb) pp lisp_selection
3261175912
(gdb) pp selection_symbol
PRIMARY





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Thu, 15 Sep 2011 03:09:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
Cc: 9498 <at> debbugs.gnu.org, jan.h.d <at> swipnet.se, cyd <at> stupidchicken.com,
	eggert <at> cs.ucla.edu
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Thu, 15 Sep 2011 06:04:22 +0300
> Date: Thu, 15 Sep 2011 11:15:32 +0900 (JST)
> Cc: jan.h.d <at> swipnet.se, eggert <at> cs.ucla.edu, 9498 <at> debbugs.gnu.org,
>         cyd <at> stupidchicken.com
> From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
> 
> On Wed, 14 Sep 2011 08:10:00 -0400,
> 	Eli Zaretskii <eliz <at> gnu.org> said:
> 
> > Could you please go up one stack frame, to frame #3, and show the
> > value of lisp_selection (with the same "pp" command)?
> 
> (gdb) pp lisp_selection
> 3206596321

So I think we should not go with a "selection" that is not a string or
nil.

Jan?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Thu, 15 Sep 2011 17:13:01 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9498 <at> debbugs.gnu.org, jan.h.d <at> swipnet.se,
	Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>, eggert <at> cs.ucla.edu
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Thu, 15 Sep 2011 13:08:05 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> (gdb) pp lisp_selection
>> 3206596321
>
> So I think we should not go with a "selection" that is not a string or
> nil.

We should figure out is why such a value gets there in the first place.

Yoshiaki: could you do

f 3
pp target_symbol
pp dpyinfo->terminal->Vselection_alist

so that we can see what selection value was recorded, and how Emacs
tried to convert it.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Fri, 16 Sep 2011 01:12:02 GMT) Full text and rfc822 format available.

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

From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
To: cyd <at> stupidchicken.com
Cc: eliz <at> gnu.org, jan.h.d <at> swipnet.se, 9498 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Fri, 16 Sep 2011 10:06:04 +0900 (JST)
On Thu, 15 Sep 2011 13:08:05 -0400,
	Chong Yidong <cyd <at> stupidchicken.com> said:

> We should figure out is why such a value gets there in the first place.
> 
> Yoshiaki: could you do
> 
> f 3
> pp target_symbol
> pp dpyinfo->terminal->Vselection_alist
> 
> so that we can see what selection value was recorded, and how Emacs
> tried to convert it.

Sure.

Breakpoint 3, error (
    m=0x6e7eb8 "Not an in-range integer, float, or cons of integers")
    at eval.c:1974
1974      va_start (ap, m);
(gdb) f 3
#3  0x0000000000524e25 in x_convert_selection (event=0x7fffffffcbc0,
    selection_symbol=11922226, target_symbol=12298082, property=271,
    for_multiple=0, dpyinfo=0x1003400) at xselect.c:937
937       lisp_data_to_selection_data (SELECTION_EVENT_DISPLAY (event),
(gdb) pp target_symbol
TIMESTAMP
(gdb) pp dpyinfo->terminal->Vselection_alist
((PRIMARY "to c" 3345671365 #<frame emacs <at> elvenbow.cc.kyushu-u.ac.jp 0x1546c00>))

"to c" is the text I highlighted on *scratch* buffer.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Fri, 16 Sep 2011 01:37:01 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: eggert <at> cs.ucla.edu
Cc: eliz <at> gnu.org, jan.h.d <at> swipnet.se,
	Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>, 9498 <at> debbugs.gnu.org
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Thu, 15 Sep 2011 21:31:20 -0400
Thanks.

The culprit seems to be Paul Eggert's 2011-08-26 change (Bug#9196) to
lisp_data_to_selection_data, which forces numeric values to be saved to
the X selection data member with a maximum allowed value of X_LONG_MAX
== 2147483647.  This breaks for timestamps like 3345671365.

The patch below probably fixes the error for this specific bug, but I
will leave it up to Paul to figure out if it's the right fix.

Paul, please review your change.  Thanks.


=== modified file 'src/xselect.c'
*** src/xselect.c	2011-09-14 15:47:21 +0000
--- src/xselect.c	2011-09-16 01:28:22 +0000
***************
*** 1787,1793 ****
        *format_ret = 32;
        *size_ret = 1;
        (*data_ret) [sizeof (long)] = 0;
!       (*(long **) data_ret) [0] = cons_to_signed (obj, X_LONG_MIN, X_LONG_MAX);
        if (NILP (type)) type = QINTEGER;
      }
    else if (VECTORP (obj))
--- 1787,1793 ----
        *format_ret = 32;
        *size_ret = 1;
        (*data_ret) [sizeof (long)] = 0;
!       (*(long **) data_ret) [0] = cons_to_signed (obj, LONG_MIN, LONG_MAX);
        if (NILP (type)) type = QINTEGER;
      }
    else if (VECTORP (obj))





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Fri, 16 Sep 2011 07:06:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 9498 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu, kasahara <at> nc.kyushu-u.ac.jp,
	jan.h.d <at> swipnet.se
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Fri, 16 Sep 2011 09:59:22 +0300
> From: Chong Yidong <cyd <at> stupidchicken.com>
> Cc: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>, eliz <at> gnu.org,
>         jan.h.d <at> swipnet.se, 9498 <at> debbugs.gnu.org
> Date: Thu, 15 Sep 2011 21:31:20 -0400
> 
> Thanks.
> 
> The culprit seems to be Paul Eggert's 2011-08-26 change (Bug#9196) to
> lisp_data_to_selection_data, which forces numeric values to be saved to
> the X selection data member with a maximum allowed value of X_LONG_MAX
> == 2147483647.  This breaks for timestamps like 3345671365.

If integer values are allowed in values returned by
x_get_local_selection, I Think we should update the commentary to that
function.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Fri, 16 Sep 2011 18:11:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: eliz <at> gnu.org, jan.h.d <at> swipnet.se,
	Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>, 9498 <at> debbugs.gnu.org
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Fri, 16 Sep 2011 11:05:51 -0700
On 09/15/11 18:31, Chong Yidong wrote:
> The patch below probably fixes the error for this specific bug, but I
> will leave it up to Paul to figure out if it's the right fix.

That's on the right track, but it assumes the value in question
is less than LONG_MAX, which is true on a 64-bit host but not
on a 32-bit host.  I came up with a revised patch to address that.
I also reviewed my earlier change and found an inverted test, which I
also fixed, as part of bzr 105796 on the trunk.  This patch
also adds a comment along the line that Eli suggested.

I'm still a bit concerned by the difference between what was
in Emacs 23.3 (it sometimes deals with unsigned quantities
in X selections, and sometimes signed) and what we have now
(usually signed quantities, at Jan D.'s suggestion, but unsigned in
the case above, now).  The Emacs 23.3 code is obviously wrong
in some cases: for example:

  else if (INTEGERP (obj)
           && XINT (obj) < 0xFFFF
           && XINT (obj) > -0xFFFF)
 
as a test whether OBJ fits into 16 bits is clearly wrong, as
the range -65534 .. 65534 doesn't make any sense.  The current
code is better, but could well have remaining gotchas.  A review
by Jan D. would help, I think.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9498; Package emacs. (Tue, 20 Sep 2011 09:50:01 GMT) Full text and rfc822 format available.

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

From: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
To: eggert <at> cs.ucla.edu
Cc: cyd <at> stupidchicken.com, jan.h.d <at> swipnet.se, 9498 <at> debbugs.gnu.org,
	eliz <at> gnu.org
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Tue, 20 Sep 2011 18:44:25 +0900 (JST)
Today I updated Emacs and the error disappeared.  Thank you very much!




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 20 Sep 2011 18:45:03 GMT) Full text and rfc822 format available.

Notification sent to Paul Eggert <eggert <at> cs.ucla.edu>:
bug acknowledged by developer. (Tue, 20 Sep 2011 18:45:04 GMT) Full text and rfc822 format available.

Message #70 received at 9498-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Yoshiaki Kasahara <kasahara <at> nc.kyushu-u.ac.jp>
Cc: cyd <at> stupidchicken.com, jan.h.d <at> swipnet.se, eliz <at> gnu.org,
	9498-done <at> debbugs.gnu.org
Subject: Re: bug#9498: "Not an in-range integer,..." when using Synergy
Date: Tue, 20 Sep 2011 11:39:37 -0700
On 09/20/11 02:44, Yoshiaki Kasahara wrote:
> Today I updated Emacs and the error disappeared.  Thank you very much!

You're welcome; and thanks for checking
(and thanks to the others who helped as well).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 19 Oct 2011 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 201 days ago.

Previous Next


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