From: Jean Louis <bugs@gnu.support>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: emacs-devel@gnu.org
Subject: Re: Question about start-process and argument list
Date: Fri, 3 Feb 2023 14:24:24 +0300 [thread overview]
Message-ID: <Y9zu6AeXw9xCnwMY@protected.localdomain> (raw)
In-Reply-To: <87r0v7wgrp.fsf@ericabrahamsen.net>
* Eric Abrahamsen <eric@ericabrahamsen.net> [2023-02-03 09:37]:
> I recently got a bug report about the Mairix search engine for Gnus --
> long story short, the gnus-search.el code calls all command-line mail
> indexers (notmuch, mairix, namazu, etc) like this:
>
> (apply #'start-process (format "search-%s" server)
> buffer program cp-list)
>
> Where `program' is the indexer, and `cp-list' is a list of command-line
> flags. The important thing is that the last element of `cp-list' is the
> search-query string itself, but this string has not been split on
> spaces. Meaning that cp-list could look like:
I would not try to generalize the command for all search engines
unless they really have compatible command lie.
> '("--rcfile" config-file "-r" "another-arg" "from:bob subject:lunch")
Which is OK in itself, as it is safer to run program without using
external shell.
> Other search engines seem to accept this fine, but Mairix fails unless
> the search query is also split on spaces:
>
> '("--rcfile" config-file "-r" "another-arg" "from:bob" "subject:lunch")
>
> It occurred to me that this is probably the way it should be done, even
> if the other engines don't happen to be choking on the format. I have
> two questions:
>
> 1. What does the program actually see, in this case? Is the first
> example above, is it the equivalent of (on the command line) wrapping
> the query in double quotes?
It has same effect.
> 2. Should I be using `start-process-shell-command' instead? The docs
> mention that the main difference is that it will use shell features,
> which aren't really relevant here, but maybe it's the right thing to
> do, semantically.
Rather no, as that becomes unsafe. Yes, it would invoke shell and
some environment and the program line. But for programing purposes is
unsafe.
I learned it from experience ahat `start-process' and `call-process'
are safe way and more conclusive for programming purposes.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
next prev parent reply other threads:[~2023-02-03 11:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 3:48 Question about start-process and argument list Eric Abrahamsen
2023-02-03 11:24 ` Jean Louis [this message]
2023-02-03 19:24 ` Bruno Barbier
2023-02-03 21:23 ` Eric Abrahamsen
2023-02-03 21:34 ` chad
2023-02-03 22:54 ` Eric Abrahamsen
2023-02-03 23:02 ` Bruno Barbier
2023-02-04 2:20 ` Eric Abrahamsen
2023-02-04 6:40 ` tomas
2023-02-04 7:22 ` Jean Louis
2023-02-04 18:25 ` Eric Abrahamsen
2023-02-04 7:18 ` Jean Louis
2023-02-04 18:13 ` Eric Abrahamsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y9zu6AeXw9xCnwMY@protected.localdomain \
--to=bugs@gnu.support \
--cc=emacs-devel@gnu.org \
--cc=eric@ericabrahamsen.net \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.