* bug#44298: 28.0.50; D-Bus GetManagedObjects doesn't enumerate all paths. @ 2020-10-29 2:55 Hugh Daschbach 2020-10-29 15:59 ` Michael Albinus 2020-10-30 3:21 ` bug#44298: Resolved Hugh Daschbach 0 siblings, 2 replies; 5+ messages in thread From: Hugh Daschbach @ 2020-10-29 2:55 UTC (permalink / raw) To: 44298 [-- Attachment #1: Type: text/plain, Size: 204 bytes --] If a D-Bus interface is registered on more than one path, processing an incoming GetManagedObjects method call only reports a single path. The attached patch adds a test case to demonstrate this issue. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: New test for GetManagedObjects. --] [-- Type: text/x-patch, Size: 3570 bytes --] From 43a446ce12485d669daed978796dc032113d73e5 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach <hdasch@fastmail.com> Date: Wed, 28 Oct 2020 19:36:19 -0700 Subject: [PATCH] Add tests for D-Bus GetManagedObjects inquiry. * test/lisp/net/dbus-tests.el (dbus-test09-get-managed-objects): New test. --- test/lisp/net/dbus-tests.el | 82 +++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index 2186d454aee..3bb2264defb 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -1889,6 +1889,88 @@ dbus-test08-register-monitor ;; Cleanup. (dbus-unregister-service :session dbus--test-service))) +(ert-deftest dbus-test09-get-managed-objects () + "Check `dbus-get-all-managed-objects'." + (skip-unless dbus--test-enabled-session-bus) + (dbus-ignore-errors (dbus-unregister-service :session dbus--test-service)) + (dbus-register-service :session dbus--test-service) + + (unwind-protect + (let ((path1 (concat dbus--test-path "/path1")) + (path2 (concat dbus--test-path "/path2")) + (path3 (concat dbus--test-path "/path3"))) + + (should-not + (dbus-get-all-managed-objects :session dbus--test-service dbus--test-path)) + + (should + (equal + (dbus-register-property + :session dbus--test-service path1 dbus--test-interface + "Property1" :readwrite "Simple string one.") + `((:property :session ,dbus--test-interface "Property1") + (,dbus--test-service ,path1)))) + + (should + (equal + (dbus-get-property + :session dbus--test-service path1 dbus--test-interface + "Property1") + "Simple string one.")) + + (should + (equal + (dbus-register-property + :session dbus--test-service path2 dbus--test-interface + "Property1" :readwrite "Simple string two.") + `((:property :session ,dbus--test-interface "Property1") + (,dbus--test-service ,path2)))) + + (should + (equal + (dbus-register-property + :session dbus--test-service path3 dbus--test-interface + "Property1" :readwrite "Simple string three.") + `((:property :session ,dbus--test-interface "Property1") + (,dbus--test-service ,path3)))) + + (should + (equal + (dbus-get-property + :session dbus--test-service path1 dbus--test-interface + "Property1") + "Simple string one.")) + + (should + (equal + (dbus-get-property + :session dbus--test-service path2 dbus--test-interface + "Property1") + "Simple string two.")) + + (should + (equal + (dbus-get-property + :session dbus--test-service path3 dbus--test-interface + "Property1") + "Simple string three.")) + + (let ((result (dbus-get-all-managed-objects :session dbus--test-service dbus--test-path))) + (should + (= 3 (length result))) + + (should + (assoc-string path1 result)) + + (should + (assoc-string path2 result)) + + (should + (assoc-string path3 result)))) + + ;; Cleanup. + (dbus-unregister-service :session dbus--test-service))) + (defun dbus-test-all (&optional interactive) "Run all tests for \\[dbus]." (interactive "p") base-commit: bb3d13ac3586d3577605d3d8809d31c62a267c99 -- 2.28.0 [-- Attachment #3: Type: text/plain, Size: 3088 bytes --] Cheers, Hugh In GNU Emacs 28.0.50 (build 20, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.3, Xaw3d scroll bars) of 2020-10-11 built on klaatu Repository revision: 0f79544368c0dc343edcd97c3c7992aeab415b68 Repository branch: submission Windowing system distributor 'The X.Org Foundation', version 11.0.12009000 System Description: Artix Linux Configured using: 'configure --with-x-toolkit=lucid' Configured features: XAW3D XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: ERT-Results 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 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 eieio eieio-core eieio-loaddefs password-cache json map text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils thingatpt edmacro kmacro cl-extra vc-git diff-mode easy-mmode bug-reference dbus-tests dbus cl-seq cl-macs pcase xml subr-x seq byte-opt gv bytecomp byte-compile cconv ert-x ert pp ewoc debug backtrace help-mode easymenu find-func cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd 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 timer select scroll-bar mouse jit-lock font-lock syntax facemenu 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 dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 122955 5639) (symbols 48 10363 1) (strings 32 26544 1387) (string-bytes 1 832865) (vectors 16 15402) (vector-slots 8 202326 11404) (floats 8 68 231) (intervals 56 612 0) (buffers 992 14)) ^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#44298: 28.0.50; D-Bus GetManagedObjects doesn't enumerate all paths. 2020-10-29 2:55 bug#44298: 28.0.50; D-Bus GetManagedObjects doesn't enumerate all paths Hugh Daschbach @ 2020-10-29 15:59 ` Michael Albinus 2020-10-30 3:03 ` Hugh Daschbach 2020-10-30 3:21 ` bug#44298: Resolved Hugh Daschbach 1 sibling, 1 reply; 5+ messages in thread From: Michael Albinus @ 2020-10-29 15:59 UTC (permalink / raw) To: Hugh Daschbach; +Cc: 44298 Hugh Daschbach <hugh@ccss.com> writes: Hi Hugh, > If a D-Bus interface is registered on more than one path, processing an > incoming GetManagedObjects method call only reports a single path. Thanks for the report! I've pushed a fix to master, which should solve it. > The attached patch adds a test case to demonstrate this issue. Thanks also for this. I've pushed it to master as well. > Cheers, > Hugh Best regards, Michael. ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#44298: 28.0.50; D-Bus GetManagedObjects doesn't enumerate all paths. 2020-10-29 15:59 ` Michael Albinus @ 2020-10-30 3:03 ` Hugh Daschbach 2020-10-30 8:07 ` Michael Albinus 0 siblings, 1 reply; 5+ messages in thread From: Hugh Daschbach @ 2020-10-30 3:03 UTC (permalink / raw) To: Michael Albinus; +Cc: Hugh Daschbach, 44298, 44298+DONE [-- Attachment #1: Type: text/plain, Size: 553 bytes --] Michael Albinus writes: >> If a D-Bus interface is registered on more than one path, processing an >> incoming GetManagedObjects method call only reports a single path. > > Thanks for the report! I've pushed a fix to master, which should solve it. Michael, many thanks. That fixes the issue. I've extended the test to cover multiple interfaces and multiple paths. I've attached a patch if you're interested. I've tried to follow your advice on closing the bug. If I missed the mark, please feel free to close it yourself. Thanks again, Hugh [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: Extend GetManagedObjects test. --] [-- Type: text/x-patch, Size: 7172 bytes --] From 1b2e74b26ebd925539a07b909cfd600a66c4ab82 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach <hdasch@fastmail.com> Date: Thu, 29 Oct 2020 19:46:26 -0700 Subject: [PATCH] Extend GetManagedObjects test. * test/lisp/net/dbus-tests.el (dbus-test09-get-managed-objects): Expand test. --- test/lisp/net/dbus-tests.el | 128 +++++++++++++++++++++--------------- 1 file changed, 76 insertions(+), 52 deletions(-) diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index d630f80706e..6363ca2aebe 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -1890,78 +1890,102 @@ dbus-test08-register-monitor (ert-deftest dbus-test09-get-managed-objects () "Check `dbus-get-all-managed-objects'." - :tags '(:expensive-test) (skip-unless dbus--test-enabled-session-bus) (dbus-ignore-errors (dbus-unregister-service :session dbus--test-service)) (dbus-register-service :session dbus--test-service) (unwind-protect - (let ((path1 (concat dbus--test-path "/path1")) - (path2 (concat dbus--test-path "/path2")) - (path3 (concat dbus--test-path "/path3"))) + (let ((interfaces + `((,(concat dbus--test-interface ".I0") + ((,(concat dbus--test-path "/obj1") + (("I0Property1" . "Zero one one") + ("I0Property2" . "Zero one two") + ("I0Property3" . "Zero one three"))) + (,(concat dbus--test-path "/obj0/obj2") + (("I0Property1" . "Zero two one") + ("I0Property2" . "Zero two two") + ("I0Property3" . "Zero two three"))) + (,(concat dbus--test-path "/obj0/obj3") + (("I0Property1" . "Zero three one") + ("I0Property2" . "Zero three two") + ("I0Property3" . "Zero three three"))))) + (,(concat dbus--test-interface ".I1") + ((,(concat dbus--test-path "/obj0/obj2") + (("I1Property1" . "One one one") + ("I1Property2" . "One one two"))) + (,(concat dbus--test-path "/obj0/obj3") + (("I1Property1" . "One two one") + ("I1Property2" . "One two two")))))))) (should-not (dbus-get-all-managed-objects :session dbus--test-service dbus--test-path)) - (should - (equal - (dbus-register-property - :session dbus--test-service path1 dbus--test-interface - "Property1" :readwrite "Simple string one.") - `((:property :session ,dbus--test-interface "Property1") - (,dbus--test-service ,path1)))) - - (should - (equal - (dbus-register-property - :session dbus--test-service path2 dbus--test-interface - "Property1" :readwrite "Simple string two.") - `((:property :session ,dbus--test-interface "Property1") - (,dbus--test-service ,path2)))) - - (should - (equal - (dbus-register-property - :session dbus--test-service path3 dbus--test-interface - "Property1" :readwrite "Simple string three.") - `((:property :session ,dbus--test-interface "Property1") - (,dbus--test-service ,path3)))) - - (should - (equal - (dbus-get-property - :session dbus--test-service path1 dbus--test-interface - "Property1") - "Simple string one.")) - - (should - (equal - (dbus-get-property - :session dbus--test-service path2 dbus--test-interface - "Property1") - "Simple string two.")) - - (should - (equal - (dbus-get-property - :session dbus--test-service path3 dbus--test-interface - "Property1") - "Simple string three.")) + (dolist (interface interfaces) + (pcase-let ((`(,iname ,objs) interface)) + (dolist (obj objs) + (pcase-let ((`(,path ,props) obj)) + (dolist (prop props) + (should + (equal + (dbus-register-property + :session dbus--test-service path iname + (car prop) :readwrite (cdr prop)) + `((:property :session ,iname ,(car prop)) + (,dbus--test-service ,path))))))))) (let ((result (dbus-get-all-managed-objects :session dbus--test-service dbus--test-path))) (should (= 3 (length result))) - (should - (assoc-string path1 result)) + (dolist (interface interfaces) + (pcase-let ((`(,iname ,objs) interface)) + (dolist (obj objs) + (pcase-let ((`(,path ,props) obj)) + (let* ((object (cadr (assoc-string path result))) + (iface (cadr (assoc-string iname object)))) + (should object) + (should iface) + (dolist (prop props) + (should (equal (cdr (assoc-string (car prop) iface)) + (cdr prop)))))))))) + (let ((result (dbus-get-all-managed-objects + :session dbus--test-service (concat dbus--test-path "/obj0")))) (should - (assoc-string path2 result)) + (= 2 (length result))) + + (dolist (interface interfaces) + (pcase-let ((`(,iname ,objs) interface)) + (dolist (obj objs) + (pcase-let ((`(,path ,props) obj)) + (when (string-prefix-p (concat dbus--test-path "/obj0/") path) + (let* ((object (cadr (assoc-string path result))) + (iface (cadr (assoc-string iname object)))) + (should object) + (should iface) + (dolist (prop props) + (should (equal (cdr (assoc-string (car prop) iface)) + (cdr prop))))))))))) + (let ((result (dbus-get-all-managed-objects + :session dbus--test-service (concat dbus--test-path "/obj0/obj2")))) (should - (assoc-string path3 result)))) + (= 1 (length result))) + + (dolist (interface interfaces) + (pcase-let ((`(,iname ,objs) interface)) + (dolist (obj objs) + (pcase-let ((`(,path ,props) obj)) + (when (string-prefix-p (concat dbus--test-path "/obj0/obj2") path) + (let* ((object (cadr (assoc-string path result))) + (iface (cadr (assoc-string iname object)))) + (should object) + (should iface) + (dolist (prop props) + (should (equal (cdr (assoc-string (car prop) iface)) + (cdr prop)))))))))))) ;; Cleanup. (dbus-unregister-service :session dbus--test-service))) -- 2.28.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#44298: 28.0.50; D-Bus GetManagedObjects doesn't enumerate all paths. 2020-10-30 3:03 ` Hugh Daschbach @ 2020-10-30 8:07 ` Michael Albinus 0 siblings, 0 replies; 5+ messages in thread From: Michael Albinus @ 2020-10-30 8:07 UTC (permalink / raw) To: Hugh Daschbach; +Cc: 44298-done Hugh Daschbach <hugh@ccss.com> writes: Hi Hugh, > Michael, many thanks. That fixes the issue. I've extended the test to > cover multiple interfaces and multiple paths. I've attached a patch if > you're interested. Thanks, I've pushed it to master. Yesterday, I've also added the :expensive-test tag which is missing in your recent patch. So I've added it, again. > I've tried to follow your advice on closing the bug. If I missed the > mark, please feel free to close it yourself. You need just to edit the debbugs email address in Cc, from 44298@debbugs.gnu.org to 44298-done@debbugs.gnu.org, as I've done here. Read admin/notes/bugtracker for further information. You could also use the debbugs package from GNU ELPA. Disclaimer: I'm one of its authors. > Thanks again, > Hugh Best regards, Michael. ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#44298: Resolved 2020-10-29 2:55 bug#44298: 28.0.50; D-Bus GetManagedObjects doesn't enumerate all paths Hugh Daschbach 2020-10-29 15:59 ` Michael Albinus @ 2020-10-30 3:21 ` Hugh Daschbach 1 sibling, 0 replies; 5+ messages in thread From: Hugh Daschbach @ 2020-10-30 3:21 UTC (permalink / raw) To: 44298-done ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-30 8:07 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-10-29 2:55 bug#44298: 28.0.50; D-Bus GetManagedObjects doesn't enumerate all paths Hugh Daschbach 2020-10-29 15:59 ` Michael Albinus 2020-10-30 3:03 ` Hugh Daschbach 2020-10-30 8:07 ` Michael Albinus 2020-10-30 3:21 ` bug#44298: Resolved Hugh Daschbach
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).