From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.lisp.guile.devel Subject: Re: c-api.test fails on MS-Windows due to non-portable quoting Date: Sat, 27 Aug 2016 11:23:39 +0300 Message-ID: <83bn0ed3hw.fsf@gnu.org> References: <83y44svc0k.fsf@gnu.org> <874m7grrf7.fsf@pobox.com> <83r3ajt8f8.fsf@gnu.org> <87wpjpw37r.fsf@netris.org> <83eg5whf94.fsf@gnu.org> <8360r8he2k.fsf@gnu.org> <87fuqcwo8i.fsf@netris.org> <834m6pdoe2.fsf@gnu.org> <831t1sevdc.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1472286228 21871 195.159.176.226 (27 Aug 2016 08:23:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 27 Aug 2016 08:23:48 +0000 (UTC) Cc: guile-devel@gnu.org To: mhw@netris.org, wingo@pobox.com Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Aug 27 10:23:42 2016 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdYtx-00052U-Ft for guile-devel@m.gmane.org; Sat, 27 Aug 2016 10:23:41 +0200 Original-Received: from localhost ([::1]:35127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdYtv-0006ea-1E for guile-devel@m.gmane.org; Sat, 27 Aug 2016 04:23:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdYte-0006eR-3D for guile-devel@gnu.org; Sat, 27 Aug 2016 04:23:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdYtZ-0001xn-SN for guile-devel@gnu.org; Sat, 27 Aug 2016 04:23:21 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34844) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdYtZ-0001wf-Or; Sat, 27 Aug 2016 04:23:17 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1199 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bdYtX-0002k3-SF; Sat, 27 Aug 2016 04:23:16 -0400 In-reply-to: <831t1sevdc.fsf@gnu.org> (message from Eli Zaretskii on Sat, 13 Aug 2016 14:55:27 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:18643 Archived-At: Ping! (2 weeks) > Date: Sat, 13 Aug 2016 14:55:27 +0300 > From: Eli Zaretskii > Cc: wingo@pobox.com, guile-devel@gnu.org > > > Date: Sat, 13 Aug 2016 12:11:33 +0300 > > From: Eli Zaretskii > > Cc: wingo@pobox.com, guile-devel@gnu.org > > > > > From: Mark H Weaver > > > Cc: wingo@pobox.com, guile-devel@gnu.org > > > Date: Wed, 10 Aug 2016 13:03:09 -0400 > > > > > > Eli Zaretskii writes: > > > > > > >> Date: Wed, 10 Aug 2016 17:26:15 +0300 > > > >> From: Eli Zaretskii > > > >> Cc: wingo@pobox.com, guile-devel@gnu.org > > > >> > > > >> If you suggest to do what I described above, then I obviously agree. > > > > > > > > IOW, do you want me to send a patch along the lines I suggested? > > > > > > Yes, please! > > > > Will do when I have enough time (correctly quoting command-line > > arguments on Windows is a tricky business). > > On further thought, I decided to reuse code we already have, rather > than write something new. Is the approach below acceptable? If it > is, I will post it in Git format wrt the current repo. > > --- libguile/simpos.c~0 2016-01-02 16:24:55.000000000 +0200 > +++ libguile/simpos.c 2016-08-13 13:56:43.014875000 +0300 > @@ -45,12 +45,12 @@ > # include > #endif > > +#include "posix.h" > + > #ifdef __MINGW32__ > -# include /* for spawnvp and friends */ > +#include "posix-w32.h" > #endif > > -#include "posix.h" > - > > extern int system(); > > @@ -124,9 +124,9 @@ SCM_DEFINE (scm_system_star, "system*", > SCM oldquit; > SCM sigquit; > #endif > -#ifdef HAVE_FORK > int pid; > -#else > +#ifndef HAVE_FORK > + int p1[2], p2[2]; > int status; > #endif > char **execargv; > @@ -177,7 +177,21 @@ SCM_DEFINE (scm_system_star, "system*", > return scm_from_int (status); > } > #else /* !HAVE_FORK */ > +#ifdef __MINGW32__ > + /* MS-Windows spawnvp needs execargv[] strings quoted if they > + include special characters, like whitespace. The required > + quoting is non-trivial, and also depends on whether > + execargv[0] is cmd.exe. So we invoke start_child instead, > + which already has all that figured out. */ > + pid = start_child (execargv[0], execargv, 0, p1, 0, p2, > + fileno (stdin), fileno (stdout), fileno (stderr)); > + if (pid == -1) > + SCM_SYSERROR; > + > + waitpid (pid, &status, 0); > +#else > status = spawnvp (P_WAIT, execargv[0], (const char * const *)execargv); > +#endif > scm_sigaction (sigint, SCM_CAR (oldint), SCM_CDR (oldint)); > #ifdef SIGQUIT > scm_sigaction (sigquit, SCM_CAR (oldquit), SCM_CDR (oldquit)); > >