GNU bug report logs - #49651
28.0.50; setf bug

Previous Next

Package: emacs;

Reported by: Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>

Date: Mon, 19 Jul 2021 21:46:01 UTC

Severity: normal

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 49651 in the body.
You can then email your comments to 49651 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#49651; Package emacs. (Mon, 19 Jul 2021 21:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Jul 2021 21:46:02 GMT) Full text and rfc822 format available.

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

From: Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; setf bug
Date: Mon, 19 Jul 2021 16:25:22 -0400
$ /Applications/Emacs-28.0.50.app/Contents/MacOS/Emacs -Q --batch --eval '(setf (getenv "FOO") "BAR")'
Debugger entered--Lisp error: (void-function \(setf\ getenv\))
  (\(setf\ getenv\) "BAR" "FOO")
  (setf (getenv "FOO") "BAR")
  eval((setf (getenv "FOO") "BAR") t)
  command-line-1(("--eval" "(setf (getenv \"FOO\") \"BAR\")"))
  command-line()
  normal-top-level()

		Peace
			--Devon

P.S. The fix is obvious:

lisp/emacs-lisp/cl-lib.el
⋮
;; These used to be in cl-macs.el since all macros that use them (like setf)
;; were autoloaded from cl-macs.el.  But now that setf, push, and pop are in
;; core Elisp, they need to either be right here or be autoloaded via
;; cl-loaddefs.el, which is more trouble than it is worth.
⋮
(gv-define-simple-setter getenv setenv t)

P.P.S.  Perhaps describe-function, M-. and the like should mention setters?

In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95))
 of 2021-06-20 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.6

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER THREADS
TOOLKIT_SCROLL_BARS ZLIB

Important settings:
  value of $LANG: en_BE <at> currency=USD.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue cocoa ns multi-tty
make-network-process emacs)

Memory information:
((conses 16 51228 5390)
 (symbols 48 6521 1)
 (strings 32 18238 2346)
 (string-bytes 1 608421)
 (vectors 16 13471)
 (vector-slots 8 183176 10992)
 (floats 8 21 47)
 (intervals 56 198 0)
 (buffers 992 11))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Tue, 20 Jul 2021 00:30:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>
Cc: 49651 <at> debbugs.gnu.org
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Tue, 20 Jul 2021 02:29:30 +0200
Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net> writes:

> $ /Applications/Emacs-28.0.50.app/Contents/MacOS/Emacs -Q --batch --eval '(setf (getenv "FOO") "BAR")'
> Debugger entered--Lisp error: (void-function \(setf\ getenv\))
>   (\(setf\ getenv\) "BAR" "FOO")
>   (setf (getenv "FOO") "BAR")

> P.S. The fix is obvious:
>
> lisp/emacs-lisp/cl-lib.el
> ⋮
> ;; These used to be in cl-macs.el since all macros that use them (like setf)
> ;; were autoloaded from cl-macs.el.  But now that setf, push, and pop are in
> ;; core Elisp, they need to either be right here or be autoloaded via
> ;; cl-loaddefs.el, which is more trouble than it is worth.
> ⋮
> (gv-define-simple-setter getenv setenv t)

So the error does only occur before you require cl-lib, and your
suggestion is to do what the comment describes as trouble - correct?

I'm not sure of what kind that trouble is, moving such definitions can
have effects on bootstrapping or startup, that's beyond my knowledge.

Any opinions?

> P.P.S.  Perhaps describe-function, M-. and the like should mention
> setters?

I would like it when C-h f would tell about gv expanders.  Not trivial
though since most gv expanders are anonymous functions (like that of
`getenv').


Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Tue, 20 Jul 2021 12:01:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 49651 <at> debbugs.gnu.org, Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Tue, 20 Jul 2021 14:00:49 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> I'm not sure of what kind that trouble is, moving such definitions can
> have effects on bootstrapping or startup, that's beyond my knowledge.

Yes, if we moved these elsewhere, then it would break for people who do
have (require 'cl-lib).  (Unless we autoload them.)

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 01:14:01 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49651 <at> debbugs.gnu.org, Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Wed, 21 Jul 2021 03:12:59 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Yes, if we moved these elsewhere, then it would break for people who
> do have (require 'cl-lib).  (Unless we autoload them.)

In emacs -Q, env.el is loaded, cl-lib is not loaded, and gv.el is not
loaded.

When I require cl-lib, then the gv-expander for getenv has been defined,
while gv.el is still not loaded.  So far, so good.

Would anything break if the expander definition for getenv would be
moved to env.el (which would be a more natural place for it)?

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 10:58:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 49651 <at> debbugs.gnu.org, Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>,
 Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Wed, 21 Jul 2021 12:57:45 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Would anything break if the expander definition for getenv would be
> moved to env.el (which would be a more natural place for it)?

Yes, moving the expanders to pre-loaded files would make the problem go
away, I think?  (And env.el is a good place for that one.)

But if we start doing that for some of those things, we should probably
do it for all of them, and I wasn't sure that that's what we wanted to
do.

It's certainly not very logical to load cl-lib to define a setter for,
say, `face-background', but that's where we're at today.

I think I'm in favour of moving all those out of cl-lib to preloaded
files.  I'm sure nobody else has an opinion here.

(3, 2...)

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 12:50:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>, 49651 <at> debbugs.gnu.org
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Wed, 21 Jul 2021 08:49:44 -0400
> It's certainly not very logical to load cl-lib to define a setter for,
> say, `face-background', but that's where we're at today.

Indeed, that was a mistake.  They should have gone to `cl.el` instead.
But if we don't want to move them to `cl.el` (and hence deprecate them)
we should move them to `gv.el`.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 13:30:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>, 49651 <at> debbugs.gnu.org
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Wed, 21 Jul 2021 15:28:54 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> Indeed, that was a mistake.  They should have gone to `cl.el` instead.
> But if we don't want to move them to `cl.el` (and hence deprecate them)
> we should move them to `gv.el`.

I don't think we don't want to deprecate them...

Let's see...  gv is dumped in Emacs, right?  (At least that's what
"emacs -Q" seems to tell me.)  In which case...  wouldn't it be just as
natural to move the setters to other preloaded files where they more
naturally belong, like env.el for the getenv setter, etc?

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 13:54:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>, 49651 <at> debbugs.gnu.org
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Wed, 21 Jul 2021 09:53:25 -0400
> Let's see...  gv is dumped in Emacs, right?

No.  `push` and `pop` go through some extra efforts to avoid loading
`gv` when the PLACE is trivial enough.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 14:03:02 GMT) Full text and rfc822 format available.

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

From: Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>,
 Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 49651 <at> debbugs.gnu.org
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Wed, 21 Jul 2021 10:02:46 -0400
On 2021-07-21 09:53, Stefan Monnier wrote:
>> Let's see...  gv is dumped in Emacs, right?
> 
> No.  `push` and `pop` go through some extra efforts to avoid loading
> `gv` when the PLACE is trivial enough.

Let `setf' try loading gv before failing.

		Peace
			--Devon

P.S.  What's wrong with autoloading?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 14:16:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>, 49651 <at> debbugs.gnu.org
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Wed, 21 Jul 2021 16:14:56 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> Let's see...  gv is dumped in Emacs, right?
>
> No.

I guess I didn't know that `C-h f foo TAB' these days would load foo.el?

> `push` and `pop` go through some extra efforts to avoid loading
> `gv` when the PLACE is trivial enough.

Right.  Well, then we can't really move them to gv.el either, because
that would break code that says

(require 'cl-lib)
(setf (getenv ...))

since

(progn
  (require 'cl-lib)
  (featurep 'gv)) => nil

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 14:32:03 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>, 49651 <at> debbugs.gnu.org
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Wed, 21 Jul 2021 10:31:32 -0400
>> `push` and `pop` go through some extra efforts to avoid loading
>> `gv` when the PLACE is trivial enough.
> Right.  Well, then we can't really move them to gv.el either,

Of course, we can.

> because that would break code that says
>
> (require 'cl-lib)
> (setf (getenv ...))
>
> since
>
> (progn
>   (require 'cl-lib)
>   (featurep 'gv)) => nil

`setf` is defined in `gv.el`!


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 14:56:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>, 49651 <at> debbugs.gnu.org
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Wed, 21 Jul 2021 16:55:20 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> `setf` is defined in `gv.el`!

D'oh!

These newfangled files...   I mean, gv.el is just nine years old.

Well, then moving them over to gv.el seems like an excellent solution. 

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 19:29:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: michael_heerdegen <at> web.de, Emacs-Hacker2020 <at> jovi.net, 49651 <at> debbugs.gnu.org,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Wed, 21 Jul 2021 22:27:54 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Wed, 21 Jul 2021 16:55:20 +0200
> Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 49651 <at> debbugs.gnu.org,
>  Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net>
> 
> These newfangled files...   I mean, gv.el is just nine years old.

Welcome to the brave new Emacs world!  Where you can never trust your
decade-long memory regarding where to find stuff.  It's all a-changing
twice every week.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49651; Package emacs. (Wed, 21 Jul 2021 22:22:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: michael_heerdegen <at> web.de, 49651 <at> debbugs.gnu.org, Emacs-Hacker2020 <at> jovi.net,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#49651: 28.0.50; setf bug
Date: Thu, 22 Jul 2021 00:21:42 +0200
OK, I've now moved all the expanders from cl-lib.el to gv.el and done
some build tests:  Both an incremental and a bootstrap build were
successful, so I'm now pushing this to the trunk.

(And this fixes the originally reported problem in this bug report.)

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





bug marked as fixed in version 28.1, send any further explanations to 49651 <at> debbugs.gnu.org and Devon Sean McCullough <Emacs-Hacker2020 <at> jovi.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 21 Jul 2021 22:22:02 GMT) Full text and rfc822 format available.

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

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

Previous Next


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