From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#55628: debug-timer-check fails on macOS 11.6.6 Date: Mon, 30 May 2022 12:43:48 +0200 Message-ID: <98860231-7C5C-433E-8704-24E4BDF860A9@acm.org> References: <87sfoxdcso.fsf@gnus.org> <015331C8-C4AF-49DB-A859-BE01012B77BF@acm.org> <87D17F2F-BA51-45E3-BD81-A8CF9044C3BE@acm.org> <83sfoxpmff.fsf@gnu.org> <837d68plsk.fsf@gnu.org> <2508D80D-E65A-4407-A09C-8E1A2E8E80AF@acm.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_6A171A20-867E-4DC8-96DF-ED39201CD774" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36856"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55628@debbugs.gnu.org, Lars Ingebrigtsen To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 30 12:46:21 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nvcuj-0009PQ-K7 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 May 2022 12:46:21 +0200 Original-Received: from localhost ([::1]:51498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nvcui-0007kp-3a for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 May 2022 06:46:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvctT-0007jP-80 for bug-gnu-emacs@gnu.org; Mon, 30 May 2022 06:45:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nvctS-0007ds-VB for bug-gnu-emacs@gnu.org; Mon, 30 May 2022 06:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nvctS-000066-Ov for bug-gnu-emacs@gnu.org; Mon, 30 May 2022 06:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 May 2022 10:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55628 X-GNU-PR-Package: emacs Original-Received: via spool by 55628-submit@debbugs.gnu.org id=B55628.165390745832752 (code B ref 55628); Mon, 30 May 2022 10:45:02 +0000 Original-Received: (at 55628) by debbugs.gnu.org; 30 May 2022 10:44:18 +0000 Original-Received: from localhost ([127.0.0.1]:42875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nvcsV-0008Vw-QG for submit@debbugs.gnu.org; Mon, 30 May 2022 06:44:18 -0400 Original-Received: from mail1454c50.megamailservers.eu ([91.136.14.54]:52046 helo=mail266c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nvcsQ-0008VG-3t for 55628@debbugs.gnu.org; Mon, 30 May 2022 06:44:02 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1653907431; bh=+63EsicEU9e2SBQwlKuoRNdIkLSMkMCTuRVOJB2zx44=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=gf0lO40khJUtyCpyODvks86ZXNTcG7YN9oeTLHRSryjgIQnbWYxrneyTOJoYIoJel XkPXZW91w/YtwoQhNekmkzoZDPgdNqHivV67MggRRrMJrspvtz5IT9QSf2gczkLvBf EYbys+jMQVNEcLTk8oqNNkmzeE1mhmgete0TsIQI= Feedback-ID: mattiase@acm.or Original-Received: from smtpclient.apple (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail266c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 24UAhmOr028170; Mon, 30 May 2022 10:43:50 +0000 In-Reply-To: <2508D80D-E65A-4407-A09C-8E1A2E8E80AF@acm.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-CTCH-RefID: str=0001.0A742F25.62949FE7.0019, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-Origin-Country: SE X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:233364 Archived-At: --Apple-Mail=_6A171A20-867E-4DC8-96DF-ED39201CD774 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Attached is the final patch (just the two previously combined with a = commit message). Would someone please double-check that it works on a platform other than = macOS before I push it? --Apple-Mail=_6A171A20-867E-4DC8-96DF-ED39201CD774 Content-Disposition: attachment; filename=0001-Fix-atimer-setting-and-overdue-expiration-bug-55628.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Fix-atimer-setting-and-overdue-expiration-bug-55628.patch" Content-Transfer-Encoding: quoted-printable =46rom=20671716186fc6d2506d06e85485faad405a365e6a=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=2030=20May=202022=2012:25:19=20+0200=0A= Subject:=20[PATCH]=20Fix=20atimer=20setting=20and=20overdue=20expiration=20= (bug#55628)=0A=0A*=20src/atimer.c=20(set_alarm):=20If=20the=20atimer=20= has=20already=20expired,=20signal=0Ait=20right=20away=20instead=20of=20= postponing=20it=20further.=20=20Previously=20this=20could=0Aoccur=20= repeatedly,=20blocking=20atimers=20indefinitely.=0AAlso=20only=20use=20= `alarm`=20as=20fallback=20if=20`setitimer`=20is=20unavailable,=20not=0A= both=20at=20the=20same=20time=20(which=20makes=20no=20sense,=20and=20= they=20both=20typically=0Ause=20the=20same=20mechanism=20behind=20the=20= curtains).=0A=0A*=20test/src/eval-tests.el=20= (eval-tests/funcall-with-delayed-message):=0ANew=20test,=20verifying=20= proper=20functioning=20of=20funcall-with-delayed-message=0Awhich=20also=20= serves=20as=20test=20for=20this=20bug=20(which=20also=20caused=0A= debug-timer-check=20to=20fail,=20but=20that=20test=20is=20only=20run=20= when=20Emacs=20is=0Abuilt=20with=20enable-checking).=0A---=0A=20= src/atimer.c=20=20=20=20=20=20=20=20=20=20=20|=2033=20= ++++++++++++++++-----------------=0A=20test/src/eval-tests.el=20|=2027=20= +++++++++++++++++++++++++++=0A=202=20files=20changed,=2043=20= insertions(+),=2017=20deletions(-)=0A=0Adiff=20--git=20a/src/atimer.c=20= b/src/atimer.c=0Aindex=201c6c881fc0..c26904e1f0=20100644=0A---=20= a/src/atimer.c=0A+++=20b/src/atimer.c=0A@@=20-297,11=20+297,6=20@@=20= set_alarm=20(void)=0A=20{=0A=20=20=20if=20(atimers)=0A=20=20=20=20=20{=0A= -#ifdef=20HAVE_SETITIMER=0A-=20=20=20=20=20=20struct=20itimerval=20it;=0A= -#endif=0A-=20=20=20=20=20=20struct=20timespec=20now,=20interval;=0A-=0A=20= #ifdef=20HAVE_ITIMERSPEC=0A=20=20=20=20=20=20=20if=20(0=20<=3D=20timerfd=20= ||=20alarm_timer_ok)=0A=20=09{=0A@@=20-337,20=20+332,24=20@@=20set_alarm=20= (void)=0A=20=09}=0A=20#endif=0A=20=0A-=20=20=20=20=20=20/*=20Determine=20= interval=20till=20the=20next=20timer=20is=20ripe.=0A-=09=20Don't=20set=20= the=20interval=20to=200;=20this=20disables=20the=20timer.=20=20*/=0A-=20=20= =20=20=20=20now=20=3D=20current_timespec=20();=0A-=20=20=20=20=20=20= interval=20=3D=20(timespec_cmp=20(atimers->expiration,=20now)=20<=3D=200=0A= -=09=09=20=20?=20make_timespec=20(0,=201000=20*=201000)=0A-=09=09=20=20:=20= timespec_sub=20(atimers->expiration,=20now));=0A+=20=20=20=20=20=20/*=20= Determine=20interval=20till=20the=20next=20timer=20is=20ripe.=20=20*/=0A= +=20=20=20=20=20=20struct=20timespec=20now=20=3D=20current_timespec=20= ();=0A+=20=20=20=20=20=20if=20(timespec_cmp=20(atimers->expiration,=20= now)=20<=3D=200)=0A+=09{=0A+=09=20=20/*=20Timer=20is=20(over)due=20--=20= just=20trigger=20the=20signal=20right=20way.=20=20*/=0A+=09=20=20raise=20= (SIGALRM);=0A+=09}=0A+=20=20=20=20=20=20else=0A+=09{=0A+=09=20=20struct=20= timespec=20interval=20=3D=20timespec_sub=20(atimers->expiration,=20now);=0A= =20=0A=20#ifdef=20HAVE_SETITIMER=0A-=0A-=20=20=20=20=20=20memset=20(&it,=20= 0,=20sizeof=20it);=0A-=20=20=20=20=20=20it.it_value=20=3D=20make_timeval=20= (interval);=0A-=20=20=20=20=20=20setitimer=20(ITIMER_REAL,=20&it,=200);=0A= -#endif=20/*=20not=20HAVE_SETITIMER=20*/=0A-=20=20=20=20=20=20alarm=20= (max=20(interval.tv_sec,=201));=0A+=09=20=20struct=20itimerval=20it=20=3D=20= {.it_value=20=3D=20make_timeval=20(interval)};=0A+=09=20=20setitimer=20= (ITIMER_REAL,=20&it,=200);=0A+#else=0A+=09=20=20alarm=20(max=20= (interval.tv_sec,=201));=0A+#endif=0A+=09}=0A=20=20=20=20=20}=0A=20}=0A=20= =0Adiff=20--git=20a/test/src/eval-tests.el=20b/test/src/eval-tests.el=0A= index=20e4230c10ef..1b2ad99360=20100644=0A---=20a/test/src/eval-tests.el=0A= +++=20b/test/src/eval-tests.el=0A@@=20-240,4=20+240,31=20@@=20= eval-tests/backtrace-in-batch-mode/demoted-errors=0A=20=20=20=20=20=20=20= (should=20(equal=20(string-trim=20(buffer-string))=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"Error:=20(error=20= \"Boo\")")))))=0A=20=0A+(ert-deftest=20= eval-tests/funcall-with-delayed-message=20()=0A+=20=20;;=20Check=20that=20= `funcall-with-delayed-message'=20displays=20its=20message=20before=0A+=20= =20;;=20its=20function=20terminates=20iff=20the=20timeout=20is=20short=20= enough.=0A+=0A+=20=20;;=20This=20also=20serves=20as=20regression=20test=20= for=20bug#55628=20where=20a=20short=0A+=20=20;;=20timeout=20was=20= rounded=20up=20to=20the=20next=20whole=20second.=0A+=20=20(dolist=20= (params=20'((0.8=200.4)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(0.1=200.8)))=0A+=20=20=20=20(let=20((timeout=20(nth=200=20= params))=0A+=20=20=20=20=20=20=20=20=20=20(work-time=20(nth=201=20= params)))=0A+=20=20=20=20=20=20(ert-info=20((prin1-to-string=20params)=20= :prefix=20"params:=20")=0A+=20=20=20=20=20=20=20=20(with-current-buffer=20= "*Messages*"=0A+=20=20=20=20=20=20=20=20=20=20(let=20((inhibit-read-only=20= t))=0A+=20=20=20=20=20=20=20=20=20=20=20=20(erase-buffer))=0A+=20=20=20=20= =20=20=20=20=20=20(let=20((stop=20(+=20(float-time)=20work-time)))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20(funcall-with-delayed-message=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20timeout=20"timed=20out"=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20(lambda=20()=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(while=20(<=20(float-time)=20stop))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(message=20"finished"))))=0A+=20=20=20=20=20=20=20=20=20= =20(let=20((expected-messages=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(if=20(<=20timeout=20work-time)=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20"timed=20out\nfinished"=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20"finished")))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20(should=20(equal=20(string-trim=20(buffer-string))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20expected-messages))))))))=0A+=0A=20;;;=20eval-tests.el=20ends=20= here=0A--=20=0A2.32.0=20(Apple=20Git-132)=0A=0A= --Apple-Mail=_6A171A20-867E-4DC8-96DF-ED39201CD774--