Bug 97388 - Adding categories when list is not ending with ; broke with 0.23
Summary: Adding categories when list is not ending with ; broke with 0.23
Status: RESOLVED FIXED
Alias: None
Product: desktop-file-utils
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Hans Petter Jansson
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-18 02:02 UTC by Pascal Terjan
Modified: 2016-08-18 13:47 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch fixing the issue (1023 bytes, patch)
2016-08-18 02:02 UTC, Pascal Terjan
Details | Splinter Review
Patch fixing the problem (1.00 KB, patch)
2016-08-18 12:11 UTC, Pascal Terjan
Details | Splinter Review
Patch fixing the problem (1.01 KB, patch)
2016-08-18 12:13 UTC, Pascal Terjan
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Terjan 2016-08-18 02:02:54 UTC
Created attachment 125863 [details] [review]
Patch fixing the issue

http://pkgsubmit.mageia.org/autobuild/cauldron/x86_64/core/2016-08-17/denemo-2.0.8-1.mga6.src.rpm/build.0.20160817211016.log

+ desktop-file-install --vendor= --remove-category=Application
--add-category=GTK --dir
/home/pterjan/rpmbuild/BUILDROOT/denemo-2.0.8-1.mga6.x86_64/usr/share/applications
/home/pterjan/rpmbuild/BUILDROOT/denemo-2.0.8-1.mga6.x86_64/usr/share/applications/denemo.desktop
/home/pterjan/rpmbuild/BUILDROOT/denemo-2.0.8-1.mga6.x86_64/usr/share/applications/denemo.desktop:
error: value "GNOME;Audio;AudioVideo;Music;EducationGTK;" for key
"Categories" in group "Desktop Entry" contains an unregistered value
"EducationGTK"; values extending the format should start with "X-"
/

http://pkgsubmit.mageia.org/autobuild/cauldron/x86_64/core/2016-08-17/projectx-0.91.0-9.mga6.src.rpm/build.0.20160817211016.log

+ desktop-file-install --vendor= --add-category=Java
--add-category=AudioVideo --add-category=AudioVideoEditing --dir
/home/pterjan/rpmbuild/BUILDROOT/projectx-0.91.0-9.mga6.x86_64/usr/share/applications
/home/pterjan/rpmbuild/BUILDROOT/projectx-0.91.0-9.mga6.x86_64/usr/share/applications/projectx.desktop
/home/pterjan/rpmbuild/BUILDROOT/projectx-0.91.0-9.mga6.x86_64/usr/share/applications/projectx.desktop:
error: value "AudioVideo;AudioVideoEditingJava;AudioVideoEditing;" for
key "Categories" in group "Desktop Entry" contains an unregistered
value "AudioVideoEditingJava"; values extending the format should
start with "X-"
Error on file "/home/pterjan/rpmbuild/BUILDROOT/projectx-0.91.0-9.mga6.x86_64/usr/share/applications/projectx.desktop":
Failed to validate the created desktop file

I believe this is due to https://cgit.freedesktop.org/xdg/desktop-file-utils/commit/?id=9e279cc3fac9a7e92bf426867fa83c0c7aec5711 as missing ";" at the end of lists are no longer added.

I wrote a patch but did not test it yet.
Comment 1 Pascal Terjan 2016-08-18 02:07:07 UTC
Comment on attachment 125863 [details] [review]
Patch fixing the issue

I have now tested that it fixes the problem.
Comment 2 Hans Petter Jansson 2016-08-18 10:27:21 UTC
Comment on attachment 125863 [details] [review]
Patch fixing the issue

Review of attachment 125863 [details] [review]:
-----------------------------------------------------------------

Good catch! The patch looks good except for some minor formatting nits.

::: src/keyfileutils.c
@@ +187,5 @@
>  
>    value = g_key_file_get_value (keyfile, group, key, NULL);
>  
> +  if (value) {
> +    size_t l = strlen(value);

Needs space after "strlen", i.e. strlen (value). I'd prefer "len" over "l" as the variable name, since we use that elsewhere.

@@ +188,5 @@
>    value = g_key_file_get_value (keyfile, group, key, NULL);
>  
> +  if (value) {
> +    size_t l = strlen(value);
> +    if (l > 0 && value[l-1] != ';') {

Needs space around operator, i.e. "value[len - 1]".
Comment 3 Pascal Terjan 2016-08-18 12:11:12 UTC
Created attachment 125873 [details] [review]
Patch fixing the problem
Comment 4 Pascal Terjan 2016-08-18 12:13:04 UTC
Created attachment 125874 [details] [review]
Patch fixing the problem

Here is an updated patch
Comment 5 Hans Petter Jansson 2016-08-18 13:47:56 UTC
Thanks! Committed to master:

https://cgit.freedesktop.org/xdg/desktop-file-utils/commit/?id=d281ed4b9db22ff9e4c7e56b5cce58a72d11fc54


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.