GNU bug report logs - #50690
Avoid double argument evaluation in vc-call

Previous Next

Package: emacs;

Reported by: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Date: Sun, 19 Sep 2021 23:49:02 UTC

Severity: wishlist

Tags: patch

Fixed in version 28.1

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50690 in the body.
You can then email your comments to 50690 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#50690; Package emacs. (Sun, 19 Sep 2021 23:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Basil L. Contovounesios" <contovob <at> tcd.ie>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 19 Sep 2021 23:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: bug-gnu-emacs <at> gnu.org
Subject: Avoid double argument evaluation in vc-call
Date: Mon, 20 Sep 2021 00:48:21 +0100
[Message part 1 (text/plain, inline)]
Severity: wishlist
Tags: patch

Is there any reason why the macro vc-call should continue to evaluate
its second argument twice?  Both 'make bootstrap' and 'make check' pass
with the attached patch:

[0002-lisp-vc-vc-hooks.el-vc-call-Eval-arg-once.patch (text/x-diff, inline)]
From 5cdd24e4eb3e1e79857d76c2b780fe7f245ad9f6 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Date: Sun, 19 Sep 2021 22:39:20 +0100
Subject: [PATCH 2/2] * lisp/vc/vc-hooks.el (vc-call): Eval arg once.

---
 lisp/vc/vc-hooks.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 0612310640..b7760e3bba 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -256,9 +256,9 @@ vc-call-backend
 (defmacro vc-call (fun file &rest args)
   "A convenience macro for calling VC backend functions.
 Functions called by this macro must accept FILE as the first argument.
-ARGS specifies any additional arguments.  FUN should be unquoted.
-BEWARE!! FILE is evaluated twice!!"
-  `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args))
+ARGS specifies any additional arguments.  FUN should be unquoted."
+  (macroexp-let2 nil file file
+    `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args)))
 
 (defsubst vc-parse-buffer (pattern i)
   "Find PATTERN in the current buffer and return its Ith submatch."
-- 
2.33.0

[Message part 3 (text/plain, inline)]
Thanks,

-- 
Basil

In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)
 of 2021-09-20 built on tia
Repository revision: 3c513435369826e44a53dcb12ecc14657e03c73d
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure 'CC=ccache gcc' 'CFLAGS=-Og -ggdb' --config-cache
 --prefix=/home/blc/.local --enable-checking=structs
 --with-x-toolkit=lucid --with-file-notification=yes --with-x'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XAW3D XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_IE.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50690; Package emacs. (Tue, 21 Sep 2021 05:19:02 GMT) Full text and rfc822 format available.

Message #8 received at 50690 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 50690 <at> debbugs.gnu.org
Subject: Re: bug#50690: Avoid double argument evaluation in vc-call
Date: Tue, 21 Sep 2021 07:18:48 +0200
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> Is there any reason why the macro vc-call should continue to evaluate
> its second argument twice?  Both 'make bootstrap' and 'make check' pass
> with the attached patch:

Your patch seems "obviously correct" to me (but it's an incompatible
change since the previous wonky behaviour was actually documented, so it
should be mentioned in NEWS).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50690; Package emacs. (Tue, 21 Sep 2021 11:54:02 GMT) Full text and rfc822 format available.

Message #11 received at 50690 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 50690 <at> debbugs.gnu.org
Subject: Re: bug#50690: Avoid double argument evaluation in vc-call
Date: Tue, 21 Sep 2021 12:53:43 +0100
close 50690 28.1
quit

Lars Ingebrigtsen [2021-09-21 07:18 +0200] wrote:

> "Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
>
>> Is there any reason why the macro vc-call should continue to evaluate
>> its second argument twice?  Both 'make bootstrap' and 'make check' pass
>> with the attached patch:
>
> Your patch seems "obviously correct" to me (but it's an incompatible
> change since the previous wonky behaviour was actually documented, so it
> should be mentioned in NEWS).

Done:

Avoid double argument evaluation in vc-call macro
5b962a7ad8 2021-09-21 12:30:58 +0100
https://git.sv.gnu.org/cgit/emacs.git/commit/?id=5b962a7ad8d0acfe40a41ce139059b9c8e46f666

I wasn't sure which is the most appropriate heading for it, so I put it
under

  * Changes in Specialized Modes and Packages in Emacs 28.1
  ** Change Logs and VC

Would

  * Incompatible Lisp Changes in Emacs 28.1

be more appropriate?

Thanks,

-- 
Basil




bug marked as fixed in version 28.1, send any further explanations to 50690 <at> debbugs.gnu.org and "Basil L. Contovounesios" <contovob <at> tcd.ie> Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Tue, 21 Sep 2021 11:54:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50690; Package emacs. (Tue, 21 Sep 2021 16:58:01 GMT) Full text and rfc822 format available.

Message #16 received at 50690 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 50690 <at> debbugs.gnu.org
Subject: Re: bug#50690: Avoid double argument evaluation in vc-call
Date: Tue, 21 Sep 2021 18:57:21 +0200
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> Would
>
>   * Incompatible Lisp Changes in Emacs 28.1
>
> be more appropriate?

Yes, that's where we stash stuff like this.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50690; Package emacs. (Tue, 21 Sep 2021 17:18:02 GMT) Full text and rfc822 format available.

Message #19 received at 50690 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 50690 <at> debbugs.gnu.org
Subject: Re: bug#50690: Avoid double argument evaluation in vc-call
Date: Tue, 21 Sep 2021 18:17:43 +0100
Lars Ingebrigtsen [2021-09-21 18:57 +0200] wrote:

> "Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
>
>> Would
>>
>>   * Incompatible Lisp Changes in Emacs 28.1
>>
>> be more appropriate?
>
> Yes, that's where we stash stuff like this.

Done:

; * etc/NEWS: Refile recent addition (bug#50690).
90d491ee57 2021-09-21 18:16:36 +0100
https://git.sv.gnu.org/cgit/emacs.git/commit/?id=90d491ee577399a76754ad2c873c03bc5c466eda

Thanks,

-- 
Basil




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 20 Oct 2021 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 161 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.