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 705522 - Validating mandatory tags for non empty literal value
Validating mandatory tags for non empty literal value
Status: RESOLVED FIXED
Product: gupnp-av
Classification: Other
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GUPnP Maintainers
GUPnP Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-05 15:32 UTC by Parthiban Balasubramanian
Modified: 2019-02-22 05:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Validating non empty literal value (1.60 KB, text/plain)
2013-08-05 15:33 UTC, Parthiban Balasubramanian
  Details
Validating non empty literal value Updated (1.63 KB, patch)
2013-08-05 15:39 UTC, Parthiban Balasubramanian
needs-work Details | Review
Updated Patch for checking empty madatory tags (1.70 KB, patch)
2013-12-06 19:08 UTC, Parthiban Balasubramanian
none Details | Review
Check for mandatory tags - Assumptions added (1.78 KB, patch)
2014-01-30 15:55 UTC, Parthiban Balasubramanian
committed Details | Review

Description Parthiban Balasubramanian 2013-08-05 15:32:48 UTC
Check must be done for checking if the mandatory tags(dc:title, dc:class) are not being set to an empty literal while performing UpdateObject.
Comment 1 Parthiban Balasubramanian 2013-08-05 15:33:24 UTC
Created attachment 250891 [details]
Validating non empty literal value
Comment 2 Parthiban Balasubramanian 2013-08-05 15:39:11 UTC
Created attachment 250892 [details] [review]
Validating non empty literal value Updated

Fixed Whitespaces
Comment 3 Parthiban Balasubramanian 2013-11-13 20:45:18 UTC
Any comments on this patch ?
Comment 4 Jens Georg 2013-11-14 19:23:05 UTC
Review of attachment 250892 [details] [review]:

ok
Comment 5 Jens Georg 2013-11-17 15:17:39 UTC
Review of attachment 250892 [details] [review]:

Sorry, while trying to apply and fix the style issues I actually had some more comments on this.

::: libgupnp-av/fragment-util.c
@@ +711,3 @@
         }
 
+        // If the child element is title or class it must not be set to empty or removed.

No C++/C90 style comments, please.

@@ +712,3 @@
 
+        // If the child element is title or class it must not be set to empty or removed.
+        if (current_doc->children->children != NULL) {

Can we safely assume that current_doc->children is non-NULL here?

@@ +714,3 @@
+        if (current_doc->children->children != NULL) {
+            if (g_strrstr(current_doc->children->children->name,"title") != NULL
+             || g_strrstr(current_doc->children->children->name,"class") != NULL){

|| on previous line, also missing " " before (, { and " and the whole line is too long.
Comment 6 Parthiban Balasubramanian 2013-11-18 17:45:35 UTC
Will work on it and update a new patch soon.
Comment 7 Parthiban Balasubramanian 2013-12-06 17:55:39 UTC
Review of attachment 250892 [details] [review]:

::: libgupnp-av/fragment-util.c
@@ +711,3 @@
         }
 
+        // If the child element is title or class it must not be set to empty or removed.

Done

@@ +712,3 @@
 
+        // If the child element is title or class it must not be set to empty or removed.
+        if (current_doc->children->children != NULL) {

There were instances where has been NULL(negative scenarios where we need to return validation error). Thats why added this check.

@@ +714,3 @@
+        if (current_doc->children->children != NULL) {
+            if (g_strrstr(current_doc->children->children->name,"title") != NULL
+             || g_strrstr(current_doc->children->children->name,"class") != NULL){

Done. Attaching the new patch..
Comment 8 Parthiban Balasubramanian 2013-12-06 19:08:37 UTC
Created attachment 263690 [details] [review]
Updated Patch for checking empty madatory tags
Comment 9 Parthiban Balasubramanian 2013-12-06 19:09:57 UTC
Addressed all the review comments. Hope I did not miss anything else.
Comment 10 Parthiban Balasubramanian 2014-01-13 19:55:09 UTC
@Jens : Does this look better?
Comment 11 Jens Georg 2014-01-16 09:31:25 UTC
The patch still assumes that doc->children is non-NULL. Is that the case? If so, we should comment that.
Comment 12 Parthiban Balasubramanian 2014-01-30 14:05:00 UTC
Yes tried various scenarios, did not encounter where doc->children is NULL. I will add a comment to place the assumption.
Comment 13 Parthiban Balasubramanian 2014-01-30 15:55:14 UTC
Created attachment 267655 [details] [review]
Check for mandatory tags - Assumptions added
Comment 14 Parthiban Balasubramanian 2014-01-30 15:55:23 UTC
New patch added. Add the doc->children is non-NULL assumption as a comment.
Comment 15 Jens Georg 2014-02-01 09:58:00 UTC
Review of attachment 267655 [details] [review]:

k
Comment 16 Jens Georg 2014-02-01 09:58:36 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.