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 701637 - AV1-MS:1-CD:1-8.1: UpdateObject does not work
AV1-MS:1-CD:1-8.1: UpdateObject does not work
Status: RESOLVED FIXED
Product: rygel
Classification: Applications
Component: librygel-server
git master
Other Linux
: Normal normal
: ---
Assigned To: rygel-maint
rygel-maint
ivi,upnp-ctt
Depends on:
Blocks:
 
 
Reported: 2013-06-05 11:16 UTC by Mark Ryan
Modified: 2013-06-28 14:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Modified didl-lite xsd for fixing dlna namespace validation error for UpdateObject (16.61 KB, application/xml)
2013-06-05 14:18 UTC, Parthiban Balasubramanian
  Details
server: Drop dlnaManaged attribute on UpdateItem (1.23 KB, patch)
2013-06-06 10:49 UTC, Jens Georg
none Details | Review
server: Drop dlna: ns attributes on UpdateObject (2.32 KB, patch)
2013-06-17 15:37 UTC, Jens Georg
committed Details | Review
Patch to add dc:creator support for video items. (9.89 KB, patch)
2013-06-18 14:47 UTC, Parthiban Balasubramanian
needs-work Details | Review
Follow up patch for "247161: Patch to add dc:creator support for video items." (5.64 KB, patch)
2013-06-19 04:14 UTC, Parthiban Balasubramanian
none Details | Review
Latest patch for including dc:creator in MediaItem (11.27 KB, patch)
2013-06-27 20:01 UTC, Parthiban Balasubramanian
committed Details | Review

Description Mark Ryan 2013-06-05 11:16:28 UTC
This is easily reproducible from dLeyna.


> obj = MediaObject("/com/intel/dLeynaServer/server/2/3965666633613463356362393661663535663737343538356532626231646332")
> obj.update({"DisplayName":"B-LPCM-1-renamed.wav"},[])

dLeyna prints out the error

dbus.exceptions.DBusException: com.intel.dleyna.OperationFailed: Update Object operation  failed: Bad new tag value.

Rygel displays the following error:


(rygel:20792): Rygel-WARNING **: Failed to update object '9eff3a4c5cb96af55f774585e2bb1dc2': Bad new tag value.
Entity: line 2: Schemas validity error : Element '{urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/}item', attribute '{urn:schemas-dlna-org:metadata-1-0/}dlnaManaged': The attribute '{urn:schemas-dlna-org:metadata-1-0/}dlnaManaged' is not allowed.

And here is a wireshark log of the UpdateObject request.

POST /Control/MediaExport/RygelContentDirectory HTTP/1.1
Host: 127.0.0.1:46922
SOAPAction: "urn:schemas-upnp-org:service:ContentDirectory:3#UpdateObject"
Accept-Language: en-us;q=1, en;q=0.5
Accept-Encoding: gzip
Content-Type: text/xml; charset="utf-8"
User-Agent: dLeyna/0.0.2 GUPnP/0.20.3 DLNADOC/1.50
Connection: Keep-Alive
Content-Length: 479

<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:UpdateObject xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:3"><ObjectID>9eff3a4c5cb96af55f774585e2bb1dc2</ObjectID><CurrentTagValue>&lt;dc:title&gt;B-LPCM-1.wav&lt;/dc:title&gt;</CurrentTagValue><NewTagValue>&lt;dc:title&gt;B-LPCM-1-renamed.wav&lt;/dc:title&gt;</NewTagValue></u:UpdateObject></s:Body></s:Envelope>HTTP/1.1 500 Internal Server Error
Date: Wed, 05 Jun 2013 11:03:16 GMT
Content-Type: text/xml; charset="utf-8"
Ext: 
Server: Linux/3.8.0-21-generic UPnP/1.0 GUPnP/0.20.3
Content-Length: 423

<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>703</errorCode><errorDescription>Bad new tag value.</errorDescription></UPnPError></detail></s:Fault></s:Body></s:Envelope>
Comment 1 Mark Ryan 2013-06-05 11:19:03 UTC
Note the problem may actually be in gupnp-av ( gupnp_didl_lite_object_apply_fragments).

We may also be able to provide a patch shortly.
Comment 2 Parthiban Balasubramanian 2013-06-05 14:18:09 UTC
Created attachment 246078 [details]
Modified didl-lite xsd for fixing dlna namespace validation error for UpdateObject

Modified snippet to fix xsd validation:
<xsd:attributeGroup name="commonAttrs-item-container.group">
.....
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:attributeGroup>
Comment 3 Mark Ryan 2013-06-05 14:33:09 UTC
This fixes the problem for me, although I have to admit I don't understand the XSD stuff.

BTW., there is an extra space introduced in line 2, the line starting with <xsd:schema, which doesn't seem to be needed.

You might want to attach a patch file created with git-format-patch to allow your fix to be easily integrated and of course to get credit for your work.
Comment 4 Jussi Kukkonen 2013-06-06 07:35:27 UTC
(In reply to comment #2)
+               <xsd:anyAttribute namespace="##any" processContents="lax"/>

I'm not an expert on didl-lite either but I think this does require some more explanation: the xsd file comes from upnp.org and is referenced from the UPnP AV spec (we are not using the newest xsd file but as far as I can tell the only changes are moving documentation indentation back and forth).
Comment 5 Jens Georg 2013-06-06 08:00:24 UTC
IIRC We're using the XSD that was mentioned in the ContentDirectory:3 spec.

I think the issue here is rather why does gupnp-av thing the "dlnaManaged" attribute was changed. I can't see it in the wireshark log.
Comment 6 Jens Georg 2013-06-06 10:16:23 UTC
hrm. This is a side-effect of DLNA not providing xsd's for their namespace (and UPnP now knowing about DLNA here).

I wouldn't really want to lower that to "lax" for all attributes, that seems to wide. Either drop the dlna:managed before validating or add that explicitly to the XSD.
Comment 7 Mark Ryan 2013-06-06 10:32:33 UTC
>I think the issue here is rather why does gupnp-av thing the "dlnaManaged"
>attribute was changed. I can't see it in the wireshark log.

So the problem seems to be in MediaObject.apply_fragments.

This function first creates a GUPnPDIDLObject from the object that is being updated.  This object includes all the current properties of the object including the dlnaManaged attribute.  It then calls gupnp_didl_lite_object_apply_fragments on that object.

It's not entirely clear to me how this works, but I think the code updates a copy of the GUPnPDIDLObject with the new values and then checks that the new object is valid by checking against the XSD.  However, the GUPnPDIDLObject contains the dlnaManaged attribute and so the check fails.
Comment 8 Jens Georg 2013-06-06 10:49:20 UTC
Created attachment 246136 [details] [review]
server: Drop dlnaManaged attribute on UpdateItem
Comment 9 Jens Georg 2013-06-06 10:50:08 UTC
That works for me, but not sure what the side-effects are, for example some client trying to modify dlnaManaged.
Comment 10 Mark Ryan 2013-06-06 12:18:44 UTC
Works for me too.  Client's are not allowed to modify dlnaManaged and I think the code would still return an error if they tried to do so, right?  If so, we should be okay.
Comment 11 Parthiban Balasubramanian 2013-06-06 14:13:23 UTC
@Jens : Shouldn't the dlnaManaged attribute added back after validation is complete, Since dlnaManaged attribute is needed in the original document?
Comment 12 Mark Ryan 2013-06-06 14:27:53 UTC
If I read the code correctly the original object is not replaced.  Certain properties are copied from the modified object to the original object and so dlnaManaged is preserved.

I tested this with dLeyna and this seems to be the case.
Comment 13 Parthiban Balasubramanian 2013-06-06 14:30:32 UTC
Makes sense. I missed that part. Then patch Jens has provided would solve it perfect.
Comment 14 Jens Georg 2013-06-06 14:59:49 UTC
Yes, that DIDL object is just used the way Mark said.
Comment 15 Jens Georg 2013-06-12 14:08:43 UTC
So if we apply that, the test runs into

Schemas validity error : Element '{urn:schemas-upnp-org:metadata-1-0/upnp/}albumArtURI', attribute '{urn:schemas-dlna-org:metadata-1-0/}profileID': The attribute '{urn:schemas-dlna-org:metadata-1-0/}profileID' is not allowed.

Which starts to get slightly annoying.
Comment 16 Parthiban Balasubramanian 2013-06-12 14:18:06 UTC
The only way to avoid this would be either to remove all dlna namespaces attributes before validation for all elements or define a xsd for knowm dlna attibutes within gupnp.
Comment 17 Parthiban Balasubramanian 2013-06-12 14:21:57 UTC
@Jens : Are you running into this for DMR or DMS tests?
Comment 18 Jens Georg 2013-06-12 15:01:11 UTC
DMS
Comment 19 Jens Georg 2013-06-12 15:03:36 UTC
Schemas validity error : Element '{urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/}item': Character content other than whitespace is not allowed because the content type is 'element-only'. also sounds weird.
Comment 20 Parthiban Balasubramanian 2013-06-12 15:09:19 UTC
(In reply to comment #19)
> Schemas validity error : Element
> '{urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/}item': Character content other
> than whitespace is not allowed because the content type is 'element-only'. also
> sounds weird.

I think I have seen this error when the test tool is executing negative test scenarios. And the error is valid since item element must not have content other than elements under it.

But are you seeing the test failing because of this reason?
Comment 21 Jens Georg 2013-06-12 15:10:45 UTC
yes, you're right, this is "correct", I misinterpreted the output.
Comment 22 Jens Georg 2013-06-17 15:37:26 UTC
Created attachment 247042 [details] [review]
server: Drop dlna: ns attributes on UpdateObject

We cannot validate them and the UpdateObject action fails because of
that, so we walk the node and remove all those attributes.
Comment 23 Jens Georg 2013-06-17 15:43:51 UTC
Still, after fixing this, the UPnP CTT tries to add a dc:creator which fails since we don't explicitly support that ...
Comment 24 Jens Georg 2013-06-17 15:47:15 UTC
For some weird reason we only support dc:creator on photoItem
Comment 25 Parthiban Balasubramanian 2013-06-17 19:38:50 UTC
@Jens : I encountered cd:creator issue. I added this support in our local branch. I will update the patch soon.
Comment 26 Parthiban Balasubramanian 2013-06-18 14:47:24 UTC
Created attachment 247161 [details] [review]
Patch to add dc:creator support for video items.

This adds a new column for creator in addition to author element
Comment 27 Jens Georg 2013-06-18 17:33:41 UTC
Review of attachment 247161 [details] [review]:

The commit message should be "server,media-export: Support dc:creator"  or something like that.

::: src/librygel-server/rygel-video-item.vala
@@ +142,3 @@
+        case "dc:creator":
+            return this.compare_string_props (this.creator, item.creator);
+        // Replaced dc:author with upnp:author

No need to comment that, better put into commit message

::: src/plugins/media-export/rygel-media-export-sql-factory.vala
@@ +86,3 @@
     private const string SAVE_META_DATA_STRING =
     "INSERT OR REPLACE INTO meta_data " +
+        "(size, mime_type, width, height, class, creator, " +

Always add new columns at the end in this list, it avoids the error-prone column renumbering you have to do otherwise

@@ +117,3 @@
     private const string ALL_DETAILS_STRING =
     "o.type_fk, o.title, m.size, m.mime_type, m.width, " +
+    "m.height, m.class, m.creator, m.author, m.album, m.date, m.bitrate, " +

Same as above
Comment 28 Parthiban Balasubramanian 2013-06-19 04:14:52 UTC
Created attachment 247227 [details] [review]
Follow up patch for "247161: Patch to add dc:creator support for video items."

This is in response to "247161: Patch to add dc:creator support for video items."
Comment 29 Jens Georg 2013-06-20 10:42:07 UTC
the current dc:creator support (without the patch) is also the reason for 7.3.66.2 failing if you happen to have a full tags MP3 in your media content
Comment 30 Jens Georg 2013-06-24 10:52:06 UTC
parthiban: Did you mean to obsolete the second patch in comment 28?
Comment 31 Jens Georg 2013-06-24 14:30:03 UTC
also, fixing it just for VideoItem isn't enough...
Comment 32 Parthiban Balasubramanian 2013-06-24 14:32:40 UTC
(In reply to comment #30)
> parthiban: Did you mean to obsolete the second patch in comment 28?
Yes I made it obsolete. I wanted to do some more testing on the updated patch, since I was seeing some failures in DLNA CTT after this change. Will soon update another patch after more testing.
Comment 33 Parthiban Balasubramanian 2013-06-24 14:34:08 UTC
(In reply to comment #31)
> also, fixing it just for VideoItem isn't enough...
by this you mean, we have to fix this for audio items?
Comment 34 Jens Georg 2013-06-24 14:39:34 UTC
(In reply to comment #33)
> (In reply to comment #31)
> > also, fixing it just for VideoItem isn't enough...
> by this you mean, we have to fix this for audio items?

Yes, UPnP CTT does this test with an audio item here. So moving it up to MediaItem should be "the right thing"
Comment 35 Parthiban Balasubramanian 2013-06-24 14:43:21 UTC
Got it. I am testing only with Videos items so I did not see this coming.
I will make the changes to move it to MediaItem and upload a new patch.
Comment 36 Jens Georg 2013-06-25 10:28:23 UTC
Comment on attachment 247042 [details] [review]
server: Drop dlna: ns attributes on UpdateObject

Attachment 247042 [details] pushed as 549ddb8 - server: Drop dlna: ns attributes on UpdateObject
Comment 37 Parthiban Balasubramanian 2013-06-27 20:01:14 UTC
Created attachment 247933 [details] [review]
Latest patch for including dc:creator in MediaItem

Moved the logic from Individual sub classes and moved it into MediaItem. Also incorporated review comments from Jens
Comment 38 Parthiban Balasubramanian 2013-06-27 20:02:40 UTC
Comment on attachment 247161 [details] [review]
Patch to add dc:creator support for video items.

Updated a latest patch. So this is obsolete.
Comment 39 Jens Georg 2013-06-28 14:18:49 UTC
Nice. Two fails down.