FedeDP / Clight

A C daemon that turns your webcam into a light sensor. It will adjust screen backlight based on ambient brightness.
GNU General Public License v3.0
732 stars 27 forks source link

[BUG] Invalid desktop file #271

Closed ferki closed 1 year ago

ferki commented 1 year ago

Clight version the issue has been seen with:

4.9

Used distribution:

Gentoo

Describe the bug

Part of the installation process on Gentoo is to run .desktop files through QA checks, and it complains about validation errors (as reported via ferki/gentoo-overlay#3; see relevant build.log entries).

Running the failing desktop file through desktop-file-validate explains the error as:

key "Exec" in group "Desktop Action ForceGamma" contains a reserved character '&' outside of a quote

which is also potentially a bug, since the Exec key might not be able to run both specified commands as expected.

See also:

Expected behavior

Desktop files installed by clight must be valid.

To Reproduce

Run desktop-file-validate Extra/desktop/clightc.desktop in a cloned git repo.

Not attaching a Clight verbose log, as it seems irrelevant for this bug. Let me know if you still need those details.

FedeDP commented 1 year ago

Hi! Thanks for opening this issue, and great catch! Are you willing to open a PR to fix the issue?

ferki commented 1 year ago

Are you willing to open a PR to fix the issue?

In general, yes, but I have no idea which way of solving this would be ideal or preferred, so I'd need guidance – especially given that I don't use this part of clight at all, so I'm also not sure how to test :)

The few ideas that go through my mind at first glance:

FedeDP commented 1 year ago

Given the exec spec, i'd say this should work:

sh -c "busctl --expect-reply=false --user set-property org.clight.clight /org/clight/clight/Conf/Gamma org.clight.clight.Conf.Gamma DayTemp "i" 0 && busctl --expect-reply=false --user set-property org.clight.clight /org/clight/clight/Conf/Gamma org.clight.clight.Conf.Gamma NightTemp "i" 0"

With this patch, desktop-file-validate does not complain anymore and the desktop file works fine ;) I will push the change!

ferki commented 1 year ago

Oh, yeah, that might work too, thanks! :)

I can confirm that desktop-file-validate is not complaining anymore :+1:

I wonder whether sh gets confused by all the double quotes in there or not, though.

FedeDP commented 1 year ago

I tested and it worked for me :)