From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: guile 2.0.9 build on mingw Date: Sun, 16 Jun 2013 16:36:50 +0200 Message-ID: <87y5aa15rx.fsf@gnu.org> References: <83sj1hv2ml.fsf@gnu.org> <874ndx9y7h.fsf@pobox.com> <83ip2bt4qk.fsf@gnu.org> <8761xqhyyt.fsf@gnu.org> <83li6mt18y.fsf@gnu.org> <83wqq3mcq9.fsf@gnu.org> <87k3m3kor5.fsf@gnu.org> <83ehcalysu.fsf@gnu.org> <87sj0pvl4a.fsf@tines.lan> <837gi1n3v5.fsf@gnu.org> <87k3m1vg8b.fsf@tines.lan> <83txl4lhby.fsf@gnu.org> <838v2fky99.fsf@gnu.org> <83k3lyw2wp.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1371393726 20650 80.91.229.3 (16 Jun 2013 14:42:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Jun 2013 14:42:06 +0000 (UTC) Cc: guile-user@gnu.org To: Eli Zaretskii Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Jun 16 16:42:05 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UoE9d-0000VL-Ln for guile-user@m.gmane.org; Sun, 16 Jun 2013 16:42:05 +0200 Original-Received: from localhost ([::1]:40506 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoE9d-00044W-7o for guile-user@m.gmane.org; Sun, 16 Jun 2013 10:42:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoE9U-00044R-O9 for guile-user@gnu.org; Sun, 16 Jun 2013 10:41:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UoE9T-0008AM-CO for guile-user@gnu.org; Sun, 16 Jun 2013 10:41:56 -0400 Original-Received: from hera.aquilenet.fr ([141.255.128.1]:41220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoE9R-00089i-BN; Sun, 16 Jun 2013 10:41:53 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2F868CCC; Sun, 16 Jun 2013 16:36:52 +0200 (CEST) Original-Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ugUTJDO29iPa; Sun, 16 Jun 2013 16:36:52 +0200 (CEST) Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 4FD4CBFC; Sun, 16 Jun 2013 16:36:51 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 28 Prairial an 221 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <83k3lyw2wp.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 13 Jun 2013 16:33:58 +0300") User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 141.255.128.1 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10444 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii skribis: > Here are a few more changes that fix problems exposed by the test > suite. > > 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 =3D 1024; > +#endif The #ifdef appears unnecessary given that this is already in #ifdef HAVE_FO= RK. > exec_file =3D scm_to_locale_string (prog); > exec_argv =3D scm_i_allocate_string_pointers (scm_cons (prog, args)); > @@ -1435,6 +1437,14 @@ scm_open_process (SCM mode, SCM prog, SC > close (p2c[0]); > } >=20=20 > + if (c_strcasecmp (exec_file, "/bin/sh") =3D=3D 0) > + { > + strcpy (exec_file, "cmd.exe"); > + strcpy (exec_argv[0], "cmd.exe"); > + if (strcmp (exec_argv[1], "-c") =3D=3D 0) > + strcpy (exec_argv[1], "/c"); > + } > + > pid =3D spawnvp (P_NOWAIT, exec_file, exec_argv); > errno_save =3D errno; >=20=20 > @@ -1486,7 +1496,6 @@ scm_open_process (SCM mode, SCM prog, SC > { > int errno_save =3D errno; >=20=20 > - free (exec_file); > if (reading) > { > close (c2p[0]); > @@ -1512,6 +1521,7 @@ scm_open_process (SCM mode, SCM prog, SC > exec_file, msg); > } > #endif > + free (exec_file); > SCM_SYSERROR; > } >=20=20 > @@ -1592,9 +1602,9 @@ scm_open_process (SCM mode, SCM prog, SC > } >=20=20 > _exit (EXIT_FAILURE); > +#endif /* HAVE_FORK */ > /* Not reached. */ > return SCM_BOOL_F; > -#endif /* HAVE_FORK */ > } > #undef FUNC_NAME This last hunk doesn=E2=80=99t apply since the whole thing is already in #ifdef HAVE_FORK AFAICS. What about this (hopefully simpler) patch instead? --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 DQpUaGFua3MsDQpMdWRv4oCZLg0K --=-=-=--