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: Tim Ruffing <crypto <at> timruffing.de>
To: 68272 <at> debbugs.gnu.org
Subject: bug#68272: [PATCH] Fix -1 leaking from C to lisp in 'read-event' etc.
Date: Fri, 05 Jan 2024 22:19:10 +0100
[Message part 1 (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.