From unknown Fri Aug 15 12:46:48 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#39944 <39944@debbugs.gnu.org> To: bug#39944 <39944@debbugs.gnu.org> Subject: Status: 27.0.90; JIT Stealth timer errors Reply-To: bug#39944 <39944@debbugs.gnu.org> Date: Fri, 15 Aug 2025 19:46:48 +0000 retitle 39944 27.0.90; JIT Stealth timer errors reassign 39944 emacs submitter 39944 Eli Zaretskii severity 39944 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 06 05:01:55 2020 Received: (at submit) by debbugs.gnu.org; 6 Mar 2020 10:01:55 +0000 Received: from localhost ([127.0.0.1]:44106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jA9nn-0006Vc-FV for submit@debbugs.gnu.org; Fri, 06 Mar 2020 05:01:55 -0500 Received: from lists.gnu.org ([209.51.188.17]:54042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jA9nl-0006VU-Br for submit@debbugs.gnu.org; Fri, 06 Mar 2020 05:01:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57958) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jA9nj-0001at-Oj for bug-gnu-emacs@gnu.org; Fri, 06 Mar 2020 05:01:53 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=ALL_TRUSTED,BAYES_50 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jA9ni-0005Sz-I0 for bug-gnu-emacs@gnu.org; Fri, 06 Mar 2020 05:01:50 -0500 Received: from [176.228.60.248] (port=2976 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jA9nh-000588-Rj for bug-gnu-emacs@gnu.org; Fri, 06 Mar 2020 05:01:50 -0500 Date: Fri, 06 Mar 2020 12:01:46 +0200 Message-Id: <83a74tiyyd.fsf@gnu.org> From: Eli Zaretskii To: bug-gnu-emacs@gnu.org Subject: 27.0.90; JIT Stealth timer errors MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) I see these errors in the 27.0.90 pretest from time to time: Error running timer ‘jit-lock-stealth-fontify’: (error "Invalid time format") This didn't happen in previous versions of Emacs, so I think this is some regression, most probably due to changes in timer.el or related time functions. Does anyone else see this? (You have to enable jit-lock-stealth to see this.) In GNU Emacs 27.0.90 (build 1, i686-pc-mingw32) of 2020-03-01 built on HOME-C4E4A596F7 Windowing system distributor 'Microsoft Corp.', version 5.1.2600 System Description: Microsoft Windows XP Service Pack 3 (v5.1.0.2600) Recent messages: Getting mail from d:/usr/eli/data/mail.new... Counting new messages...done (1) Saving file d:/usr/eli/rmail/INBOX... Wrote d:/usr/eli/rmail/INBOX Computing summary lines...done 1 new message read No following nondeleted message Saving file d:/usr/eli/rmail/INBOX... Wrote d:/usr/eli/rmail/INBOX Error running timer ‘jit-lock-stealth-fontify’: (error "Invalid time format") [2 times] Configured using: 'configure -C --prefix=/d/usr --with-wide-int --with-modules 'CFLAGS=-Og -gdwarf-4 -g3'' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2 HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP Important settings: value of $LANG: ENU locale-coding-system: cp1255 Major mode: RMAIL Minor modes in effect: shell-dirtrack-mode: t desktop-save-mode: t save-place-mode: t show-paren-mode: t display-battery-mode: t display-time-mode: t tooltip-mode: t global-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 temp-buffer-resize-mode: t buffer-read-only: t line-number-mode: t Load-path shadows: d:/usr/share/emacs/site-lisp/soap-inspect hides d:/usr/share/emacs/27.0.90/lisp/net/soap-inspect d:/usr/share/emacs/site-lisp/soap-client hides d:/usr/share/emacs/27.0.90/lisp/net/soap-client Features: (shadow emacsbug pcase shell pcomplete comint ansi-color rfc2104 gnutls network-stream nsm mail-extr smtpmail mailalias sendmail eieio-opt speedbar sb-image ezimage dframe find-func mule-diag help-fns radix-tree misearch multi-isearch time-stamp shr-color color shr url-cookie url-domsuf url-util url-parse auth-source json map url-vars svg xml dom browse-url cl-extra help-mode make-mode conf-mode bat-mode noutline outline cc-awk jka-compr vc-cvs vc-dispatcher vc-bzr texinfo mule-util info view enriched flyspell add-log vc-git diff-mode easy-mmode bug-reference rmailsum qp rmailmm message rmc puny format-spec rfc822 mml mml-sec password-cache epa epg epg-config gnus-util text-property-search time-date subr-x seq mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader mail-parse rfc2231 rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils desktop frameset server find-lisp dired dired-loaddefs filecache mairix cus-edit cus-start cus-load wid-edit saveplace midnight ispell derived generic-x cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs paren xref cl-seq project ring eieio byte-opt bytecomp byte-compile cconv eieio-core cl-macs gv eieio-loaddefs cl-loaddefs cl-lib battery time tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win 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 timer select scroll-bar mouse jit-lock font-lock syntax facemenu 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 loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 526189 45228) (symbols 48 20376 1) (strings 16 118191 2769) (string-bytes 1 3365518) (vectors 16 32257) (vector-slots 8 464721 70974) (floats 8 282 384) (intervals 40 56525 1222) (buffers 888 238)) From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 06 05:06:26 2020 Received: (at 39944) by debbugs.gnu.org; 6 Mar 2020 10:06:26 +0000 Received: from localhost ([127.0.0.1]:44114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jA9sA-0006cT-F1 for submit@debbugs.gnu.org; Fri, 06 Mar 2020 05:06:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50471) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jA9s8-0006cH-Qn for 39944@debbugs.gnu.org; Fri, 06 Mar 2020 05:06:25 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jA9s3-0007rK-Ow for 39944@debbugs.gnu.org; Fri, 06 Mar 2020 05:06:19 -0500 Received: from [176.228.60.248] (port=3235 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jA9rq-000361-RE for 39944@debbugs.gnu.org; Fri, 06 Mar 2020 05:06:08 -0500 Date: Fri, 06 Mar 2020 12:06:03 +0200 Message-Id: <837dzxiyr8.fsf@gnu.org> From: Eli Zaretskii To: 39944@debbugs.gnu.org In-Reply-To: <83a74tiyyd.fsf@gnu.org> (message from Eli Zaretskii on Fri, 06 Mar 2020 12:01:46 +0200) Subject: Re: bug#39944: 27.0.90; JIT Stealth timer errors References: <83a74tiyyd.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39944 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Date: Fri, 06 Mar 2020 12:01:46 +0200 > From: Eli Zaretskii > > > I see these errors in the 27.0.90 pretest from time to time: > > Error running timer ‘jit-lock-stealth-fontify’: (error "Invalid time format") Additional information which is probably related: the *Message* buffer shows this from time to time: run-at-time: Invalid time format ([nil 24162 5043 0 5 display-time-event-handler nil nil 0] [nil 24162 5046 46875 nil undo-auto--boundary-timer nil nil 0] [nil 24162 5098 187500 60 battery-update-handler nil nil 0] [nil 24162 54768 140625 86400 run-hooks (midnight-hook) nil 0]) From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 06 05:16:20 2020 Received: (at 39944) by debbugs.gnu.org; 6 Mar 2020 10:16:20 +0000 Received: from localhost ([127.0.0.1]:44122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAA1k-0006rM-Fk for submit@debbugs.gnu.org; Fri, 06 Mar 2020 05:16:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37936) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAA1i-0006r5-Re for 39944@debbugs.gnu.org; Fri, 06 Mar 2020 05:16:19 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jAA1d-0003ON-Ok for 39944@debbugs.gnu.org; Fri, 06 Mar 2020 05:16:13 -0500 Received: from [176.228.60.248] (port=3846 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jAA1c-0004Mm-5e for 39944@debbugs.gnu.org; Fri, 06 Mar 2020 05:16:12 -0500 Date: Fri, 06 Mar 2020 12:16:07 +0200 Message-Id: <835zfhiyag.fsf@gnu.org> From: Eli Zaretskii To: 39944@debbugs.gnu.org In-Reply-To: <837dzxiyr8.fsf@gnu.org> (message from Eli Zaretskii on Fri, 06 Mar 2020 12:06:03 +0200) Subject: Re: bug#39944: 27.0.90; JIT Stealth timer errors References: <83a74tiyyd.fsf@gnu.org> <837dzxiyr8.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39944 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Date: Fri, 06 Mar 2020 12:06:03 +0200 > From: Eli Zaretskii > > > Date: Fri, 06 Mar 2020 12:01:46 +0200 > > From: Eli Zaretskii > > > > > > I see these errors in the 27.0.90 pretest from time to time: > > > > Error running timer ‘jit-lock-stealth-fontify’: (error "Invalid time format") > > Additional information which is probably related: the *Message* buffer > shows this from time to time: > > run-at-time: Invalid time format > ([nil 24162 5043 0 5 display-time-event-handler nil nil 0] [nil 24162 5046 46875 nil undo-auto--boundary-timer nil nil 0] [nil 24162 5098 187500 60 battery-update-handler nil nil 0] [nil 24162 54768 140625 86400 run-hooks (midnight-hook) nil 0]) This message comes from this fragment of run-at-time: (or (consp time) (error "Invalid time format")) I guess this means the problem is general with timers, not specific to JIT Stealth. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 06 11:11:28 2020 Received: (at 39944) by debbugs.gnu.org; 6 Mar 2020 16:11:28 +0000 Received: from localhost ([127.0.0.1]:45789 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAFZQ-0000Rz-8B for submit@debbugs.gnu.org; Fri, 06 Mar 2020 11:11:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56312) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAFZP-0000Rm-0X for 39944@debbugs.gnu.org; Fri, 06 Mar 2020 11:11:27 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jAFZJ-0001Kh-LH; Fri, 06 Mar 2020 11:11:21 -0500 Received: from [176.228.60.248] (port=1466 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jAFZJ-0000pd-1G; Fri, 06 Mar 2020 11:11:21 -0500 Date: Fri, 06 Mar 2020 18:11:14 +0200 Message-Id: <83h7z1bh0d.fsf@gnu.org> From: Eli Zaretskii To: Paul Eggert In-Reply-To: <835zfhiyag.fsf@gnu.org> (message from Eli Zaretskii on Fri, 06 Mar 2020 12:16:07 +0200) Subject: Re: bug#39944: 27.0.90; JIT Stealth timer errors References: <83a74tiyyd.fsf@gnu.org> <837dzxiyr8.fsf@gnu.org> <835zfhiyag.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39944 Cc: 39944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Date: Fri, 06 Mar 2020 12:16:07 +0200 > From: Eli Zaretskii > > > Additional information which is probably related: the *Message* buffer > > shows this from time to time: > > > > run-at-time: Invalid time format > > ([nil 24162 5043 0 5 display-time-event-handler nil nil 0] [nil 24162 5046 46875 nil undo-auto--boundary-timer nil nil 0] [nil 24162 5098 187500 60 battery-update-handler nil nil 0] [nil 24162 54768 140625 86400 run-hooks (midnight-hook) nil 0]) > > This message comes from this fragment of run-at-time: > > (or (consp time) > (error "Invalid time format")) > > I guess this means the problem is general with timers, not specific to > JIT Stealth. The problem is in run-at-time, here: ;; Handle numbers as relative times in seconds. (if (numberp time) (setq time (timer-relative-time nil time))) This is assumed to always produce time in list format, but at least on my system (32-bit build --with-wide-int) it sometimes produces an integer. I instrumented run-at-time and got a backtrace that clearly shows that run-at-time was called with the first arg zero, and the value returned from time-relative-time was a (large) integer. Looking at time_arith, I see that this could happen when HZ is computed to be the number 1. I tried to figure out why this happens, but quickly got lost (the comments in that part of the code can really use some enhancement; they currently seem to target only experts in both time handling and GMP: many macros whose names don't explain what they do, and plethora of calls to libgmp functions that have no comments whatsoever). Assuming that an integer value is legitimate in that place, here's the change I propose; since making that change locally, I didn't have even a single error of this kind: diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index 74a9495..e61c1a6 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -353,8 +353,10 @@ run-at-time (setq time (timer-next-integral-multiple-of-time (current-time) repeat))) ;; Handle numbers as relative times in seconds. - (if (numberp time) - (setq time (timer-relative-time nil time))) + (when (numberp time) + (setq time (timer-relative-time nil time)) + (or (consp time) + (setq time (time-convert time 'list)))) ;; Handle relative times like "2 hours 35 minutes" (if (stringp time) From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 07 13:02:37 2020 Received: (at 39944) by debbugs.gnu.org; 7 Mar 2020 18:02:37 +0000 Received: from localhost ([127.0.0.1]:47510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAdmW-00031c-W5 for submit@debbugs.gnu.org; Sat, 07 Mar 2020 13:02:37 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:45296) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAdmV-00031P-B9 for 39944@debbugs.gnu.org; Sat, 07 Mar 2020 13:02:36 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B92FE1600C3; Sat, 7 Mar 2020 10:02:29 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id lfAfZGIs46cE; Sat, 7 Mar 2020 10:02:28 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D6D231600C5; Sat, 7 Mar 2020 10:02:28 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id C3wxxXcemeBs; Sat, 7 Mar 2020 10:02:28 -0800 (PST) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 934131600C3; Sat, 7 Mar 2020 10:02:28 -0800 (PST) Subject: Re: bug#39944: 27.0.90; JIT Stealth timer errors To: Eli Zaretskii References: <83a74tiyyd.fsf@gnu.org> <837dzxiyr8.fsf@gnu.org> <835zfhiyag.fsf@gnu.org> <83h7z1bh0d.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sat, 7 Mar 2020 10:02:28 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <83h7z1bh0d.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------64FEC9E8C0543FA65826C051" Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39944 Cc: 39944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------64FEC9E8C0543FA65826C051 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 3/6/20 8:11 AM, Eli Zaretskii wrote: > (the comments in that part of the code can really use some > enhancement; they currently seem to target only experts in both time > handling and GMP: many macros whose names don't explain what they do, > and plethora of calls to libgmp functions that have no comments > whatsoever). Although comments in that area no doubt could use improvement, I'd rather not see comments like this: /* Add TM_YEAR_BASE to mpz[0]. */ mpz_add_ui (mpz[0], mpz[0], TM_YEAR_BASE); as they would be the rough equivalent of: /* Add 1 to I. */ i++; > + (when (numberp time) > + (setq time (timer-relative-time nil time)) > + (or (consp time) > + (setq time (time-convert time 'list)))) This would catch some problems but not all, as the real bug here is in the code (or (consp time) (error "Invalid time format")) which occurs a few lines later. As near as I can tell this later code is both wrong and unnecessary. It's wrong because it's no longer true that only conses are time values. It's unnecessary because the immediately following (timer-set-function timer function args) call checks the validity of TIME. On the off chance that a validity check is still helpful (because we don't want to create garbage?) I installed the attached patch. But it might be better in master to remove the "Invalid time format" check entirely. --------------64FEC9E8C0543FA65826C051 Content-Type: text/x-patch; charset=UTF-8; name="0001-Fix-bug-with-JIT-stealth-timers.patch" Content-Disposition: attachment; filename="0001-Fix-bug-with-JIT-stealth-timers.patch" Content-Transfer-Encoding: quoted-printable >From 363d927086dbdc4e5073393889b76eb0470785f4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 7 Mar 2020 09:47:03 -0800 Subject: [PATCH] Fix bug with JIT stealth timers MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * lisp/emacs-lisp/timer.el (run-at-time): Don=E2=80=99t assume that Lisp time values must be conses (Bug#39944). --- lisp/emacs-lisp/timer.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index 74a94957e7..9eb8feed0f 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -378,7 +378,7 @@ This function returns a timer object which you can us= e in (decoded-time-year now) (decoded-time-zone now))))))) =20 - (or (consp time) + (or (time-equal-p time time) (error "Invalid time format")) =20 (let ((timer (timer-create))) --=20 2.17.1 --------------64FEC9E8C0543FA65826C051-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 07 13:29:56 2020 Received: (at 39944) by debbugs.gnu.org; 7 Mar 2020 18:29:56 +0000 Received: from localhost ([127.0.0.1]:47540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAeCy-0003eJ-Ir for submit@debbugs.gnu.org; Sat, 07 Mar 2020 13:29:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46103) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAeCw-0003e6-RB for 39944@debbugs.gnu.org; Sat, 07 Mar 2020 13:29:55 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42135) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jAeCr-0006WA-6D; Sat, 07 Mar 2020 13:29:49 -0500 Received: from [176.228.60.248] (port=4131 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jAeCp-00070g-KJ; Sat, 07 Mar 2020 13:29:48 -0500 Date: Sat, 07 Mar 2020 20:29:47 +0200 Message-Id: <831rq49fxg.fsf@gnu.org> From: Eli Zaretskii To: Paul Eggert In-Reply-To: (message from Paul Eggert on Sat, 7 Mar 2020 10:02:28 -0800) Subject: Re: bug#39944: 27.0.90; JIT Stealth timer errors References: <83a74tiyyd.fsf@gnu.org> <837dzxiyr8.fsf@gnu.org> <835zfhiyag.fsf@gnu.org> <83h7z1bh0d.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39944 Cc: 39944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Cc: 39944@debbugs.gnu.org > From: Paul Eggert > Date: Sat, 7 Mar 2020 10:02:28 -0800 > > > (the comments in that part of the code can really use some > > enhancement; they currently seem to target only experts in both time > > handling and GMP: many macros whose names don't explain what they do, > > and plethora of calls to libgmp functions that have no comments > > whatsoever). > > Although comments in that area no doubt could use improvement, I'd rather not > see comments like this: > > /* Add TM_YEAR_BASE to mpz[0]. */ > mpz_add_ui (mpz[0], mpz[0], TM_YEAR_BASE); There are quite a few of similar comments there, and they actually help, because they save us from consulting the GMP manual on every step. But I really meant that stuff like this lacks a comment: hz = make_integer_mpz (); mpz_swap (mpz[0], *iticks); ticks = make_integer_mpz (); And also functions like timespec_ticks, lisp_time_hz_ticks, and lisp_time_seconds, which don't have a single comment describing how they do their thing. Following that code with the purpose of tracking some specific result is not for the faint at heart. I think adding a comment here and there might make that easier. > > + (when (numberp time) > > + (setq time (timer-relative-time nil time)) > > + (or (consp time) > > + (setq time (time-convert time 'list)))) > > This would catch some problems but not all, as the real bug here is in the code > (or (consp time) (error "Invalid time format")) which occurs a few lines later. > As near as I can tell this later code is both wrong and unnecessary. It's wrong > because it's no longer true that only conses are time values. It's unnecessary > because the immediately following (timer-set-function timer function args) call > checks the validity of TIME. On the off chance that a validity check is still > helpful (because we don't want to create garbage?) I installed the attached > patch. Thanks. > But it might be better in master to remove the "Invalid time format" > check entirely. I'm fine with removing that test, if we are sure that invoking run-at-time with something utterly un-timely, like a symbol or a a string that cannot be a valid time description, will trigger an error (presumably from timer-set-time). From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 08 04:41:19 2020 Received: (at 39944) by debbugs.gnu.org; 8 Mar 2020 08:41:19 +0000 Received: from localhost ([127.0.0.1]:47867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jArUs-0006jh-ON for submit@debbugs.gnu.org; Sun, 08 Mar 2020 04:41:18 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:60320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jArUq-0006jP-7k for 39944@debbugs.gnu.org; Sun, 08 Mar 2020 04:41:16 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E41CD16009E; Sun, 8 Mar 2020 00:41:06 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id AwakKcWxyrak; Sun, 8 Mar 2020 00:41:06 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 229CD1600AF; Sun, 8 Mar 2020 00:41:06 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ngIhS-u1XOt9; Sun, 8 Mar 2020 00:41:06 -0800 (PST) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id DF9FC16009E; Sun, 8 Mar 2020 00:41:05 -0800 (PST) Subject: Re: bug#39944: 27.0.90; JIT Stealth timer errors From: Paul Eggert To: Eli Zaretskii References: <83a74tiyyd.fsf@gnu.org> <837dzxiyr8.fsf@gnu.org> <835zfhiyag.fsf@gnu.org> <83h7z1bh0d.fsf@gnu.org> Organization: UCLA Computer Science Department Message-ID: <05a3b1d0-193a-02e5-0d38-9586767f3655@cs.ucla.edu> Date: Sun, 8 Mar 2020 00:41:05 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39944 Cc: 39944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> Although comments in that area no doubt could use improvement, I'd rather not >> see comments like this: >> >> /* Add TM_YEAR_BASE to mpz[0]. */ >> mpz_add_ui (mpz[0], mpz[0], TM_YEAR_BASE); > > There are quite a few of similar comments there, I don't see any similar comments for simple calls from Emacs to mpz_add_ui. And I doubt whether there should be, any more than image.c should have comments like this: /* Use components from GC to draw a line on DPY's PIXMAP from (X, Y) to (X+WIDTH-1, Y+HEIGHT-1). */ XDrawLine (dpy, pixmap, gc, x, y, x + width - 1, y + height - 1); Emacs does not do comments like that, because they would clutter the code if you already know what XDrawLine does; and if you don't know, it's easy enough to look it up - which you should do anyway, and you'll need to do it anyway if you want to understand commentary like "components from GC" and "DPY's PIXMAP". Similarly for nearly every library function Emacs calls. GMP should be no different from other libraries in this respect. > But I really meant that stuff like this lacks a comment: > > hz = make_integer_mpz (); > mpz_swap (mpz[0], *iticks); > ticks = make_integer_mpz (); > > And also functions like timespec_ticks, lisp_time_hz_ticks, and > lisp_time_seconds, which don't have a single comment describing how > they do their thing. I added a few comments here and there. But I didn't go down to the level of commenting every call. >> But it might be better in master to remove the "Invalid time format" >> check entirely. > > I'm fine with removing that test, if we are sure that invoking > run-at-time with something utterly un-timely, like a symbol or a a > string that cannot be a valid time description, will trigger an error > (presumably from timer-set-time). Yes, that's what happens. I removed the test in master. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 08 11:10:06 2020 Received: (at 39944) by debbugs.gnu.org; 8 Mar 2020 15:10:06 +0000 Received: from localhost ([127.0.0.1]:49168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAxZ7-0005Qe-PX for submit@debbugs.gnu.org; Sun, 08 Mar 2020 11:10:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49097) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jAxZ6-0005Q4-Dd for 39944@debbugs.gnu.org; Sun, 08 Mar 2020 11:10:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jAxZ1-00075Q-BF; Sun, 08 Mar 2020 11:09:59 -0400 Received: from [176.228.60.248] (port=3864 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jAxZ0-0004Ns-LL; Sun, 08 Mar 2020 11:09:59 -0400 Date: Sun, 08 Mar 2020 17:10:01 +0200 Message-Id: <83tv2y992u.fsf@gnu.org> From: Eli Zaretskii To: Paul Eggert In-Reply-To: <05a3b1d0-193a-02e5-0d38-9586767f3655@cs.ucla.edu> (message from Paul Eggert on Sun, 8 Mar 2020 00:41:05 -0800) Subject: Re: bug#39944: 27.0.90; JIT Stealth timer errors References: <83a74tiyyd.fsf@gnu.org> <837dzxiyr8.fsf@gnu.org> <835zfhiyag.fsf@gnu.org> <83h7z1bh0d.fsf@gnu.org> <05a3b1d0-193a-02e5-0d38-9586767f3655@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39944 Cc: 39944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > From: Paul Eggert > Cc: 39944@debbugs.gnu.org > Date: Sun, 8 Mar 2020 00:41:05 -0800 > > >> Although comments in that area no doubt could use improvement, I'd rather not > >> see comments like this: > >> > >> /* Add TM_YEAR_BASE to mpz[0]. */ > >> mpz_add_ui (mpz[0], mpz[0], TM_YEAR_BASE); > > > > There are quite a few of similar comments there, > > I don't see any similar comments for simple calls from Emacs to mpz_add_ui. You interpret what I said too literally. I meant these examples: /* The plan is to compute (na * (db/g) + nb * (da/g)) / lcm (da, db) where g = gcd (da, db). Start by computing g. */ mpz_t *g = &mpz[3]; mpz_gcd (*g, *da, *db); /* fa = da/g, fb = db/g. */ mpz_t *fa = &mpz[4], *fb = &mpz[3]; mpz_divexact (*fa, *da, *g); mpz_divexact (*fb, *db, *g); /* ihz = fa * db. This is equal to lcm (da, db). */ mpz_t *ihz = &mpz[0]; mpz_mul (*ihz, *fa, *db); /* iticks = (fb * na) OP (fa * nb), where OP is + or -. */ mpz_t const *na = bignum_integer (iticks, ta.ticks); mpz_mul (*iticks, *fb, *na); mpz_t const *nb = bignum_integer (&mpz[3], tb.ticks); (subtract ? mpz_submul : mpz_addmul) (*iticks, *fa, *nb); Quite helpful, I'd say. > Similarly for nearly every library function Emacs calls. GMP should be no > different from other libraries in this respect. I think it's different, because using it essentially converts infix expressions to a long series of function calls, and thus significantly slows down code reading and makes its comprehension harder. Most other libraries don't force us to issue so many library calls with such high density, in order to do relatively simple calculations. > I added a few comments here and there. But I didn't go down to the level of > commenting every call. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 20 04:33:31 2020 Received: (at 39944) by debbugs.gnu.org; 20 Sep 2020 08:33:31 +0000 Received: from localhost ([127.0.0.1]:48637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJumo-00011g-W5 for submit@debbugs.gnu.org; Sun, 20 Sep 2020 04:33:31 -0400 Received: from quimby.gnus.org ([95.216.78.240]:57348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJumm-00011P-Gx for 39944@debbugs.gnu.org; Sun, 20 Sep 2020 04:33:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JCyX9V8S6lLdZ0YWkRXFBwj9ezO420+6PSOuPqZ+Cg0=; b=X0WErWLiwHxqfCNvd0vGMAWUk0 B4q9kmWm3PWTLP/IWeQB0tFS/Y+wV0r6rX7iAXsGgLjer+nhJKXNvLGYBVvH7nsnpqfjz8TfYhYGz EC/I+GoCgfqpL9iNfm4Bdgudo6fPy5Alr8vteFa+lJ2wyoY6zyIEA58xLlSMezm+ogCg=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJumU-00054N-Tx; Sun, 20 Sep 2020 10:33:21 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#39944: 27.0.90; JIT Stealth timer errors References: <83a74tiyyd.fsf@gnu.org> <837dzxiyr8.fsf@gnu.org> <835zfhiyag.fsf@gnu.org> <83h7z1bh0d.fsf@gnu.org> <05a3b1d0-193a-02e5-0d38-9586767f3655@cs.ucla.edu> <83tv2y992u.fsf@gnu.org> X-Now-Playing: Andrew Poppy's _On Zang Tuum Tumb (1): The Beating Of Wings_: "The Impossible Net" Date: Sun, 20 Sep 2020 10:33:09 +0200 In-Reply-To: <83tv2y992u.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 08 Mar 2020 17:10:01 +0200") Message-ID: <87pn6gu9tm.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: >> I added a few comments here and there. But I didn't go down to the level of >> commenting every call. > > Thanks. It looks like all the actionable items here were taken care of, so I'm closing this bug report. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39944 Cc: Paul Eggert , 39944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> I added a few comments here and there. But I didn't go down to the level of >> commenting every call. > > Thanks. It looks like all the actionable items here were taken care of, so I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 20 04:33:35 2020 Received: (at control) by debbugs.gnu.org; 20 Sep 2020 08:33:35 +0000 Received: from localhost ([127.0.0.1]:48640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJumt-00011w-7w for submit@debbugs.gnu.org; Sun, 20 Sep 2020 04:33:35 -0400 Received: from quimby.gnus.org ([95.216.78.240]:57362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJumr-00011Y-Ju for control@debbugs.gnu.org; Sun, 20 Sep 2020 04:33:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=AaiSGlvjFKdhfOFE0kjJfE+U+SRUjuCU6YYfhg4tdac=; b=OjHmbjj+Mf/IQNzG7hwazoG41f /KVTC+gwC/KI01TueH3n1rJ/WvElZWMNqXK+xb8DbTl4Kv3wd1wJ2Z9gFgtc/vVjEz5YvS7ksDp/V 2TN0LwejDwKZz3Rci8mAu+R69vPZMIbAcrG67mvGeQoWnJM9fXSY7HnVBouBekdYvyng=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJumj-00054U-SJ for control@debbugs.gnu.org; Sun, 20 Sep 2020 10:33:28 +0200 Date: Sun, 20 Sep 2020 10:33:24 +0200 Message-Id: <87o8m0u9t7.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #39944 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 39944 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 39944 quit From unknown Fri Aug 15 12:46:48 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 18 Oct 2020 11:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator