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 728372 - Bad command validation in ItemEditor, LauncherEditor.resync_validity
Bad command validation in ItemEditor, LauncherEditor.resync_validity
Status: RESOLVED OBSOLETE
Product: alacarte
Classification: Applications
Component: general
3.11.x
Other Linux
: Normal normal
: ---
Assigned To: Alacarte Maintainer(s)
Alacarte Maintainer(s)
: 738360 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-04-16 20:24 UTC by OmegaPhil
Modified: 2021-05-25 17:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix bad command validation (1.21 KB, patch)
2014-04-16 20:25 UTC, OmegaPhil
reviewed Details | Review
Fix bad command validation v2 (1.48 KB, patch)
2014-04-18 12:25 UTC, OmegaPhil
none Details | Review

Description OmegaPhil 2014-04-16 20:24:26 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.
Comment 1 OmegaPhil 2014-04-16 20:25:09 UTC
Created attachment 274519 [details] [review]
Fix bad command validation

First attempt to attach failed?
Comment 2 Jasper St. Pierre (not reading bugmail) 2014-04-16 20:54:05 UTC
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:`
Comment 3 OmegaPhil 2014-04-18 12:25:13 UTC
Created attachment 274664 [details] [review]
Fix bad command validation v2
Comment 4 Jasper St. Pierre (not reading bugmail) 2014-04-18 14:07:08 UTC
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.
Comment 5 OmegaPhil 2014-04-18 14:24:22 UTC
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.
Comment 6 Jasper St. Pierre (not reading bugmail) 2014-04-18 14:58:35 UTC
Here is fine, but I idle on GIMPNet / Freenode. I'm "Jasper" on both.
Comment 7 Pedro Beja 2014-10-11 19:33:49 UTC
*** Bug 738360 has been marked as a duplicate of this bug. ***
Comment 8 André Klapper 2021-05-25 17:44:46 UTC
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.