poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] .edit: Fix bug searching for sensible-editor


From: Jose E. Marchesi
Subject: Re: [PATCH] .edit: Fix bug searching for sensible-editor
Date: Sat, 29 Feb 2020 14:56:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hi John.

    Contrary to what I thought, find_in_path returns its argument
    verbatim (and not null) if the program is not found.

The fix is of course OK for master.

But this makes me think whether `find_in_path' is the right tool to
determine whether sensible-editor exists or not.  What if the user has
. in her PATH and her sensible-editor is in the current directory, for
example?

    ---
     src/pk-editor.c | 6 +++++-
     1 file changed, 5 insertions(+), 1 deletion(-)
    
    diff --git a/src/pk-editor.c b/src/pk-editor.c
    index fd7664c4..ad2f33cc 100644
    --- a/src/pk-editor.c
    +++ b/src/pk-editor.c
    @@ -48,7 +48,11 @@ pk_cmd_editor (int argc, struct pk_cmd_arg argv[], 
uint64_t uflags)
       /* Debian based systems should always have "sensible-editor"
          in the path.  */
       if (!editor)
    -    editor = find_in_path ("sensible-editor");
    +    {
    +      editor = find_in_path ("sensible-editor");
    +      if (strcmp (editor, "sensible-editor") == 0)
    +   editor = NULL;
    +    }
       if (!editor)
         {
           pk_term_class ("error");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]