From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#43146: 27.1; D-Bus property handling incomplete Date: Thu, 03 Sep 2020 13:52:50 +0200 Message-ID: <87o8mnt6ul.fsf@gmx.de> References: <873642mfxd.fsf@ccss.com> <87zh68hxgz.fsf@gmx.de> <87a6y8roj2.fsf@ccss.com> <877dtbsurc.fsf@ccss.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31747"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 43146@debbugs.gnu.org To: Hugh Daschbach Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 03 13:53:32 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDno3-0008AA-IP for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Sep 2020 13:53:31 +0200 Original-Received: from localhost ([::1]:43476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDno2-0008Go-Bi for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Sep 2020 07:53:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDnna-0008Gd-L1 for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2020 07:53:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50413) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDnna-0002oc-C8 for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2020 07:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kDnna-0002sP-B7 for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2020 07:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Sep 2020 11:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43146 X-GNU-PR-Package: emacs Original-Received: via spool by 43146-submit@debbugs.gnu.org id=B43146.159913398111051 (code B ref 43146); Thu, 03 Sep 2020 11:53:02 +0000 Original-Received: (at 43146) by debbugs.gnu.org; 3 Sep 2020 11:53:01 +0000 Original-Received: from localhost ([127.0.0.1]:33726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kDnnZ-0002sA-A4 for submit@debbugs.gnu.org; Thu, 03 Sep 2020 07:53:01 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:52683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kDnnX-0002rx-FG for 43146@debbugs.gnu.org; Thu, 03 Sep 2020 07:53:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1599133971; bh=GO6jP7RCrzeAq2eoa+ON2LxL1uojy4sll+Ljaz5MkZU=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=lRrIVCwFnD4nJ4JqftrOdnSPJDRHzd37PjC+UQYP2VCa1KYFT4zoZXonrD3GdmreT PWIwUCDb6CoP/2EE024NnU7x9xcPJ4Uu8IBJvkxSnR5R/dqqWHt2vIiJqv51L00QPB Rf6zCynrualphWMo7BOfEtF43CqpfW+u7oA4zKQM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([213.220.156.38]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MacSY-1kpbej1nz8-00c817; Thu, 03 Sep 2020 13:52:51 +0200 In-Reply-To: <877dtbsurc.fsf@ccss.com> (Hugh Daschbach's message of "Wed, 02 Sep 2020 15:01:43 -0700") X-Provags-ID: V03:K1:mMii7J7RZSTzee/XReGBLx8lWY7aH0DX9UzkVMS2P5MLq7qUBqA be/7eh4WPJMd6VlIWtCapouHxQAl9leV4y+Xs0uD/EhTeNOq2EcVgnbhz8ZPjQt7m+IyoQB opCna5tcGsa3/Zuir1pIoBnA1huiDXQr4yC46Kl6rWfqjldxnJX1Ir0vP6M8A07jMkrD0T3 DY9uK+73gk9b8JHUW440A== X-UI-Out-Filterresults: notjunk:1;V03:K0:z1TQJxig0Vk=:BNgFmJrbAlzLQqy4XFlm5X z/7xsgfZmeRhgSoCYe7Sf4SFsHZjSXjjxMCSLRnprcRu1xin1Moxx/IIikTYo2wxpTAUuENzJ P0kq4a8ASXP8N8kSSK/DFTdlB9WYMuVqgAHmsNN16tua8CEWOJ+iIgD+JfpoZ+mwMOJQ6dn3O rf5qEX1QrxnSJB8BIVRcKo4S7JljNsaGr/TWkkNtrX8F5PgLBBwAc3gNQyNVQkvq5WSonk8Jc 2ICopLa3DEdzZ0KFUxgKRM1FwjmeYi0twIoNsiZ6lsoFQpDPlDEYZvhAHFT4LcC665DDz29tY N1cNuqizE+a8Oc/OLAcW4OqYB2+C2PEYGae1DtK8N0tk6CC6OtaBKbIeZiRGEXfWCIfb6SGg2 tkJSzFytLPvLAIZRPf0t3G55g/J62E3QGFeblNqYQTS0bBS89FP4SM1ALYqab5lmLzy70E4kp kie6Fm7Nfkqb2Dku36khOJgdAGPXfR1uTv21Ca6NTi+rLKFg2chJh/ewmSrShofrU2/D/whoi 9KbFDwjVPDoaYkiO/ZuNhq0L4eJ+vk1vcBaNz4p7fZwKa9pcPiTDL07uyMDw86f0kEW6F1S5m JjjhkGhAtDe2OaebKUeKgP45CGoh/LB1+DhuBh6lrZoFFpOTXoUDes/QoYd/mW5KcSwlRLgXv qH5ApecXxJ8tvyOASTsFDeULpMfhCkjiDGhrWp7eIvpGEEtVfPFPYHN1PtZsTd/nJjrO5+0Ce FWcNloK2nYYk8I921x9NJqbJ8HUSfKHRkf8vopC5zxAkJaMPEPrs4EfL2rHiSpIj/JCaTlgQ X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:187000 Archived-At: --=-=-= Content-Type: text/plain Hugh Daschbach writes: Hi Hugh, > I've tweaked the test script to examine the "Set" and "GetAll" > methods. The updated version is attached below. Thanks for the test file. I've appended another patch, could you pls apply this instead of the first one? Locally, I've tested your script successfully. > Thanks again, > Hugh Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable *** /tmp/ediffWCMSQF 2020-09-03 13:49:33.193916784 +0200 =2D-- /home/albinus/src/emacs-27/lisp/net/dbus.el 2020-09-03 13:36:44.9603= 64842 +0200 *************** *** 1477,1482 **** =2D-- 1477,1502 ---- (nreverse result)) (push (cons (car dict) (cl-caadr dict)) result))))) + (defun dbus-get-this-registered-property (bus _service path interface pr= operty) + "Return PROPERTY entry of `dbus-registered-objects-table'. + Filter out not matching PATH." + ;; Remove entries not belonging to this case. + (seq-remove + (lambda (item) + (not (string-equal path (nth 2 item)))) + (gethash (list :property bus interface property) + dbus-registered-objects-table))) + + (defun dbus-get-other-registered-property (bus _service path interface p= roperty) + "Return PROPERTY entry of `dbus-registered-objects-table'. + Filter out matching PATH." + ;; Remove matching entries. + (seq-remove + (lambda (item) + (string-equal path (nth 2 item))) + (gethash (list :property bus interface property) + dbus-registered-objects-table))) + (defun dbus-register-property (bus service path interface property access value &optional emits-signal dont-register-service) *************** *** 1543,1554 **** ;; because the property might be accessed from anybody. (let ((key (list :property bus interface property)) (val ! (list (list nil service path (cons (if emits-signal (list access :emits-signal) (list access)) ! value))))) (puthash key val dbus-registered-objects-table) ;; Return the object. =2D-- 1563,1576 ---- ;; because the property might be accessed from anybody. (let ((key (list :property bus interface property)) (val ! (cons (list nil service path (cons (if emits-signal (list access :emits-signal) (list access)) ! value)) ! (dbus-get-other-registered-property ! bus service path interface property)))) (puthash key val dbus-registered-objects-table) ;; Return the object. *************** *** 1566,1581 **** (cond ;; "Get" returns a variant. ((string-equal method "Get") ! (let ((entry (gethash (list :property bus interface property) ! dbus-registered-objects-table))) (when (string-equal path (nth 2 (car entry))) `((:variant ,(cdar (last (car entry)))))))) ;; "Set" expects a variant. ((string-equal method "Set") (let* ((value (caar (cddr args))) ! (entry (gethash (list :property bus interface property) ! dbus-registered-objects-table)) ;; The value of the hash table is a list; in case of ;; properties it contains just one element (UNAME SERVICE ;; PATH OBJECT). OBJECT is a cons cell of a list, which =2D-- 1588,1603 ---- (cond ;; "Get" returns a variant. ((string-equal method "Get") ! (let ((entry (dbus-get-this-registered-property ! bus service path interface property))) (when (string-equal path (nth 2 (car entry))) `((:variant ,(cdar (last (car entry)))))))) ;; "Set" expects a variant. ((string-equal method "Set") (let* ((value (caar (cddr args))) ! (entry (dbus-get-this-registered-property ! bus service path interface property)) ;; The value of the hash table is a list; in case of ;; properties it contains just one element (UNAME SERVICE ;; PATH OBJECT). OBJECT is a cons cell of a list, which *************** *** 1590,1597 **** (signal 'dbus-error (list "Property not writable at path" property path))) (puthash (list :property bus interface property) ! (list (append (butlast (car entry)) ! (list (cons (car object) value)))) dbus-registered-objects-table) ;; Send the "PropertiesChanged" signal. (when (member :emits-signal (car object)) =2D-- 1612,1621 ---- (signal 'dbus-error (list "Property not writable at path" property path))) (puthash (list :property bus interface property) ! (cons (append (butlast (car entry)) ! (list (cons (car object) value))) ! (dbus-get-other-registered-property ! bus service path interface property)) dbus-registered-objects-table) ;; Send the "PropertiesChanged" signal. (when (member :emits-signal (car object)) *************** *** 1607,1620 **** (let (result) (maphash (lambda (key val) ! (when (and (equal (butlast key) (list :property bus interface)) ! (string-equal path (nth 2 (car val))) ! (not (functionp (car (last (car val)))))) ! (push ! (list :dict-entry ! (car (last key)) ! (list :variant (cdar (last (car val))))) ! result))) dbus-registered-objects-table) ;; Return the result, or an empty array. (list :array (or result '(:signature "{sv}")))))))) =2D-- 1631,1645 ---- (let (result) (maphash (lambda (key val) ! (dolist (item val) ! (when (and (equal (butlast key) (list :property bus interface)) ! (string-equal path (nth 2 item)) ! (not (functionp (car (last item))))) ! (push ! (list :dict-entry ! (car (last key)) ! (list :variant (cdar (last item)))) ! result)))) dbus-registered-objects-table) ;; Return the result, or an empty array. (list :array (or result '(:signature "{sv}")))))))) --=-=-=--