From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Andrew L. Moore" Newsgroups: gmane.emacs.bugs Subject: bug#54218: [PATCH] Magic number regexp shouldn't match beyond end-of-line. Date: Thu, 3 Mar 2022 14:57:06 -0500 Message-ID: <7e9735e1-308a-237b-0466-f702a4e94a59@gmail.com> References: <1453034b-77c7-4c25-7f6e-0ba14090cf12@gmail.com> <87ilsvhzbw.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30964"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Cc: 54218@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 03 20:58:13 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 1nPraW-0007te-UE for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Mar 2022 20:58:12 +0100 Original-Received: from localhost ([::1]:50580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPraV-0006cB-TM for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Mar 2022 14:58:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPraM-0006XL-Dp for bug-gnu-emacs@gnu.org; Thu, 03 Mar 2022 14:58:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49931) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPraM-0007lJ-47 for bug-gnu-emacs@gnu.org; Thu, 03 Mar 2022 14:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nPraL-0000Al-Tz for bug-gnu-emacs@gnu.org; Thu, 03 Mar 2022 14:58:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Andrew L. Moore" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Mar 2022 19:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 54218-submit@debbugs.gnu.org id=B54218.1646337435596 (code B ref 54218); Thu, 03 Mar 2022 19:58:01 +0000 Original-Received: (at 54218) by debbugs.gnu.org; 3 Mar 2022 19:57:15 +0000 Original-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 Original-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 Original-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) Original-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) Content-Language: en-US In-Reply-To: <87ilsvhzbw.fsf@gnus.org> 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:227973 Archived-At: 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!