emacs-devel
[Top][All Lists]
Advanced

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

Re: Question about start-process and argument list


From: Bruno Barbier
Subject: Re: Question about start-process and argument list
Date: Fri, 03 Feb 2023 20:24:52 +0100

Jean Louis <bugs@gnu.support> writes:

> * Eric Abrahamsen <eric@ericabrahamsen.net> [2023-02-03 09:37]:
>> 
>> 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.

Maybe I didn't understand the question, but I don't think it has the
same effect nor that it should.

Here is what I'm seeing on my POSIX system:

  ("--rcfile" config-file "-r" "another-arg" "from:bob subject:lunch")
   1: '--rcfile'
   2: 'config-file'
   3: '-r'
   4: 'another-arg'
   5: 'from:bob subject:lunch'

  ("--rcfile" config-file "-r" "another-arg" "from:bob" "subject:lunch")
   1: '--rcfile'
   2: 'config-file'
   3: '-r'
   4: 'another-arg'
   5: 'from:bob'
   6: 'subject:lunch'

   showargs --rcfile config-file -r  another-arg "from:bob subject:lunch"
   1: '--rcfile'
   2: 'config-file'
   3: '-r'
   4: 'another-arg'
   5: 'from:bob subject:lunch'
   
   showargs --rcfile config-file -r  another-arg from:bob subject:lunch
   1: '--rcfile'
   2: 'config-file'
   3: '-r'
   4: 'another-arg'
   5: 'from:bob'
   6: 'subject:lunch'


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

Right, I would advise you, like Jean, to stay with `start-process'.

And, the search query should probably be only one argument (except if
you accept to restrict you query syntax to something that's compatible
with any possible way to quote and parse arguments on a command line on
any possible OS, including sign like '-', '"', ')',  etc.).

Just my 2c.

Bruno


> -- 
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> In support of Richard M. Stallman
> https://stallmansupport.org/



reply via email to

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