emacs-devel
[Top][All Lists]
Advanced

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

Re: Quote file name args to start-process-shell-command?


From: David Kastrup
Subject: Re: Quote file name args to start-process-shell-command?
Date: Thu, 12 Oct 2006 09:44:14 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> Date: Thu, 12 Oct 2006 08:08:08 +0200
>> From: Lennart Borgman <address@hidden>
>> CC:  address@hidden
>> 
>> Eli Zaretskii wrote:
>> >> Date: Wed, 11 Oct 2006 22:32:24 +0200
>> >> From: Lennart Borgman <address@hidden>
>> >>
>> >> Should arguments to 
>> >> start-process-shell-command/call-process-shell-command that are file 
>> >> names be quoted with shell-quote-arguments?
>> >>     
>> >
>> > Can you show examples of situations when this is an issue?
>> >   
>> 
>> Something like this:
>> 
>>     (call-process-shell-command "ls" nil t nil "c:/program files/emacs")
>
> I believe it's wrong for call-process-shell-command to quote
> arguments, because it has no idea of their semantics.  The doc string
> of call-process-shell-command says:
>
>   Remaining arguments are strings passed as additional arguments for COMMAND.
>
> There's no requirement here that each one of the "&rest ARGS" be a
> separate command-line argument, is there?

Then it would be completely pointless to allow several ARGS.

> For example, I just tried this:
>
>   (call-process-shell-command "ls" nil t nil "foo* bar*")
>
> and got a listing of all files that match the two wildcards `foo*' and
> `bar*'.

I think that would be abuse of the command.

> So I think that any quoting should be done by the caller of
> call-process-shell-command, since only the caller knows what each
> argument means.

The caller knows that different arguments mean different arguments,
presumably.

One would have to look at the actual use cases to see whether any
caller assumes differently, but from the description, I'd agree with
Lennart's idea.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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