From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#41445: 26.3; Query-replace triggers "match data clobbered by..." Date: Sat, 23 May 2020 15:28:42 +0300 Message-ID: <83tv06zvgl.fsf@gnu.org> References: <83367s4427.fsf@gnu.org> <370FA0D9-1EF2-4EC4-977C-C20106CF222D@acm.org> <83wo542mwz.fsf@gnu.org> <76CFF420-CB1C-464A-A67C-22D813C00EB8@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="111958"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ture@turepalsson.se, 41445@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 23 14:29:09 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 1jcTH3-000T1U-DM for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 May 2020 14:29:09 +0200 Original-Received: from localhost ([::1]:51700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcTH2-0001vZ-GB for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 May 2020 08:29:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcTGw-0001v3-AZ for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 08:29:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50300) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jcTGw-0005Zu-1O for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 08:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jcTGv-0004xH-VA for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 08:29:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 May 2020 12:29:01 +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.159023692619026 (code B ref 41445); Sat, 23 May 2020 12:29:01 +0000 Original-Received: (at 41445) by debbugs.gnu.org; 23 May 2020 12:28:46 +0000 Original-Received: from localhost ([127.0.0.1]:33613 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcTGg-0004wo-JP for submit@debbugs.gnu.org; Sat, 23 May 2020 08:28:46 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcTGf-0004wd-Hm for 41445@debbugs.gnu.org; Sat, 23 May 2020 08:28:45 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42429) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcTGY-0005W8-N7; Sat, 23 May 2020 08:28:38 -0400 Original-Received: from [176.228.60.248] (port=3924 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jcTGX-0000kf-1v; Sat, 23 May 2020 08:28:37 -0400 In-Reply-To: <76CFF420-CB1C-464A-A67C-22D813C00EB8@acm.org> (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Sat, 23 May 2020 13:36:37 +0200) 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:180795 Archived-At: > From: Mattias EngdegÄrd > 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 that > > 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 first; their names, semantics or descriptions do not lead the user to suspect them of clobbering the match data. It is an implementation leakage which can 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? Anyway, if you feel strongly about doing this on the lowest level, I won't fight.