From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: Support open-process and friends on MS-Windows Date: Sat, 25 Jun 2016 16:43:34 +0200 Message-ID: <87a8i9ba7d.fsf@pobox.com> References: <834m8i3off.fsf@gnu.org> <877fde958i.fsf@gnu.org> <83wple1zym.fsf@gnu.org> <83ziq9zl8l.fsf@gnu.org> <87eg7lbnpi.fsf@pobox.com> <83y45tzhyn.fsf@gnu.org> <87twghs9ot.fsf@gnu.org> <83r3blz96w.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1466865857 11741 80.91.229.3 (25 Jun 2016 14:44:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 25 Jun 2016 14:44:17 +0000 (UTC) Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , guile-devel@gnu.org To: Eli Zaretskii Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jun 25 16:44:09 2016 Return-path: Envelope-to: guile-devel@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 1bGooa-00007y-K7 for guile-devel@m.gmane.org; Sat, 25 Jun 2016 16:44:08 +0200 Original-Received: from localhost ([::1]:50243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGooZ-0001lj-H0 for guile-devel@m.gmane.org; Sat, 25 Jun 2016 10:44:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGooK-0001lN-6H for guile-devel@gnu.org; Sat, 25 Jun 2016 10:43:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGooJ-0007Wd-1t for guile-devel@gnu.org; Sat, 25 Jun 2016 10:43:52 -0400 Original-Received: from pb-sasl1.pobox.com ([64.147.108.66]:52736 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGooC-0007Vf-IS; Sat, 25 Jun 2016 10:43:44 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id B0817221E4; Sat, 25 Jun 2016 10:43:42 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=RbKauaYRkOI5S+4HBBFgBB8oiQs=; b=OZAKSG j3vJ4V7AZI1nksR3NvCJMqlTl9GikFPN2QSZqa1C9Bwa7LSumMYkF77RxW4KBiHM oG/puNKHOzsqVFpplaEZANM4iFf41080mrVkUVdaQncL2AD8z5ry11vNIp8xbf4w e+Lg6kiJ+PNPGJYG6ib9QEuTC3Im4W8Yw7qTY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=F5T8EZvmu5K6cyfm2zzgnQ0tV0+Hp9te Nuf27uhTo34LgvN7GG4Udtdm6OvVzDgKHi21p6PyCF2OML0zHtLs98SHL7SK5Gqj /jDh3HX6qV1K0YHRkEItDrHXKjbcQSeOLzatpznzCgsJ35XbmKNu8PoRMlbEvreK s4WLL6oWkZc= Original-Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id A850E221E3; Sat, 25 Jun 2016 10:43:42 -0400 (EDT) Original-Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id E660B221E2; Sat, 25 Jun 2016 10:43:41 -0400 (EDT) In-Reply-To: <83r3blz96w.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Jun 2016 16:31:35 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Pobox-Relay-ID: 362CBAFA-3AE3-11E6-B75D-C1836462E9F6-02397024!pb-sasl1.pobox.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.108.66 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:18434 Archived-At: On Sat 25 Jun 2016 15:31, Eli Zaretskii writes: > [Please disregard the previous patch and use this one instead.] Thanks for the updates. I have a couple of additional nits, having applied and built the patch. > @@ -659,7 +663,7 @@ SCM_DEFINE (scm_kill, "kill", 2, 0, 0, > #else > /* Mingw has raise(), but not kill(). (Other raw DOS environments might > be similar.) Use raise() when the requested pid is our own process, > - otherwise bomb. */ > + otherwise TerminateProcess. */ > if (scm_to_int (pid) == getpid ()) > { > if (raise (scm_to_int (sig)) != 0) > @@ -673,6 +677,10 @@ SCM_DEFINE (scm_kill, "kill", 2, 0, 0, > goto err; > } > } > +#ifdef __MINGW32__ > + if (w32_kill_proc (scm_to_int (pid), scm_to_int (sig)) != 0) > + SCM_SYSERROR; > +#endif /* __MINGW32__ */ > #endif > return SCM_UNSPECIFIED; > } Here we effectively have two mingw blocks. Can the previous one be removed? If not, let's fold it into `w32_kill_proc', and in any case let's rename `w32_kill_proc' to `kill', and then define HAVE_KILL. > @@ -1141,7 +1143,7 @@ SCM_DEFINE (scm_execl, "execl", 1, 0, 1, > > exec_argv = scm_i_allocate_string_pointers (args); > > - execv (exec_file, exec_argv); > + execv (exec_file, (char const * const *)exec_argv); > SCM_SYSERROR; > > /* not reached. */ make[3]: Entering directory '/home/wingo/src/guile-2.0/libguile' CC libguile_2.0_la-posix.lo posix.c: In function 'scm_execl': posix.c:1146:21: warning: passing argument 2 of 'execv' from incompatible pointer type [-Wincompatible-pointer-types] execv (exec_file, (char const * const *)exec_argv); ^ In file included from ../lib/unistd.h:40:0, from posix.c:50: /home/wingo/.guix-profile/include/unistd.h:566:12: note: expected 'char * const*' but argument is of type 'const char * const*' extern int execv (const char *__path, char *const __argv[]) ^~~~~ What should be done here? Similarly in the following cases. > @@ -1408,16 +1433,16 @@ scm_open_process (SCM mode, SCM prog, SCM args) > if (err > 0) > { > char *msg = strerror (errno); > - fprintf (fdopen (err, "a"), "In execlp of %s: %s\n", > + fprintf (fdopen (err, "a"), "In execvp of %s: %s\n", > exec_file, msg); > } > > _exit (EXIT_FAILURE); > +#endif /* HAVE_FORK */ > /* Not reached. */ > return SCM_BOOL_F; > } > #undef FUNC_NAME > -#endif /* HAVE_FORK */ This change updates to provide `open-process' effectively on all systems instead of only if `fork' is available, but then it causes a runtime error if the system doesn't have `fork' and isn't `mingw32'. I guess that's OK in practice. Would you mind updating the documentation in doc/ref/posix.texi to indicate this? Thanks. Cheers, and thanks for dealing with the late feedback. Andy