From unknown Thu Jun 19 13:56:14 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#54218 <54218@debbugs.gnu.org> To: bug#54218 <54218@debbugs.gnu.org> Subject: Status: [PATCH] Magic number regexp shouldn't match beyond end-of-line. Reply-To: bug#54218 <54218@debbugs.gnu.org> Date: Thu, 19 Jun 2025 20:56:14 +0000 retitle 54218 [PATCH] Magic number regexp shouldn't match beyond end-of-lin= e. reassign 54218 emacs submitter 54218 "Andrew L. Moore" severity 54218 normal tag 54218 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 01 23:52:57 2022 Received: (at submit) by debbugs.gnu.org; 2 Mar 2022 04:52:57 +0000 Received: from localhost ([127.0.0.1]:38829 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPGyu-00055n-UW for submit@debbugs.gnu.org; Tue, 01 Mar 2022 23:52:57 -0500 Received: from lists.gnu.org ([209.51.188.17]:57048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPGyt-00055g-L4 for submit@debbugs.gnu.org; Tue, 01 Mar 2022 23:52:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPGyt-00052T-Dd for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2022 23:52:55 -0500 Received: from [2607:f8b0:4864:20::732] (port=35537 helo=mail-qk1-x732.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPGyr-00035t-Q5 for bug-gnu-emacs@gnu.org; Tue, 01 Mar 2022 23:52:55 -0500 Received: by mail-qk1-x732.google.com with SMTP id j78so436239qke.2 for ; Tue, 01 Mar 2022 20:52:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:to:content-language:from:cc :subject:content-transfer-encoding; bh=pFuiwXbR1TV61gCGCfEGdmcQwrRiJ6x9HQGlnRpbJys=; b=PCbw4xRT+bYR/a34/YFoxY+kSWsKeZxKaVjD9ThIRPDKU5luDUDyqgapfzPWyp2CU9 qH6UaKAf/iciVvHRSm5yIUg6HZzxUb3kSyJC9jS7iQYlaLH1p8d/oq9OWUBPY2jUCoi+ Izf6PrwkzPexRWJNyM71kfqXlZX/OglpbLT+DAwXgHRPPJOdEm/KR28U41Jn3/lBh4EI OBuja/++EnY6Q2crGeI9MFx8gVC27TQd40sVNDbJgDGJy2aRxU1MwQTxGFI3DwDCS2XJ IMWl08CEc/BUiJghOex8y/dsS33xaLp/QOXdWNriCUAIlVTK4b0+ArvZj/PpVa69+aii BPEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:to :content-language:from:cc:subject:content-transfer-encoding; bh=pFuiwXbR1TV61gCGCfEGdmcQwrRiJ6x9HQGlnRpbJys=; b=YKdkWfS4ulRlKP/Pa0QJE9bTOKwXFm398pxFLRrgiQ7k4oXAc2JYVkWiz6W8lKc+WW amDswaCg95fq4vFZGSSNCr1M0mUcHRDc39/b+kbP885Q032x710SICtTHShfH+54YdQ6 bKaDL0HCVTIXMsys4vk/Udf40/D4VjMELmeENR3Y47kr9rgPHFolE9yXuKMsI2bOUUL6 pGVVIgdStZ1u0KfXWE0yyFb2FBthDQRzzjPmV2lCQBbkZhavPZBGrk6rQIFOwp8E79AU aGVPpUIOmbfuVzMG9/wy+RI3ppbJF0EunSbwYiTcyWNX8M9QQDvUcISf9fNB61wS+UZb WCrQ== X-Gm-Message-State: AOAM532pMgzGehba0eilG0LrI4kfmIsdJGabuiBBsFN0oL3048knlj1U 4kd822LE1upha6l0RITmONiX+991BI4= X-Google-Smtp-Source: ABdhPJwJhobnwUJmCKxrgFqey7hCCtwonRkyTMvui8HdozgEuNFwFlcrL8TPsCd7SbYWYeuG7Y+xsg== X-Received: by 2002:a37:e214:0:b0:637:f295:cde8 with SMTP id g20-20020a37e214000000b00637f295cde8mr14844538qki.753.1646196772370; Tue, 01 Mar 2022 20:52:52 -0800 (PST) Received: from [192.168.0.173] (c-24-125-236-19.hsd1.ga.comcast.net. [24.125.236.19]) by smtp.gmail.com with ESMTPSA id s25-20020a05620a031900b006493cefc496sm7566324qkm.127.2022.03.01.20.52.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Mar 2022 20:52:52 -0800 (PST) Message-ID: <1453034b-77c7-4c25-7f6e-0ba14090cf12@gmail.com> Date: Tue, 1 Mar 2022 23:52:50 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 To: bug-gnu-emacs@gnu.org Content-Language: en-US From: "Andrew L. Moore" Subject: [PATCH] Magic number regexp shouldn't match beyond end-of-line. Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::732 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::732; envelope-from=slewsys@gmail.com; helo=mail-qk1-x732.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: "Andrew L. Moore" 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: -2.3 (--) Repeat magic number search to work around match-data loss when `save-window-excursion' is called. --- lisp/progmodes/executable.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el index d7c093444e..9116bdea9d 100644 --- a/lisp/progmodes/executable.el +++ b/lisp/progmodes/executable.el @@ -232,7 +232,8 @@ executable-set-magic (save-excursion (goto-char (point-min)) (add-hook 'after-save-hook 'executable-chmod nil t) - (if (looking-at "#![ \t]*\\(.*\\)$") + ;; Regexp shouldn't match beyond end-of-line. + (if (looking-at "#![ \t]*\\([^\n]*\\)$") (and (goto-char (match-beginning 1)) ;; If the line ends in a space, ;; don't offer to change it. @@ -247,8 +248,13 @@ executable-set-magic "Replace magic number by `#!%s'? " argument)))) (progn - (replace-match argument t t nil 1) - (message "Magic number changed to `#!%s'" argument)))) + ;; Repeat search to work around match-data loss + ;; from call to `save-window-excursion' above. + (goto-char (point-min)) + (if (looking-at "^#![ \t]*\\([^\n]*\\)$") + (progn + (replace-match argument t t nil 1) + (message "Magic number changed to `#!%s'" argument)))))) (insert "#!" argument ?\n) (message "Magic number changed to `#!%s'" argument)))) interpreter) -- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 02 03:23:59 2022 Received: (at 54218) by debbugs.gnu.org; 2 Mar 2022 08:23:59 +0000 Received: from localhost ([127.0.0.1]:39054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPKH9-0004pF-Ci for submit@debbugs.gnu.org; Wed, 02 Mar 2022 03:23:59 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:57394) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPKH8-0004p7-CC for 54218@debbugs.gnu.org; Wed, 02 Mar 2022 03:23:59 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4K7nFn0M5xz1qyJl; Wed, 2 Mar 2022 09:23:56 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4K7nFm5wf7z1qqkB; Wed, 2 Mar 2022 09:23:56 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id qySAl6R8gLmf; Wed, 2 Mar 2022 09:23:56 +0100 (CET) X-Auth-Info: ffjKU0R3LCilPF4TJWxrz1piyr7Luu4/9GsTSb1rdpr0xHebGZjqn3vzMTqxVCPJ Received: from igel.home (ppp-46-244-168-47.dynamic.mnet-online.de [46.244.168.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 2 Mar 2022 09:23:56 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 95E682C3062; Wed, 2 Mar 2022 09:23:55 +0100 (CET) From: Andreas Schwab To: "Andrew L. Moore" Subject: Re: bug#54218: [PATCH] Magic number regexp shouldn't match beyond end-of-line. References: <1453034b-77c7-4c25-7f6e-0ba14090cf12@gmail.com> X-Yow: I'll take ROAST BEEF if you're out of LAMB!! Date: Wed, 02 Mar 2022 09:23:55 +0100 In-Reply-To: <1453034b-77c7-4c25-7f6e-0ba14090cf12@gmail.com> (Andrew L. Moore's message of "Tue, 1 Mar 2022 23:52:50 -0500") Message-ID: <87a6e8sqxw.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 54218 Cc: 54218@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.5 (-) On Mär 01 2022, Andrew L. Moore wrote: > diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el > index d7c093444e..9116bdea9d 100644 > --- a/lisp/progmodes/executable.el > +++ b/lisp/progmodes/executable.el > @@ -232,7 +232,8 @@ executable-set-magic > (save-excursion > (goto-char (point-min)) > (add-hook 'after-save-hook 'executable-chmod nil t) > - (if (looking-at "#![ \t]*\\(.*\\)$") > + ;; Regexp shouldn't match beyond end-of-line. > + (if (looking-at "#![ \t]*\\([^\n]*\\)$") In Emacs regexps, `.' doesn't match newlines. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 03 09:42:54 2022 Received: (at 54218) by debbugs.gnu.org; 3 Mar 2022 14:42:54 +0000 Received: from localhost ([127.0.0.1]:42017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPmfO-000820-3b for submit@debbugs.gnu.org; Thu, 03 Mar 2022 09:42:54 -0500 Received: from quimby.gnus.org ([95.216.78.240]:42032) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPmfM-00081j-7T for 54218@debbugs.gnu.org; Thu, 03 Mar 2022 09:42:52 -0500 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=8pNQjaUgtng/dxiBkU6SOUggVzQsc5lG/6AoWL0Vu7U=; b=tVj7bbAqs5ObnUI3vbYFObpSWf +vEtDEHDSKcNuTRgsN0VO53t52jzK96mPre1aMZAtq+pij5V8rTeuVfcysQa1R87B2/TW6hyalR1k 4HMLiBmP/SWJKCLc2vU4v8+KkxY/H8loP2Q4s8BNuorlgEWZhn/3qdjoFWMC369oHRkM=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nPmfD-0000yZ-Oy; Thu, 03 Mar 2022 15:42:45 +0100 From: Lars Ingebrigtsen To: "Andrew L. Moore" Subject: Re: bug#54218: [PATCH] Magic number regexp shouldn't match beyond end-of-line. References: <1453034b-77c7-4c25-7f6e-0ba14090cf12@gmail.com> X-Now-Playing: Twinkle3's _Minor Planets_: "Kalliope 22" Date: Thu, 03 Mar 2022 15:42:43 +0100 In-Reply-To: <1453034b-77c7-4c25-7f6e-0ba14090cf12@gmail.com> (Andrew L. Moore's message of "Tue, 1 Mar 2022 23:52:50 -0500") Message-ID: <87ilsvhzbw.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.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: "Andrew L. Moore" writes: > Repeat magic number search to work around match-data loss > when `save-window-excursion' is called. I think it would perhaps make more sense to just save the match data instead of repeating the match, so I've now done so in Emacs 29 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: -2.3 (--) X-Debbugs-Envelope-To: 54218 Cc: 54218@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 (---) "Andrew L. Moore" writes: > Repeat magic number search to work around match-data loss > when `save-window-excursion' is called. I think it would perhaps make more sense to just save the match data instead of repeating the match, so I've now done so in Emacs 29 -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 03 09:42:58 2022 Received: (at control) by debbugs.gnu.org; 3 Mar 2022 14:42:58 +0000 Received: from localhost ([127.0.0.1]:42020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPmfS-00082J-9h for submit@debbugs.gnu.org; Thu, 03 Mar 2022 09:42:58 -0500 Received: from quimby.gnus.org ([95.216.78.240]:42046) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPmfQ-00081s-U8 for control@debbugs.gnu.org; Thu, 03 Mar 2022 09:42:57 -0500 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=uHWI9sJ2J3Tz4Dvgnv5yLZNcsPHg47DXd3MXWkaEwBs=; b=X/RS3soqrrYKuD4z+h+Mj7RaB+ wZ5hHjnOsS5QBNXhSwjAfmzXNsu/LJRM+7SMtJek5JFHiP0q+Pp+62SrVx6pkgIq4F/fDGISxRssL gmEvA83eDLwEYyJs2RzefN/HFJoeYWrhVL9xXmrbKIsS2DHPTVN1hEXETZC9NwKkaaWk=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nPmfJ-0000yh-6I for control@debbugs.gnu.org; Thu, 03 Mar 2022 15:42:51 +0100 Date: Thu, 03 Mar 2022 15:42:48 +0100 Message-Id: <87h78fhzbr.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #54218 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 54218 29.1 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: -2.3 (--) 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: -3.3 (---) close 54218 29.1 quit From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 03 14:57:15 2022 Received: (at 54218) by debbugs.gnu.org; 3 Mar 2022 19:57:15 +0000 Received: from localhost ([127.0.0.1]:43828 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPrZb-00009X-F3 for submit@debbugs.gnu.org; Thu, 03 Mar 2022 14:57:15 -0500 Received: from mail-qt1-f174.google.com ([209.85.160.174]:35379) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPrZZ-00009I-DN for 54218@debbugs.gnu.org; Thu, 03 Mar 2022 14:57:13 -0500 Received: by mail-qt1-f174.google.com with SMTP id w1so5604071qtj.2 for <54218@debbugs.gnu.org>; Thu, 03 Mar 2022 11:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=wiSxHwC+ifEkEloLwLyYJGeQW8XoWK+V3rXo4UoOzzw=; b=S4kJJ2+MxzFyGTzwFuFv1NaPI+3ZfdCZglPVnlIO0RxXjxwnCk7mwSBSaG5+bLR3Bs ST9aaFcmMXmPhGyoBoa6kRJnSkJ6NzCW1d9ZctH1DNvu09VZRDVj+2iGF7n4NOSmlwGe ijiUqlyIh3gOxvBWqNIWUuqqSShWyJmzKoKCG5z0dTgoVJ4agUjWFZfUBgHKKiQtZ6t1 P0GgJT4Mkqlxb5h3IGpZxoUZqoct6yS02FlbnsRe6ZuT/YG7B4iGnHy/mPqJtqiul3c7 VkhDTWPg6TotE9tbq9m1stkUHTZOiWRlSonMBfANac3oCQ3/QcujgEXlyt97Rwm1PhCz IYTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=wiSxHwC+ifEkEloLwLyYJGeQW8XoWK+V3rXo4UoOzzw=; b=rwCxTzKtz/AqVjsutwoQyz626L3jIDfWAmenNMU4CxEU3A5j2jT7TuCeD5lI0xN6yu USGIwfaYFwN2+0IQU/oMbQD1Aes8lAJPzrG1yih0tGbScSFfi5ZePIsg2uRC663UNqbo dFZ5GaM+iLSoaiYjuXJe/VBJJ240ROekUTNiy88WbM+qHfcWZXIGjHCKVY9VwM1RMhXv oRCnfM8zCz/eBoFuGFbssg+lvlL4bAN4ynYWabPnmHcjte8OlPxIsfC2oy3Xocz1WZ6e K1WCdUyuhPspBO2KyZQXaZ+0MI55hdJzDq1BGrrw66s8Zy9nQwhU46tMd4K4bac6Oy1Y PK2A== X-Gm-Message-State: AOAM531As9HkJgGw0L1FZfJUweQ0a+9390luGnvmb/9NFJCht9hH1G9K jZTRYpCzUSI1dFY6BXMqrvJshm5YwoM= X-Google-Smtp-Source: ABdhPJxQ5r1WhqKkavlR9HJll8kh4WhmmBnB6rvcPMTQFah+WdbmdclpoaXQGSAgAxA3zlIDlzhEgg== X-Received: by 2002:ac8:5b04:0:b0:2dd:2600:2f1 with SMTP id m4-20020ac85b04000000b002dd260002f1mr28040339qtw.364.1646337427849; Thu, 03 Mar 2022 11:57:07 -0800 (PST) Received: from [192.168.0.173] (c-24-125-236-19.hsd1.ga.comcast.net. [24.125.236.19]) by smtp.gmail.com with ESMTPSA id z16-20020a05622a061000b002ddcbdb3ee0sm2174340qta.60.2022.03.03.11.57.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Mar 2022 11:57:07 -0800 (PST) Message-ID: <7e9735e1-308a-237b-0466-f702a4e94a59@gmail.com> Date: Thu, 3 Mar 2022 14:57:06 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: bug#54218: [PATCH] Magic number regexp shouldn't match beyond end-of-line. Content-Language: en-US To: Lars Ingebrigtsen References: <1453034b-77c7-4c25-7f6e-0ba14090cf12@gmail.com> <87ilsvhzbw.fsf@gnus.org> From: "Andrew L. Moore" In-Reply-To: <87ilsvhzbw.fsf@gnus.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 54218 Cc: 54218@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 (-) On 3/3/22 09:42, Lars Ingebrigtsen wrote: > "Andrew L. Moore" writes: > >> Repeat magic number search to work around match-data loss >> when `save-window-excursion' is called. > > I think it would perhaps make more sense to just save the match data > instead of repeating the match, so I've now done so in Emacs 29 Yes, this resolves the issues that I was seeing. For the record, I'm not able to reproduce the data loss with vanilla Emacs by calling `executable-set-magic' manually. It occurs (for me) when `executable-set-magic' is called automatically from a minor mode. In any case, your patch fixes my minor mode and does no harm. The other issue that I attributed to the regexp matching beyond EOL was caused by `replace-match' being called by incorrect or uninitialized match data. Your patch resolves this as well. Thank you! From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 04 10:37:53 2022 Received: (at 54218) by debbugs.gnu.org; 4 Mar 2022 15:37:53 +0000 Received: from localhost ([127.0.0.1]:46667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQA08-0005HE-Uq for submit@debbugs.gnu.org; Fri, 04 Mar 2022 10:37:53 -0500 Received: from quimby.gnus.org ([95.216.78.240]:54226) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQA07-0005H2-Sk for 54218@debbugs.gnu.org; Fri, 04 Mar 2022 10:37:52 -0500 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=PzMm+ADJm/xaCF3XVlkz+d2Xkj3Ofc8URaoCFFDKUK8=; b=JgVokubAnOwqcygmlyfgVVxsX4 2EUrB0qjHZUFxx8VIaOpyPwItQh1REowcP+9cOpAeok49NJYgudcfdVgG1ref+vWJBFlTKjOzDkIZ QmGId/9cVlAbA9me8hsRMMo6Leb5Q15UgaiLjEJRMNLmUAeH+/sorNwAeJ3/Rsuy1xWY=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nQ9zz-0005xs-Uf; Fri, 04 Mar 2022 16:37:46 +0100 From: Lars Ingebrigtsen To: "Andrew L. Moore" Subject: Re: bug#54218: [PATCH] Magic number regexp shouldn't match beyond end-of-line. References: <1453034b-77c7-4c25-7f6e-0ba14090cf12@gmail.com> <87ilsvhzbw.fsf@gnus.org> <7e9735e1-308a-237b-0466-f702a4e94a59@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEUuKCedNzTFTTuo SDfOVDRhMi7hnlv///+Kn9dZAAAAAWJLR0QHFmGI6wAAAAd0SU1FB+YDBA8OLRQLiX4AAAGlSURB VDjLfdLLcqswDAZgdzrsYxy6x3bZgyj7Ujfr6OQo+w6p3/8RKttcymXqTWb4Isn6QYhfJwfQfFw4 Yg/uEBrrRqCMrhOoS9tDO4KU+nWuuDzO7+cRtHXlDNV39j5VcM9igX6YW+XOvS3QeWWnW6Hrp+m5 ffE4gyC5wL2lBYQ6sUbQXTZDwb0W4J9peCmtO9E1gSGiCTgda2QRxyi4+K829RIq5FmmVW5Q0ccE 4bkeV7yZyltu1ccFA5woQdP5gQt6G0LUmkckQIYwI4EqJZrUC3UHcLZ8nRh7QahTXGhAZOf0dgUS Ya5T8gj8h/8BbIgkQ9DmOgLRv1+gdF9f43DtfTMDMVj3GWeo4f4RN1vgFKEZYIhgYyveJV4Laxi+ +rlCZCTHBWtjHnGG1qsPDusaQB2BlG8KOaMtZCEG0WjTbOAJwobp017BMyjw3pgDKMHfh33FLa9r 7x8QZA0qQMXQbK6rpOqq1oSSFRAyaNgDvxBoXl4x9NqAAuCPkQHWICWoQqodcCR1enwE8rCC8/0D omyAIsgDSCX1FrAYS9QecGz2A3DAhqrFV2S3AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTAzLTA0 VDE1OjE0OjQ1KzAwOjAwy5xp3gAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wMy0wNFQxNToxNDo0 NSswMDowMLrB0WIAAAAASUVORK5CYII= X-Now-Playing: F-I and Boy Dirt Car's _Third Noise Principle (Formative North American Electronica 1975-1984) (4)_: "Untitled" Date: Fri, 04 Mar 2022 16:37:43 +0100 In-Reply-To: <7e9735e1-308a-237b-0466-f702a4e94a59@gmail.com> (Andrew L. Moore's message of "Thu, 3 Mar 2022 14:57:06 -0500") Message-ID: <87tucdenjs.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.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: "Andrew L. Moore" writes: > The other issue that I attributed to the regexp matching beyond > EOL was caused by `replace-match' being called by incorrect or > uninitialized match data. Your patch resolves this as well. 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: -2.3 (--) X-Debbugs-Envelope-To: 54218 Cc: 54218@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 (---) "Andrew L. Moore" writes: > The other issue that I attributed to the regexp matching beyond > EOL was caused by `replace-match' being called by incorrect or > uninitialized match data. Your patch resolves this as well. Thanks for checking. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Thu Jun 19 13:56:14 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 02 Apr 2022 11:24:03 +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