GNOME Bugzilla – Bug 728372
Bad command validation in ItemEditor, LauncherEditor.resync_validity
Last modified: 2021-05-25 17:44:46 UTC
Currently alacarte in git fails to validate commands when they consist of more than a plain binary or binary path. LauncherEditor's resync_validity calls GLib.find_program_in_path direct with the command - this was broken with commit 666d843940b9020c3ffb94e29b306ddcbc566ddf. I have changed this to use GLib.shell_parse_argv to get at the program being used properly (this is the first time I've had to do this mind) - see attached.
Created attachment 274519 [details] [review] Fix bad command validation First attempt to attach failed?
Review of attachment 274519 [details] [review]: ::: Alacarte/ItemEditor.py @@ +184,3 @@ exec_text = self.builder.get_object('exec-entry').get_text() + + valid = False Could you split this logic into another method? def exec_line_is_valid(self, exec_text): try: ... except GLib.GError: return False def resync_validity(...): ... valid = (name_text != "") and self.exec_line_is_valid(exec_text) @@ +186,3 @@ + valid = False + if name_text != "" and exec_text != "": + No blank whitespace at the beginning of blocks, please. @@ +197,3 @@ + valid = (GLib.find_program_in_path(command) is not None) + + except: Please don't use bare except clauses. This should be `except GLib.GError:`
Created attachment 274664 [details] [review] Fix bad command validation v2
Thanks for the patch, Phil! I added a commit message and cleaned it up a tiny bit, e.g. when result[0] is False, it's guaranteed an error will be thrown. It's one of the quirks of gobject-introspection.
Cheers. Is there a better way to communicate with you than the tracker (do you idle on IRC etc?). I'm not after leeching knowledge off you, just occassional basic questions etc.
Here is fine, but I idle on GIMPNet / Freenode. I'm "Jasper" on both.
*** Bug 738360 has been marked as a duplicate of this bug. ***
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new enhancement request ticket at https://gitlab.gnome.org/GNOME/alacarte/-/issues/ Thank you for your understanding and your help.