[Top][All Lists]

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

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

From: John Darrington
Subject: Re: [PATCH] .edit: Fix bug searching for sensible-editor
Date: Sat, 29 Feb 2020 15:25:31 +0100
User-agent: Mutt/1.10.1 (2018-07-13)

On Sat, Feb 29, 2020 at 03:18:10PM +0100, Jose E. Marchesi wrote:
              But this makes me think whether `find_in_path' is the right tool 
              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
         I don't see what problems that would cause.  find_in_path would find 
         and run it.  Where would the problem be?
     Wouldn't find_in_path return "sensible-editor" in that case?  Then
     editor would be NULL.

A quick experiment shows that it returns "./sensible-editor".  So 
strcmp ("sensible-editor", "./sensible-editor") != 0 and thus editor !=


                   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 
                        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]