unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why is this not working (apply + call-process + list of string args)?
@ 2022-09-15 13:56 Arthur Miller
  2022-09-15 15:12 ` Jean Louis
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Arthur Miller @ 2022-09-15 13:56 UTC (permalink / raw)
  To: gnu-emacs-help


I just wonder if someone can explain exact what is going on here:

I have a list of strings of arruments I try to pass to configure script. It
looks something like this:

#+begin_src emacs-lisp
(defvar args
'("--with-native-compilation "
     "--with-x "
     "--with-x-toolkit=no "
     "--without-gconf "
     "--without-gsettings "
     "--with-cairo "
     "--without-toolkit-scroll-bars "
     "--with-xinput2 "
     "--without-included-regex "
     "--without-compress-install "))

(defun configure (&rest args)
  (apply #'call-process
  (expand-file-name "./configure")
  nil build-log nil args))

(apply #'configure args)
#end_src

However it does not work, configure script seems to see wrong arguments.

I have snitched solution from call-process-shell-command:

(defun configure (&rest args)
  (call-process  shell-file-name  nil build-log nil shell-command-switch
                 (mapconcat #'identity (cons "./configure" args) " ")))

which works fine, but I don't really understand what is going "behind the
scenes"; why do I need to start an extra shell process? I guess it has something
with how arguments are quoted and passed to call-process, but I am not
sure. Clarification appreciated. Thanks in advance.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is this not working (apply + call-process + list of string args)?
  2022-09-15 13:56 Why is this not working (apply + call-process + list of string args)? Arthur Miller
@ 2022-09-15 15:12 ` Jean Louis
  2022-09-15 21:37   ` Arthur Miller
  2022-09-15 17:00 ` Bruno Barbier
       [not found] ` <b875afd4-8022-4a16-9791-0e4cbc5c1d1f@BN8NAM04FT028.eop-NAM04.prod.protection.outlook.com>
  2 siblings, 1 reply; 7+ messages in thread
From: Jean Louis @ 2022-09-15 15:12 UTC (permalink / raw)
  To: Arthur Miller; +Cc: gnu-emacs-help

* Arthur Miller <arthur.miller@live.com> [2022-09-15 17:03]:
> I just wonder if someone can explain exact what is going on here:
> 
> I have a list of strings of arruments I try to pass to configure script. It
> looks something like this:
> 
> #+begin_src emacs-lisp
> (defvar args
> '("--with-native-compilation "

What I know is that there shall be no space in those arguments.

Following worked well on my side:

(defvar args
'("--with-native-compilation"
      "--with-x"
      "--with-x-toolkit=no"
      "--without-gconf"
      "--without-gsettings"
      "--with-cairo"
      "--without-toolkit-scroll-bars"
      "--with-xinput2"
      "--without-included-regex"
      "--without-compress-install"))
 
(defun configure (&rest args)
  (let ((command (expand-file-name "./configure")))
    (apply #'call-process command nil nil nil args)))
 
(apply #'configure args)


Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is this not working (apply + call-process + list of string args)?
  2022-09-15 13:56 Why is this not working (apply + call-process + list of string args)? Arthur Miller
  2022-09-15 15:12 ` Jean Louis
@ 2022-09-15 17:00 ` Bruno Barbier
       [not found] ` <b875afd4-8022-4a16-9791-0e4cbc5c1d1f@BN8NAM04FT028.eop-NAM04.prod.protection.outlook.com>
  2 siblings, 0 replies; 7+ messages in thread
From: Bruno Barbier @ 2022-09-15 17:00 UTC (permalink / raw)
  To: Arthur Miller, gnu-emacs-help

Arthur Miller <arthur.miller@live.com> writes:

> I just wonder if someone can explain exact what is going on here:
>
> I have a list of strings of arruments I try to pass to configure script. It
> looks something like this:
>
> #+begin_src emacs-lisp
> (defvar args
> '("--with-native-compilation "
>      "--with-x "
>      "--with-x-toolkit=no "
>      "--without-gconf "
>      "--without-gsettings "
>      "--with-cairo "
>      "--without-toolkit-scroll-bars "
>      "--with-xinput2 "
>      "--without-included-regex "
>      "--without-compress-install "))
>
> (defun configure (&rest args)
>   (apply #'call-process
>   (expand-file-name "./configure")
>   nil build-log nil args))
>
> (apply #'configure args)
> #end_src
>
> However it does not work, configure script seems to see wrong arguments.

Why do you have a space after each option ?

In my case, configure sees "--with-native-compilation ", not
"--with-native-compilation" and complains:

  configure: error: invalid package name: `native-compilation '
                                                             ^

Note that you should use a prefix for your own variables/commands names
to not break your emacs (replace existing ones).

Bruno





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is this not working (apply + call-process + list of string args)?
  2022-09-15 15:12 ` Jean Louis
@ 2022-09-15 21:37   ` Arthur Miller
  2022-09-15 22:04     ` Jean Louis
  0 siblings, 1 reply; 7+ messages in thread
From: Arthur Miller @ 2022-09-15 21:37 UTC (permalink / raw)
  To: Jean Louis; +Cc: gnu-emacs-help

Jean Louis <bugs@gnu.support> writes:

> * Arthur Miller <arthur.miller@live.com> [2022-09-15 17:03]:
>> I just wonder if someone can explain exact what is going on here:
>> 
>> I have a list of strings of arruments I try to pass to configure script. It
>> looks something like this:
>> 
>> #+begin_src emacs-lisp
>> (defvar args
>> '("--with-native-compilation "
>
> What I know is that there shall be no space in those arguments.

Indeed, space was the problem. Didn't know it mattered. Thank you for the help.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is this not working (apply + call-process + list of string args)?
       [not found] ` <b875afd4-8022-4a16-9791-0e4cbc5c1d1f@BN8NAM04FT028.eop-NAM04.prod.protection.outlook.com>
@ 2022-09-15 21:43   ` Arthur Miller
  0 siblings, 0 replies; 7+ messages in thread
From: Arthur Miller @ 2022-09-15 21:43 UTC (permalink / raw)
  To: Bruno Barbier; +Cc: gnu-emacs-help

Bruno Barbier <brubar.cs@gmail.com> writes:

> Arthur Miller <arthur.miller@live.com> writes:
>
>> I just wonder if someone can explain exact what is going on here:
>>
>> I have a list of strings of arruments I try to pass to configure script. It
>> looks something like this:
>>
>> #+begin_src emacs-lisp
>> (defvar args
>> '("--with-native-compilation "
>>      "--with-x "
>>      "--with-x-toolkit=no "
>>      "--without-gconf "
>>      "--without-gsettings "
>>      "--with-cairo "
>>      "--without-toolkit-scroll-bars "
>>      "--with-xinput2 "
>>      "--without-included-regex "
>>      "--without-compress-install "))
>>
>> (defun configure (&rest args)
>>   (apply #'call-process
>>   (expand-file-name "./configure")
>>   nil build-log nil args))
>>
>> (apply #'configure args)
>> #end_src
>>
>> However it does not work, configure script seems to see wrong arguments.
>
> Why do you have a space after each option ?

Space was there because I was assembling a command to run another
Emacs process asynchronously, but I have solved it now differently. Thanks for
the help, spaces were indeed the problem.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is this not working (apply + call-process + list of string args)?
  2022-09-15 21:37   ` Arthur Miller
@ 2022-09-15 22:04     ` Jean Louis
  2022-09-15 23:16       ` Arthur Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Jean Louis @ 2022-09-15 22:04 UTC (permalink / raw)
  To: Arthur Miller; +Cc: gnu-emacs-help

* Arthur Miller <arthur.miller@live.com> [2022-09-16 00:38]:
> > What I know is that there shall be no space in those arguments.

> Indeed, space was the problem. Didn't know it mattered. Thank you
> for the help.

I understand `call-process' and `start-process' as lower level command
invocation that circumvents the shell.

I cannot know how it works for real, there is just idea that shell is
the one interpreting spaces and cutting them out, and not the programm
or command itself; while `call-process' sends full arguments without
shell interpreting and cutting out spaces.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Why is this not working (apply + call-process + list of string args)?
  2022-09-15 22:04     ` Jean Louis
@ 2022-09-15 23:16       ` Arthur Miller
  0 siblings, 0 replies; 7+ messages in thread
From: Arthur Miller @ 2022-09-15 23:16 UTC (permalink / raw)
  To: Jean Louis; +Cc: gnu-emacs-help

Jean Louis <bugs@gnu.support> writes:

> * Arthur Miller <arthur.miller@live.com> [2022-09-16 00:38]:
>> > What I know is that there shall be no space in those arguments.
>
>> Indeed, space was the problem. Didn't know it mattered. Thank you
>> for the help.
>
> I understand `call-process' and `start-process' as lower level command
> invocation that circumvents the shell.
>
> I cannot know how it works for real, there is just idea that shell is
> the one interpreting spaces and cutting them out, and not the programm
> or command itself; while `call-process' sends full arguments without
> shell interpreting and cutting out spaces.

Seems like that is the case.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-15 23:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-15 13:56 Why is this not working (apply + call-process + list of string args)? Arthur Miller
2022-09-15 15:12 ` Jean Louis
2022-09-15 21:37   ` Arthur Miller
2022-09-15 22:04     ` Jean Louis
2022-09-15 23:16       ` Arthur Miller
2022-09-15 17:00 ` Bruno Barbier
     [not found] ` <b875afd4-8022-4a16-9791-0e4cbc5c1d1f@BN8NAM04FT028.eop-NAM04.prod.protection.outlook.com>
2022-09-15 21:43   ` Arthur Miller

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