GNU bug report logs - #58865
29.0.50; Warnings when compiling net/dbus.el

Previous Next

Package: emacs;

Reported by: Arash Esbati <arash <at> gnu.org>

Date: Sat, 29 Oct 2022 12:03:02 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 58865 <at> debbugs.gnu.org, Arash Esbati <arash <at> gnu.org>
Subject: bug#58865: 29.0.50; Warnings when compiling net/dbus.el
Date: Mon, 31 Oct 2022 16:33:27 -0400
> However, dbus.el is prepared to care this situation. It contains the code
>
> --8<---------------cut here---------------start------------->8---
> ;; The following symbols are defined in dbusbind.c.  We need them also
> ;; when Emacs is compiled without D-Bus support.
> (unless (boundp 'dbus-error)
>   (define-error 'dbus-error "D-Bus error"))
>
> (unless (boundp 'dbus-debug)
>   (defvar dbus-debug nil))
> --8<---------------cut here---------------end--------------->8---

Hmm... this will define `dbus-debug` as a dynamically scoped variable
when `dbus.el(c)` is *loaded* but not while compiling this file, so the
compilation *should* arguably emit those warnings (and those relating
the the places where we let-bind this var reflect real bugs because
we'll miscompile those bindings as if they were using static scoping).

So I think the code requires a top-level (defvar dbus-debug).

> This has worked fine until recently. According to git bisect, the
> following commit has broken this:
>
> --8<---------------cut here---------------start------------->8---
> 1b1ffe07897ebe06cf96ab423fad3cde9fd6c981 is the first bad commit

I wonder why we didn't get warnings before that commit (and why this
commit makes a difference).

...

Oh, I see.  The patch changed a bit how dynvars are recognized which
fixed some cases where `defvar`s "leaked" outside of their context.

The previous leak, in the present case, caused the `(defvar dbus-debug
nil)` to mark that var as dyn-bound in the whole file rather than only
within the `unless` where it appears.
Admittedly, in this case it was the right call :-)


        Stefan





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

Previous Next


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