From: Robert Church <chrchr@gmail.com>
To: 69926@debbugs.gnu.org
Subject: bug#69926: 29.2; dbus.el doesn't invoke wildcard signal handlers
Date: Wed, 20 Mar 2024 18:22:33 -0700 [thread overview]
Message-ID: <CAKUFMvc=PwsvOgaZaBYMcSy9-hinkiTdJ=SSyT20kjHZ_7joqg@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 3782 bytes --]
Per the documentation in for dbus-register-signal in dbus.el:
SERVICE, PATH, INTERFACE and SIGNAL can be nil. This is
interpreted as a wildcard for the respective argument.
I wrote a little test, cribbed from dbus-test05-register-signal in
dbus-test.el. Where dbus-test-wildcards.el is the attached file:
$ emacs -Q -batch -l ert -l ~/dbus-test-wildcards.el -f
ert-run-tests-batch-and-exit
Running 1 tests (2024-03-20 18:11:55-0700, selector ‘t’)
Test dbus-test05b-register-signal-with-nils backtrace:
ert-fail("`dbus-test05b-register-signal-with-nils' timed out")
dbus--test-timeout-handler()
(progn (dbus--test-timeout-handler))
(if (eq -with-timeout-value- 'timeout) (progn (dbus--test-timeout-ha
(let ((-with-timeout-value- (catch 'timeout (let* ((-with-timeout-ti
(let ((member "Member") (handler #'dbus--test-signal-handler) regist
(unwind-protect (let ((member "Member") (handler #'dbus--test-signal
(lambda nil (let ((value-0 (gensym "ert-form-evaluation-aborted-")))
ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
ert-run-test(#s(ert-test :name dbus-test05b-register-signal-with-nil
ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test
ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
ert-run-tests-batch(nil)
ert-run-tests-batch-and-exit()
command-line-1(("-l" "ert" "-l" "/home/rc/dbus-test-wildcards.el" "-
command-line()
normal-top-level()
Test dbus-test05b-register-signal-with-nils condition:
(ert-test-failed "`dbus-test05b-register-signal-with-nils' timed out")
FAILED 1/1 dbus-test05b-register-signal-with-nils (1.004025 sec) at
../../../home/rc/dbus-test-wildcards.el:32
Ran 1 tests, 0 results as expected, 1 unexpected (2024-03-20 18:11:56-0700,
1.064641 sec)
1 unexpected results:
FAILED dbus-test05b-register-signal-with-nils
Build info:
In GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41,
cairo version 1.18.0) of 2024-02-26, modified by Debian built on
x86-ubc-02
Windowing system distributor 'The X.Org Foundation', version 11.0.12101011
System Description: Debian GNU/Linux trixie/sid
Configured using:
'configure --build x86_64-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/libexec
--localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-libsystemd --with-pop=yes
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.2/site-lisp:/usr/share/emacs/site-lisp
--with-sound=alsa --without-gconf --with-mailutils
--with-native-compilation --build x86_64-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/libexec
--localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-libsystemd --with-pop=yes
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.2/site-lisp:/usr/share/emacs/site-lisp
--with-sound=alsa --without-gconf --with-mailutils
--with-native-compilation --with-cairo --with-x=yes
--with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
-ffile-prefix-map=/build/reproducible-path/emacs-29.2+1=.
-fstack-protector-strong
-fstack-clash-protection -Wformat -Werror=format-security
-fcf-protection -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'
LDFLAGS=-Wl,-z,relro'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM GTK3 ZLIB
[-- Attachment #1.2: Type: text/html, Size: 4214 bytes --]
[-- Attachment #2: dbus-test-wildcards.el --]
[-- Type: text/x-emacs-lisp, Size: 2313 bytes --]
(require 'ert)
(require 'ert-x)
(require 'dbus)
(defvar dbus-debug nil)
(declare-function dbus-get-unique-name "dbusbind.c" (bus))
(defconst dbus--test-enabled-session-bus
(and (featurep 'dbusbind)
(dbus-ignore-errors (dbus-get-unique-name :session)))
"Check, whether we are registered at the session bus.")
(defconst dbus--test-service "org.gnu.Emacs.TestDBus"
"Test service.")
(defconst dbus--test-path "/org/gnu/Emacs/TestDBus"
"Test object path.")
(defconst dbus--test-interface "org.gnu.Emacs.TestDBus.Interface"
"Test interface.")
(defvar dbus--test-signal-received nil
"Received signal value in `dbus--test-signal-handler'.")
(defun dbus--test-signal-handler (&rest args)
"Signal handler for `dbus-test*-signal' and `dbus-test08-register-monitor'."
(setq dbus--test-signal-received args))
(defun dbus--test-timeout-handler (&rest _ignore)
"Timeout handler, reporting a failed test."
(ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test)))))
(ert-deftest dbus-test05b-register-signal-with-nils ()
"SERVICE, PATH, INTERFACE and SIGNAL can be ‘nil’. This is
interpreted as a wildcard for the respective argument."
(skip-unless dbus--test-enabled-session-bus)
(dbus-ignore-errors (dbus-unregister-service :session dbus--test-service))
(unwind-protect
(let ((member "Member")
(handler #'dbus--test-signal-handler)
registered)
;; Register signal handler.
(should
(equal
(setq
registered
(dbus-register-signal
:session nil nil nil nil handler))
`((:signal :session nil nil)
(nil nil ,handler))))
;; Send one argument, basic type.
(setq dbus--test-signal-received nil)
(dbus-send-signal
:session dbus--test-service dbus--test-path
dbus--test-interface member "foo")
(with-timeout (1 (dbus--test-timeout-handler))
(while (null dbus--test-signal-received)
(read-event nil nil 0.1)))
(should (equal dbus--test-signal-received '("foo")))
;; Unregister signal.
(should (dbus-unregister-object registered))
(should-not (dbus-unregister-object registered)))
;; Cleanup.
(dbus-unregister-service :session dbus--test-service)))
next reply other threads:[~2024-03-21 1:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 1:22 Robert Church [this message]
2024-03-22 8:23 ` bug#69926: 29.2; dbus.el doesn't invoke wildcard signal handlers Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-31 18:02 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-02 23:06 ` Robert Church
2024-04-03 8:16 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-03 16:57 ` Robert Church
2024-04-03 17:29 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKUFMvc=PwsvOgaZaBYMcSy9-hinkiTdJ=SSyT20kjHZ_7joqg@mail.gmail.com' \
--to=chrchr@gmail.com \
--cc=69926@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.