GNU bug report logs - #52178
29.0.50; process-environment not used in async-shell-command

Previous Next

Package: emacs;

Reported by: Damien Merenne <dam <at> cosinux.org>

Date: Mon, 29 Nov 2021 12:34:01 UTC

Severity: normal

Found in version 29.0.50

Full log


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

From: Damien Merenne <dam <at> cosinux.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 52178 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#52178: 29.0.50;
 process-environment not used in async-shell-command
Date: Sun, 16 Jan 2022 10:49:18 +0000
Thanks for the reminder and the pointer to the watcher! I finally
found that it happens due to the `envrc` package.
That package is meant to set `process-environment` buffer local for
some buffers. Somehow it sets
process-environment globally local but only when emacs is started as a
daemon from the systemd unit. Running
it normally or with --fg-daemon from a terminal does not set the
variable globally local. I'll check with the envrc
maintainer why that would be but there is still something strange
going on, I would not expect Emacs behaviour to
 change when started in systemd.

For people stumbling upon this, here is the code I used to pinpoint the problem:
```
(defvar pltraces (list (cons "early-init.el" (local-variable-p
'process-environment))))
(add-hook 'after-load-functions
          (lambda (fn)
            (setq pltraces (cons (cons fn (local-variable-p
'process-environment)) pltraces))))
(add-variable-watcher 'process-environment
                      (lambda (symbol newval operation where)
                        (when where
                          (setq pltraces (cons (cons (buffer-name
where) (local-variable-p 'process-environment)) pltraces)))))
```
It records the place where the variable is set and its local status in
the `pltraces` variable.

-- 
Damien MERENNE   <dam <at> cosinux.org>

Le sam. 15 janv. 2022 à 21:39, Michael Heerdegen
<michael_heerdegen <at> web.de> a écrit :
>
> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
> > Damien Merenne <dam <at> cosinux.org> writes:
> >
> > > I'll try to find what's triggering it but its not obvious.
> >
> > Did you make any progress here?
>
> Damien, maybe using a variable watcher:
>
>   (info "(elisp) Watching Variables")
>
> could help to understand what's going on?  They are able to notice
> changes in buffer-localness.
>
> Michael.




This bug report was last modified 3 years and 150 days ago.

Previous Next


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