bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: Paul Smith <psmith@gnu.org>
Subject: Re: [PATCH] findprog: Support searching in a specified path string
Date: Sat, 07 Sep 2019 12:42:35 +0200	[thread overview]
Message-ID: <6733270.VjIjn8pLY1@omega> (raw)
In-Reply-To: <20190906231011.32454-1-psmith@gnu.org>

Hi Paul,

> find_prog_in_path() always uses the PATH value in the current
> environment.  It can be very useful to search for programs on
> a path without having to modify the environment first.
> 
> Provide find_in_path_str() which takes a path string to search.
> If the path passed in is NULL, fall back to searching in the
> environment's PATH value.

I have nothing against extending the 'findprog' module in principle.

But the interface that you propose looks odd to me:

  * Why one function that always uses $PATH and one function that
    uses a given set of directories _or_ $PATH?
    Why not simpler: one function that always uses $PATH and one
    function that uses a given set of directories?

  * For the function that uses a given set of directories, isn't
    it easier for the caller to provide a NULL-terminated array
    of directories, rather than to glue them together with a
    platform-dependent separator (':' or ';')?

Because of this oddity, I have to ask: What is the use-case that
you have in mind? The use-case of the existing find_in_path function
is when a program wants to optimize multiple invocations (spawn/exec)
of one given program. What's yours?

Bruno



  parent reply	other threads:[~2019-09-07 10:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 23:10 [PATCH] findprog: Support searching in a specified path string Paul Smith
2019-09-06 23:21 ` Paul Smith
2019-09-07 10:42 ` Bruno Haible [this message]
2019-09-07 13:17   ` Paul Smith
2019-09-08 11:38     ` Bruno Haible
2019-09-08 14:03       ` Paul Smith
2019-09-08 14:59         ` Bruno Haible
2019-09-08 16:25           ` Bruno Haible
2019-09-08 17:34           ` Paul Smith
2019-09-08 17:48             ` Bruno Haible
2019-09-08 17:59               ` Paul Smith
2019-09-09 18:54                 ` Bruno Haible
2019-09-10 13:18                   ` Paul Smith
2019-09-14 11:20                     ` Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6733270.VjIjn8pLY1@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=psmith@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).