From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.lisp.guile.user Subject: Re: guile 2.0.9 build on mingw Date: Sun, 16 Jun 2013 18:40:27 +0300 Message-ID: <83y5aat66s.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> <87y5aa15rx.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1371397373 21326 80.91.229.3 (16 Jun 2013 15:42:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Jun 2013 15:42:53 +0000 (UTC) Cc: guile-user@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Jun 16 17:42:54 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 1UoF6T-0005zP-4H for guile-user@m.gmane.org; Sun, 16 Jun 2013 17:42:53 +0200 Original-Received: from localhost ([::1]:60664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoF6S-0004AB-Q6 for guile-user@m.gmane.org; Sun, 16 Jun 2013 11:42:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoF4H-0000k2-2V for guile-user@gnu.org; Sun, 16 Jun 2013 11:40:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UoF4F-0001Dl-QP for guile-user@gnu.org; Sun, 16 Jun 2013 11:40:37 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:61542) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoF4F-0001DK-Ic; Sun, 16 Jun 2013 11:40:35 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MOH00I00SO18600@a-mtaout20.012.net.il>; Sun, 16 Jun 2013 18:40:27 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MOH00IQSSVF8D10@a-mtaout20.012.net.il>; Sun, 16 Jun 2013 18:40:27 +0300 (IDT) In-reply-to: <87y5aa15rx.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 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:10451 Archived-At: > From: ludo@gnu.org (Ludovic Court=C3=A8s) > Cc: mhw@netris.org, guile-user@gnu.org > Date: Sun, 16 Jun 2013 16:36:50 +0200 >=20 > > 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=092013-06-13 08:54:44.926293300 +0300 > > +++ libguile/posix.c=092013-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 >=20 > 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=E2=80=99t apply since the whole thing is alrea= dy 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? >=20 > 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 th= e value of > (hashq-set! port/pid-table port pid) > port)))) > =20 > +(define %shell-command > + (cond ((file-exists? "/bin/sh") > + "/bin/sh") > + ((getenv "SHELL") > + ;; Hope that $SHELL points at a Bourne-compatible shell. > + =3D> identity) > + (else > + ;; Assume we're on Windows. > + "cmd.exe"))) > + > (define (open-pipe command mode) > "Executes the shell command @var{command} (a string) in a subpro= cess. > A port to the process (based on pipes) is created and returned. > @var{mode} specifies whether an input, an output or an input-outpu= t > 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)) > =20 > (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.