GNU bug report logs - #68272
[PATCH] Fix -1 leaking from C to lisp in 'read-event' etc.

Previous Next

Package: emacs;

Reported by: Tim Ruffing <crypto <at> timruffing.de>

Date: Fri, 5 Jan 2024 21:20:01 UTC

Severity: normal

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Tim Ruffing <crypto <at> timruffing.de>
Subject: bug#68272: closed (Re: bug#68272: [PATCH] Fix -1 leaking from C
 to lisp in 'read-event' etc.)
Date: Sun, 10 Mar 2024 14:50:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#68272: [PATCH] Fix -1 leaking from C to lisp in 'read-event' etc.

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 68272 <at> debbugs.gnu.org.

-- 
68272: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68272
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: crypto <at> timruffing.de, 68272-done <at> debbugs.gnu.org,
 Michael Albinus <michael.albinus <at> gmx.de>
Subject: Re: bug#68272: [PATCH] Fix -1 leaking from C to lisp in
 'read-event' etc.
Date: Sun, 10 Mar 2024 10:48:40 -0400
Thank you, pushed, closing,


        Stefan


[Message part 3 (message/rfc822, inline)]
From: Tim Ruffing <crypto <at> timruffing.de>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix -1 leaking from C to lisp in 'read-event' etc.
Date: Fri, 05 Jan 2024 22:19:10 +0100
[Message part 4 (text/plain, inline)]
'read_char' in src/keyboard.c returns -1 to indicate the end of a
keyboard macro. This case is supposed to be propagated via 
'read_key_sequence' and 'command_loop_2' to 'Fexecute_kbd_macro'.

But 'read_key_sequence' is not the only caller of 'read_char'. It is
also called by 'read-event' and similar lisp functions, and in that
case, the magic C return value -1 is wrongly propagated to the lisp
caller. 

There are at least workarounds for this bug in at least three lisp
modules in the code base, in subr.el, in calc and most recently added
in dbus.el (bug #62018), see the attached patches. These patches are
supposed to resolve the underlying issue, and then remove the
workarounds.




[0001-Extract-check-for-end-of-macro-to-function.patch (text/x-patch, attachment)]
[0002-src-keyboard.c-requeued_events_pending_p-Revive.patch (text/x-patch, attachment)]
[0003-Fix-1-leaking-from-C-to-lisp-in-read-event-etc.patch (text/x-patch, attachment)]
[0004-Remove-workarounds-for-solved-read-event-bug.patch (text/x-patch, attachment)]

This bug report was last modified 1 year and 68 days ago.

Previous Next


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