After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 702451 - UDA-2.1.1: Element order in device and service description is wrong
UDA-2.1.1: Element order in device and service description is wrong
Status: RESOLVED FIXED
Product: rygel
Classification: Applications
Component: librygel-core
git master
Other Linux
: Normal minor
: ---
Assigned To: rygel-maint
rygel-maint
ivi
Depends on:
Blocks:
 
 
Reported: 2013-06-17 12:06 UTC by Jens Georg
Modified: 2013-06-27 15:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
DescriptionFile: create device elements if they do not exists (4.08 KB, patch)
2013-06-27 09:43 UTC, Jussi Kukkonen
none Details | Review
DescriptionFile: create device elements if they do not exists (4.03 KB, patch)
2013-06-27 09:51 UTC, Jussi Kukkonen
committed Details | Review
xml templates: fix element order to match UDA 1.1 (56.55 KB, patch)
2013-06-27 09:51 UTC, Jussi Kukkonen
committed Details | Review
DescriptionFile: Preserve order when adding elements (4.58 KB, patch)
2013-06-27 09:52 UTC, Jussi Kukkonen
committed Details | Review
Only modify the description file from DescriptionFile (16.87 KB, patch)
2013-06-27 09:52 UTC, Jussi Kukkonen
committed Details | Review
RootDeviceFactory: use UUID.get() from UUID.vapi (1.33 KB, patch)
2013-06-27 11:42 UTC, Jussi Kukkonen
committed Details | Review

Description Jens Georg 2013-06-17 12:06:36 UTC
This is a warning in the test, needs fixing in the template files and in code when adding the services.
Comment 1 Jussi Kukkonen 2013-06-26 07:34:04 UTC
So.. We'd have to make sure dynamically modifying the device description doesn't mess with the order (this is already done in RootDeviceFactory.set_description() and will be done in bug 703044). I guess it's enough to have a ordered list of known child names of device-node and check that in DescriptionFile.set_device_element(). Would also need to make RootDeviceFactory only modify the description via DescriptionFile.

I'll see what I can do.
Comment 2 Jussi Kukkonen 2013-06-27 09:43:54 UTC
Created attachment 247884 [details] [review]
DescriptionFile: create device elements if they do not exists

set_device_element() may be called with names of elements that do not
exists yet (non-required elements that are empty by default).

Create elements dynamically in set_device_element(). also, set dlna
namespace for X_DLNACAP and remove the X_DLNACAP element if the
contents are empty.

https://bugzilla.gnome.org/show_bug.cgi?id=703044
Comment 3 Jussi Kukkonen 2013-06-27 09:51:56 UTC
Created attachment 247885 [details] [review]
DescriptionFile: create device elements if they do not exists

set_device_element() may be called with names of elements that do not
exists yet (non-required elements that are empty by default).

Create elements dynamically in set_device_element(). also, set dlna
namespace for X_DLNACAP and remove the X_DLNACAP element if the
contents are empty.

https://bugzilla.gnome.org/show_bug.cgi?id=703044
Comment 4 Jussi Kukkonen 2013-06-27 09:51:59 UTC
Created attachment 247886 [details] [review]
xml templates: fix element order to match UDA 1.1

UPnP Device Architecture 1.1:
"The order of XML elements in device and service description documents
MUST adhere to the order as defined in the corresponding specification"

Note that this commit is not enough for compliance: when we dynamically
add optional elements, we must make sure they appear in the correct
place.
Comment 5 Jussi Kukkonen 2013-06-27 09:52:02 UTC
Created attachment 247887 [details] [review]
DescriptionFile: Preserve order when adding elements

UPnP Device Architecture 1.1 specifies the order of elements
in the device description. Preserve that order when dynamically
adding elements.
Comment 6 Jussi Kukkonen 2013-06-27 09:52:05 UTC
Created attachment 247888 [details] [review]
Only modify the description file from DescriptionFile

RootDeviceFactory used to modify the description xml directly. This is
not optimal as DescriptionFile now keeps the elements in the correct
order.

Move the icon element and service element creation code to
DescriptionFile, start using DescriptionFile public methods to modify
the description from RootDeviceFactory. Swap the order of ControlURL
and EventSubURL elements to match the specification.
Comment 7 Jussi Kukkonen 2013-06-27 09:55:44 UTC
This was a bit more involved than I thought... I can push a branch as well if you prefer that.


Also note that the first patch is really for bug 703044.
Comment 8 Jens Georg 2013-06-27 10:12:07 UTC
Review of attachment 247888 [details] [review]:

Thanks, I meant to clean this up but it wasn't necessary :)

::: src/librygel-core/rygel-root-device-factory.vala
@@ +107,3 @@
+        var udn = file.get_udn ();
+        if (udn == null || udn == "") {
+            file.set_udn (this.generate_random_udn ());

While you're at it, you can remove generate_random_udn and just use "uuid:" + UUID.get ()
Comment 9 Jens Georg 2013-06-27 10:19:55 UTC
Review of attachment 247887 [details] [review]:

Go ahead
Comment 10 Jens Georg 2013-06-27 10:20:16 UTC
Review of attachment 247886 [details] [review]:

Go ahead
Comment 11 Jens Georg 2013-06-27 10:20:44 UTC
Review of attachment 247885 [details] [review]:

Go ahead
Comment 12 Jens Georg 2013-06-27 10:22:05 UTC
Review of attachment 247888 [details] [review]:

Thanks, I meant to clean this up but it wasn't necessary :)

::: src/librygel-core/rygel-root-device-factory.vala
@@ +107,3 @@
+        var udn = file.get_udn ();
+        if (udn == null || udn == "") {
+            file.set_udn (this.generate_random_udn ());

While you're at it, you can remove generate_random_udn and just use "uuid:" + UUID.get ()
Comment 13 Jussi Kukkonen 2013-06-27 11:42:36 UTC
Created attachment 247896 [details] [review]
RootDeviceFactory: use UUID.get() from UUID.vapi

Separate patch to address comment 12.
Comment 14 Jens Georg 2013-06-27 11:50:52 UTC
Review of attachment 247888 [details] [review]:

Ok, go ahead
Comment 15 Jens Georg 2013-06-27 11:51:07 UTC
Review of attachment 247896 [details] [review]:

Go ahead
Comment 16 Jussi Kukkonen 2013-06-27 12:20:05 UTC
Attachment 247886 [details] pushed as 55b7d33 - xml templates: fix element order to match UDA 1.1
Attachment 247887 [details] pushed as c4362ed - DescriptionFile: Preserve order when adding elements
Attachment 247888 [details] pushed as c03cef8 - Only modify the description file from DescriptionFile
Attachment 247896 [details] pushed as c31909a - RootDeviceFactory: use UUID.get() from UUID.vapi
Comment 17 Jussi Kukkonen 2013-06-27 12:27:05 UTC
Review of attachment 247885 [details] [review]:

This one's committed as well, I just got confused after git-bz push failed to modify this: apparently I don't have the bugzilla permissions to change the status of the bug ??
Comment 18 Jens Georg 2013-06-27 12:38:17 UTC
probably.
Comment 19 Jens Georg 2013-06-27 15:09:46 UTC
woah, crap, I forgot to lecture you on commit messages :)