From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Ivan Andrus Newsgroups: gmane.emacs.bugs Subject: bug#40692: 28.0.50; Constant list modified inside function Date: Fri, 17 Apr 2020 17:45:12 -0600 Message-ID: <57990C74-5CA1-42E6-83EC-7F6858AFD0E7@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="104339"; mail-complaints-to="usenet@ciao.gmane.io" To: 40692@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 18 01:46:17 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 1jPaga-000R3E-9A for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Apr 2020 01:46:16 +0200 Original-Received: from localhost ([::1]:53136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPagZ-0005SE-5q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 17 Apr 2020 19:46:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40982) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPagP-0005S0-34 for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 19:46:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPagM-0004T1-Rm for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 19:46:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58554) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPagM-0004SQ-Kx for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 19:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jPagM-0006FX-I9 for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 19:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Andrus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Apr 2020 23:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 40692 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.158716712223958 (code B ref -1); Fri, 17 Apr 2020 23:46:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Apr 2020 23:45:22 +0000 Original-Received: from localhost ([127.0.0.1]:41867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jPafi-0006EM-Ag for submit@debbugs.gnu.org; Fri, 17 Apr 2020 19:45:22 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:37881) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jPaff-0006ED-UZ for submit@debbugs.gnu.org; Fri, 17 Apr 2020 19:45:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40118) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPafe-0005H4-Fy for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 19:45:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPafd-00033y-38 for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 19:45:18 -0400 Original-Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]:36957) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPafc-00030s-UP for bug-gnu-emacs@gnu.org; Fri, 17 Apr 2020 19:45:17 -0400 Original-Received: by mail-il1-x12f.google.com with SMTP id e4so3880831ils.4 for ; Fri, 17 Apr 2020 16:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=J6qqyTC1CpMSNhvMX+4qfb/lF57uChXuKZwJgMAraLg=; b=S6OE72qXn2Yp/5rDUjGUvQJXC5xbiZe4fjmgkqt59dt++iYN+t9C4+1B0dg+VsuHsq 6au2DqakZVGMLLMNyQBFn9bZwqbWExDqVTh2Dcrwerm/S3iWJPTL8WrpCwZtfMlpY3vZ ZBlolfZ/Leuv/84+PxeRCGzYdutDXAXHlTQi2hF1HuU3HpYf3RE5G6TkL/ZnsS2D6mwU fTkunlwcFQz3h8emf2NkjxXzkJxR+WsWZIz22Y7z/Dxfnur9YBWfEoq13kEkCuJGw9zQ BKGzvkB/AhnYxQ9Bh+igoIiWUG8nmG90LSu0tRUFR1cFOMUu4nxEIbTWYkW6Dr6Qa2N3 ADmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=J6qqyTC1CpMSNhvMX+4qfb/lF57uChXuKZwJgMAraLg=; b=b4+tNcrnjeDGs4KvxIBMuRYRUR1COVNV4OzXA97sDvbtHEslHWmasGKEP6EYj5WM8x cSjBBT2Ogj2+52a1NSwg49bKCNYLgf5v7czMEyh1kpjOXyorsdzsxNe0Ovu+p1F9It8i gerjM3eNf+JatmWcQ/eNBglwBlC2wrMl/XZ5L+jq4+T4gPN74O3semI1yKoM1B8xD4Y2 2+r/OfSEtNzTYrgXfwDI/sebRNs+NhDbGrNteVGPq+cPs6yJf1j+396S+b3vI7JFu2Eo 3rRX602fXm+Euj36d8JawkcsY4ZiHGX4AgdgQlcrsseL/bq2lsrJNNmkyXb46928fj70 +Zjw== X-Gm-Message-State: AGi0PuYxSw6Grvm8sOZvFlXV+DKewZp3f9gEveNbsa4xX7EgF8rJuEzs jvd2nVD8v0gJ0lDsIGJvWMtIFoIRY9s= X-Google-Smtp-Source: APiQypKyrzKDj30nZtYfa8AlV26s9iBD3rPggt0ZkVvsPuAxLpCExvXyfH8+YIeQbZlC9mgAtsnd0A== X-Received: by 2002:a92:985d:: with SMTP id l90mr5705703ili.108.1587167114919; Fri, 17 Apr 2020 16:45:14 -0700 (PDT) Original-Received: from [192.150.23.4] (67-2-50-168.slkc.qwest.net. [67.2.50.168]) by smtp.gmail.com with ESMTPSA id g26sm6441719ile.3.2020.04.17.16.45.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2020 16:45:13 -0700 (PDT) X-Mailer: Apple Mail (2.3445.104.14) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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:178543 Archived-At: Starting from Emacs -Q (I am building off of trunk, but my brother = verified the same behavior in 26.3), if I evaluate the following code I = get an error the second time I call withdraw. (defmacro show (var) `(message ,(format "%S %%S" var) ,var)) (defun my-test-fun (amount params) (when (memq 'tricked-ya params) (error "What happened here?")) (show amount) (show params) (setcdr (cdr params) (list 'tricked-ya)) (show params)) (defun fun-withdraw (amount) (my-test-fun amount `((amount . , amount) (const . some-constant)))) (fun-withdraw 12) (fun-withdraw 12) ;; The second time it's called it will error = because the "constant" list was modified. I believe this is the root cause of a bug in magit/forge = https://github.com/magit/forge/issues/267 in which all subsequent pull = requests created have the same name. The maintainer of magit/forge = (tarsius) was unable to reproduce that bug, so I tried my hand at = creating a minimal test case, and I was able to get it down to this. Now, I understand reference semantics of lists in general, but it seems = like this should be different. If this behavior is intentional, what's = the best way to for creation of a new list every time so that functions = using the alist don't have to worry about not changing the list? -Ivan Andrus In GNU Emacs 28.0.50 (build 18, x86_64-apple-darwin18.7.0, NS = appkit-1671.60 Version 10.14.6 (Build 18G4032)) of 2020-04-10 built on iandrus-macOS Repository revision: 965390ca5f206c6358014574fe5140ba40850391 -- some = local changes on top of e18c24b35a7cf9bb1b91288b706fa448ed28a7c2 Repository branch: master Windowing system distributor 'Apple', version 10.3.1671 System Description: Mac OS X 10.14.6 Configured using: 'configure = PKG_CONFIG_PATH=3D/opt/X11/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgcon= fig --with-sound=3Dyes --with-ns --with-modules --with-file-notification=3Dyes= --enable-gcc-warnings=3Dwarn-only --with-xpm --with-jpeg --with-tiff --with-gif --with-png --with-rsvg --with-xml2 --with-imagemagick --with-json --with-xft --with-libotf --with-gnutls=3Dno --with-makeinfo --with-libgmp' Configured features: RSVG IMAGEMAGICK GLIB NOTIFY KQUEUE ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS XIM NS MODULES THREADS JSON PDUMPER GMP Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix