[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guile 2.0.9 build on mingw
From: |
Eli Zaretskii |
Subject: |
Re: guile 2.0.9 build on mingw |
Date: |
Sun, 16 Jun 2013 18:40:27 +0300 |
> From: address@hidden (Ludovic Courtès)
> Cc: address@hidden, address@hidden
> Date: Sun, 16 Jun 2013 16:36:50 +0200
>
> > The patch below, which should be applied on top of the one I sent
> > yesterday, is needed because open-pipe does this:
> >
> > (open-pipe* mode "/bin/sh" "-c" command))
> >
> > and obviously there's no /bin/sh on Windows.
> >
> > --- libguile/posix.c~1 2013-06-13 08:54:44.926293300 +0300
> > +++ libguile/posix.c 2013-06-13 08:57:44.262743700 +0300
> > @@ -1300,7 +1300,9 @@ scm_open_process (SCM mode, SCM prog, SC
> > int pid;
> > char *exec_file;
> > char **exec_argv;
> > +#ifdef HAVE_FORK
> > int max_fd = 1024;
> > +#endif
>
> The #ifdef appears unnecessary given that this is already in #ifdef HAVE_FORK.
As I wrote above, this was supposed to be applied on top of what I
sent here:
http://lists.gnu.org/archive/html/guile-user/2013-06/msg00033.html
which, among other things, inserted "#endif" before scm_open_process,
thus making it available when fork isn't.
> This last hunk doesn’t apply since the whole thing is already in
> #ifdef HAVE_FORK AFAICS.
See above. The intent was to make open-process available on Windows,
so ifdef'ing all of it conditioned on fork would be
counter-productive...
> What about this (hopefully simpler) patch instead?
>
> diff --git a/module/ice-9/popen.scm b/module/ice-9/popen.scm
> index 7d0549e..e431949 100644
> --- a/module/ice-9/popen.scm
> +++ b/module/ice-9/popen.scm
> @@ -61,13 +61,23 @@ port to the process is created: it should be the value of
> (hashq-set! port/pid-table port pid)
> port))))
>
> +(define %shell-command
> + (cond ((file-exists? "/bin/sh")
> + "/bin/sh")
> + ((getenv "SHELL")
> + ;; Hope that $SHELL points at a Bourne-compatible shell.
> + => identity)
> + (else
> + ;; Assume we're on Windows.
> + "cmd.exe")))
> +
> (define (open-pipe command mode)
> "Executes the shell command @var{command} (a string) in a subprocess.
> A port to the process (based on pipes) is created and returned.
> @var{mode} specifies whether an input, an output or an input-output
> port to the process is created: it should be the value of
> @code{OPEN_READ}, @code{OPEN_WRITE} or @code{OPEN_BOTH}."
> - (open-pipe* mode "/bin/sh" "-c" command))
> + (open-pipe* mode %shell-command "-c" command))
>
> (define (fetch-pid port)
> (let ((pid (hashq-ref port/pid-table port)))
The "-c" part needs to be replaced with "/c". And that would only
take care of open-pipe; there are more instances of using /bin/sh
etc. elsewhere in Guile. If we want to handle this on the Scheme
level, it will be necessary to consistently discourage people from
using explicit shell file names and instead use %shell-file-name and
%shell-command-switch, like Emacs does.
And the parts of scm_open_process that replace the Unix fork/exec
stuff will still be needed, just without rewriting exec_file and
exec_arg[].
Thanks.
- Re: guile 2.0.9 build on mingw, (continued)
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/12
- Why launch the Guile signal delivery thread on exit? (was Re: guile 2.0.9 build on mingw), Mark H Weaver, 2013/06/18
- Re: Why launch the Guile signal delivery thread on exit? (was Re: guile 2.0.9 build on mingw), Eli Zaretskii, 2013/06/19
- Re: Why launch the Guile signal delivery thread on exit? (was Re: guile 2.0.9 build on mingw), Julian Graham, 2013/06/19
- Re: Why launch the Guile signal delivery thread on exit? (was Re: guile 2.0.9 build on mingw), Ludovic Courtès, 2013/06/19
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/12
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/13
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/13
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw,
Eli Zaretskii <=
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/16
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/13
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/16
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/17
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/18
- Re: guile 2.0.9 build on mingw, Mark H Weaver, 2013/06/18
- Re: guile 2.0.9 build on mingw, Eli Zaretskii, 2013/06/18
- Re: guile 2.0.9 build on mingw, Ludovic Courtès, 2013/06/19