From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#41445: 26.3; Query-replace triggers "match data clobbered by..." Date: Sat, 23 May 2020 14:37:17 +0200 Message-ID: References: <83367s4427.fsf@gnu.org> <370FA0D9-1EF2-4EC4-977C-C20106CF222D@acm.org> <83wo542mwz.fsf@gnu.org> <76CFF420-CB1C-464A-A67C-22D813C00EB8@acm.org> <83tv06zvgl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="19228"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , ture@turepalsson.se, Stefan Monnier , 41445@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 23 14:38:29 2020 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 1jcTQ4-0004tv-MP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 May 2020 14:38:28 +0200 Original-Received: from localhost ([::1]:57012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcTQ3-000692-Hj for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 May 2020 08:38:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcTPf-00066g-B2 for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 08:38:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50319) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jcTPf-0006vn-1m for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 08:38:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jcTPe-0005Bw-VY for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 08:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 May 2020 12:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41445 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 41445-submit@debbugs.gnu.org id=B41445.159023745619907 (code B ref 41445); Sat, 23 May 2020 12:38:02 +0000 Original-Received: (at 41445) by debbugs.gnu.org; 23 May 2020 12:37:36 +0000 Original-Received: from localhost ([127.0.0.1]:33630 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcTPE-0005B1-KM for submit@debbugs.gnu.org; Sat, 23 May 2020 08:37:36 -0400 Original-Received: from mail-oo1-f67.google.com ([209.85.161.67]:41030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcTPD-0005Ao-9H for 41445@debbugs.gnu.org; Sat, 23 May 2020 08:37:35 -0400 Original-Received: by mail-oo1-f67.google.com with SMTP id z26so2712174oog.8 for <41445@debbugs.gnu.org>; Sat, 23 May 2020 05:37:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ISb2KRGBD2EQbNlQtNj9s1Qsgg4Y7Rh0l9kA+nuLh3w=; b=IDA+/Tr02Syods97aUICl2jIVYMT994J5r4X0DOQ0j+1OIwKmlAF75LAv23VmU2n8D eh01yMmd5CJBUDWG1u2qNofr/VjIToZiXoQW5lC96YhgCQRFrFKIrrqvFnyyL4WBQuAl tq4uOMigawbiB03ldOqfH26WYdtU5CgtKcYmTkD6AmDJkKpd9OgtLTdi651dy5/YrKo4 f5veyzTmOlU/tnEM9ZAXV1fwy0hIQ9gHwgHlmumDENUuAu20IeHxZaPXLOcYI6XPBIvW MHL+K3zAB2tEBJkP6YsJq/B2BdHTDD14P90AFZXf795Ybv1o/FSieuOiD+8HbXgmN7L9 syeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ISb2KRGBD2EQbNlQtNj9s1Qsgg4Y7Rh0l9kA+nuLh3w=; b=RLQ1dpOI8UtJCaDEhgwkkn0EJ/gkYtYsU9viYdfm9tG8oINBVdHzkilTjhiW8GHjrC MFsVe73GiQ2UWBeLkVtiIP2amso44SDHLytQ69nptM8uzz9DY55LP33G1hLo+sJoNtFX o2YZut3924WfLf3/a/5LBHdsksqaHVq7AdL6wF2zio4YunX4ocJXuOOzKYdGyimMmojj s8/dXVt4fTxCGw6ji37SZ7g7UhjdkpR7N5mg+Zbd/j4cLKIq2OSyIM3g204j1cZ52ehF 9bjuQ798QhocQ7IdH9I1WSOMY/UZn6DmuRksBb4reVhW3/aNMAV9oIzbeBYoaSk33aoh fg3g== X-Gm-Message-State: AOAM530XyZ8oH47aBezmY40Sts/QMbgDnZN9R+kikNn2Xo4YcXGZ8mA/ ro6t4HBRAd9OBzPTcRXYETL1n5/WT3ThWOJKDpQ= X-Google-Smtp-Source: ABdhPJz+Phn8jiQp9jGpBnMcRc1OZH2owWmlpnZF5cP2PEqlwDS61KW4uKrbgvy4fD2VmdlA3CqsYDOT9BvNKvotxXk= X-Received: by 2002:a4a:3790:: with SMTP id r138mr6698082oor.81.1590237449525; Sat, 23 May 2020 05:37:29 -0700 (PDT) In-Reply-To: <83tv06zvgl.fsf@gnu.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:180796 Archived-At: Am Sa., 23. Mai 2020 um 14:29 Uhr schrieb Eli Zaretskii : > > > From: Mattias Engdeg=C3=A5rd > > Date: Sat, 23 May 2020 13:36:37 +0200 > > Cc: ture@turepalsson.se, 41445@debbugs.gnu.org > > > > > My line of reasoning was that only the callers of ENCODE_FILE and > > > DECODE_FILE will not expect the match-data to be clobbered. Code tha= t > > > calls ucs-normalize-region directly may or may not be bothered by the > > > clobbering, so we should leave that to the caller. > > > > > > The advantage of not doing this unconditionally is that we don't > > > unnecessarily punishing callers that don't need match-data to be > > > saved. > > > > For callers of the ucs-normalize- functions, correctness should come fi= rst; their names, semantics or descriptions do not lead the user to suspect= them of clobbering the match data. It is an implementation leakage which c= an be quite unexpected, as is witnessed by this bug. > > I thought we had some advice to Lisp programs not to assume that > match-data will be preserved, but maybe I'm misremembering. Stefan, > do you remember something along these lines? That's at least what the manual says (https://www.gnu.org/software/emacs/manual/html_node/elisp/Match-Data.html)= : "Notice that all functions are allowed to overwrite the match data unless they're explicitly documented not to do so." (Not that I like that statement, but it is current reality.)