unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Hugh Daschbach <hugh@ccss.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 43146@debbugs.gnu.org
Subject: bug#43146: 27.1; D-Bus property handling incomplete
Date: Wed, 02 Sep 2020 15:01:43 -0700	[thread overview]
Message-ID: <877dtbsurc.fsf@ccss.com> (raw)
In-Reply-To: <87a6y8roj2.fsf@ccss.com>

[-- Attachment #1: Type: text/plain, Size: 1286 bytes --]


Hugh Daschbach writes:

> Michael Albinus writes:
>
>> I could reproduce the bug locally. The following patch solves 
>> it 
>> for me,
>> could you pls check?
>
> Michael, thank you for such a  quick fix.  I've tested this and 
> it 
> does
> indeed fix my issue.
>
> Looking at how you fix it, I wonder if the change to 
> dbus-property-handler
> should also apply to the "Set" and "GetAll" cond clauses.
>
> Many thanks.
> Hugh

I've tweaked the test script to examine the "Set" and "GetAll" 
methods. The updated version is attached below.

Here's the sequence of operations:

/node0                             /node1
------                             ------
register prop, value "-node0-"
get prop, value is  "-node0-"
                                   register prop, value "-node1-"
get prop, value is  "-node0-"
                                   get prop, value is "-node1-"
                                   set prop, value "-replaced-"
get prop, no value returned
                                   get prop, value is "-replaced-"
getall, empty array returned

So I think the "Set" performed on /node1 corrupted the value of 
the property no /node0.  The last two operations on /node0 suggest 
the value of /node0's property is no longer available.

Thanks again,
Hugh



[-- Attachment #2: D-Bus properties set/getall test script. --]
[-- Type: text/plain, Size: 5071 bytes --]

;;; dbus-properties-test.el --- Test program for complex :dict-entry.  -*- lexical-binding: t; -*-

;; Copyright (C) 2020  Hugh Daschbach

;; Author: Hugh Daschbach <hugh@ccss.com>
;; Keywords: tools

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; This program demonstrates an error in handling D-Bus properties
;; interface.
;;
;; `dbus-property-handler' provides an org.freedesktop.DBus.Properties
;; interface to respond to requests for registered properties.  But,
;; unlike methods and signals, properties are not stored per interface
;; per object.  They are merely stored per interface.
;;
;; So the current implementation cannot support properties on the same
;; interface with a different object path.


;;; Code:

(require 'dbus)

(defun main ()
  (interactive)
  (setq dbus-debug t)
  (setq debug-on-error t)
  (dbus-register-property :system
                          "org.gnu.Emacs"
                          "/node0"
                          "org.bluez.GattService1"
                          "Device"
                          :readwrite
                          "-node0-")
  (start-process "node0-get" "*node0*"
                 "dbus-send"
                 "--system"
                 "--print-reply"
                 (concat
                  "--dest="
                  (dbus-get-unique-name :system))
                 "/node0"
                 "org.freedesktop.DBus.Properties.Get"
                 "string:org.bluez.GattService1"
                 "string:Device")
  (sit-for 1)
  (dbus-register-property :system
                          "org.gnu.Emacs"
                          "/node1"
                          "org.bluez.GattService1"
                          "Device"
                          :readwrite
                          "-node1-")
  (start-process "node0-get" "*node0*"
                 "dbus-send"
                 "--system"
                 "--print-reply"
                 (concat
                  "--dest="
                  (dbus-get-unique-name :system))
                 "/node0"
                 "org.freedesktop.DBus.Properties.Get"
                 "string:org.bluez.GattService1"
                 "string:Device")
  (start-process "node1-get" "*node1*"
                 "dbus-send"
                 "--system"
                 "--print-reply"
                 (concat
                  "--dest="
                  (dbus-get-unique-name :system))
                 "/node1"
                 "org.freedesktop.DBus.Properties.Get"
                 "string:org.bluez.GattService1"
                 "string:Device")
  (start-process "node1-set" "*node1*"
                 "dbus-send"
                 "--system"
                 "--print-reply"
                 (concat
                  "--dest="
                  (dbus-get-unique-name :system))
                 "/node1"
                 "org.freedesktop.DBus.Properties.Set"
                 "string:org.bluez.GattService1"
                 "string:Device"
                 "variant:string:-replaced-")
  (sit-for 1)
  (start-process "node0-get" "*node0*"
                 "dbus-send"
                 "--system"
                 "--print-reply"
                 (concat
                  "--dest="
                  (dbus-get-unique-name :system))
                 "/node0"
                 "org.freedesktop.DBus.Properties.Get"
                 "string:org.bluez.GattService1"
                 "string:Device")
  (start-process "node1-get" "*node1*"
                 "dbus-send"
                 "--system"
                 "--print-reply"
                 (concat
                  "--dest="
                  (dbus-get-unique-name :system))
                 "/node1"
                 "org.freedesktop.DBus.Properties.Get"
                 "string:org.bluez.GattService1"
                 "string:Device")
  (start-process "node0-get" "*node0*"
                 "dbus-send"
                 "--system"
                 "--print-reply"
                 (concat
                  "--dest="
                  (dbus-get-unique-name :system))
                 "/node0"
                 "org.freedesktop.DBus.Properties.GetAll"
                 "string:org.bluez.GattService1"
                 "string:Device")

  (sit-for 1)
  (split-window-below)
  (switch-to-buffer "*node0*")
  (goto-char (point-min))
  (other-window 1)
  (switch-to-buffer "*node1*")
  (goto-char (point-min)))

(provide 'dbus-properties-test)

;;; dbus-properties-test.el ends here

  reply	other threads:[~2020-09-02 22:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01  1:41 bug#43146: 27.1; D-Bus property handling incomplete Hugh Daschbach
2020-09-02 17:58 ` Michael Albinus
2020-09-02 19:01   ` Hugh Daschbach
2020-09-02 22:01     ` Hugh Daschbach [this message]
2020-09-03 11:52       ` Michael Albinus
2020-09-03 18:23         ` Hugh Daschbach
2020-09-03 18:57           ` Michael Albinus
2020-09-03  6:50     ` Michael Albinus

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877dtbsurc.fsf@ccss.com \
    --to=hugh@ccss.com \
    --cc=43146@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /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 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).