Master- patch - Fixing GUILE_PROGS wrong versioning checks

2016-06-25 Thread David Pirotte
Hello,

Attached.

Note that the fix might be 'too strong': GUILE_PROG[2.x] will accept Guile 3.x
versions ... I'm not sure about this :) feel free to update this patch in case 
we
don't want that...

Cheers,
David
From 2d1593a6f9c7fc5f1636f9695e8685fcc6334cfd Mon Sep 17 00:00:00 2001
From: David Pirotte 
Date: Sat, 25 Jun 2016 23:07:48 -0300
Subject: [PATCH 3/3] Fixing GUILE_PROGS wrong versioning checks

* meta/guile.m4: Fixing GUILE_PROGS versioning checks were wrong and
  incomplete, leading to false errors like: "... checking for Guile
  version >= 2.0.11... configure: error: Guile 2.0.11 required, but
  2.1.3 found".

  thanks to Colomban Wendling, aka b4n, who also suggested this fix
  during a chat on #autotools while helping me wrt another autotool
  related problem I was nvestigating.
---
 meta/guile.m4 | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/meta/guile.m4 b/meta/guile.m4
index e1d6483..cc4e488 100644
--- a/meta/guile.m4
+++ b/meta/guile.m4
@@ -47,8 +47,8 @@
 # for an available version of Guile.
 #
 # By default, this macro will search for the latest stable version of
-# Guile (e.g. 2.0), falling back to the previous stable version
-# (e.g. 1.8) if it is available.  If no guile-@var{VERSION}.pc file is
+# Guile (e.g. 2.2), falling back to the previous stable version
+# (e.g. 2.0) if it is available.  If no guile-@var{VERSION}.pc file is
 # found, an error is signalled.  The found version is stored in
 # @var{GUILE_EFFECTIVE_VERSION}.
 #
@@ -224,8 +224,12 @@ AC_DEFUN([GUILE_PROGS],
   _major_version=`echo $_guile_required_version | cut -d . -f 1`
   _minor_version=`echo $_guile_required_version | cut -d . -f 2`
   _micro_version=`echo $_guile_required_version | cut -d . -f 3`
-  if test "$_guile_major_version" -ge "$_major_version"; then
-if test "$_guile_minor_version" -ge "$_minor_version"; then
+  if test "$_guile_major_version" -gt "$_major_version"; then
+true
+  elif test "$_guile_major_version" -eq "$_major_version"; then
+if test "$_guile_minor_version" -gt "$_minor_version"; then
+  true
+elif test "$_guile_minor_version" -eq "$_minor_version"; then
   if test -n "$_micro_version"; then
 if test "$_guile_micro_version" -lt "$_micro_version"; then
   AC_MSG_ERROR([Guile $_guile_required_version required, but $_guile_prog_version found])
-- 
2.8.1



pgpQeLeNh20FV.pgp
Description: OpenPGP digital signature


Re: bug#16357: insufficient print abbreviation in error messages

2016-06-25 Thread Mark H Weaver
Andy Wingo  writes:

> On Thu 23 Jun 2016 18:57, Mark H Weaver  writes:
>
>> Andy Wingo  writes:
>>> Or, we could use print states.  But print states are not so great and
>>> ideally we would remove them eventually.
>>
>> We will need print states, or something like them, to support writing
>> cyclic data structures as required by R7RS.
>
> I was thinking parameters would be sufficient.  Dunno.  WDYT about that?

Parameters would propagate to places where we don't want them to
propagate.  For example, if in the course of running a custom printer,
some internal procedure prints something to a different port, e.g. to a
string port, then the parameter would still take effect.

  Mark



Re: Master - Do not track html, tmp and some test-suite files

2016-06-25 Thread David Pirotte
Hello Andy,

> > Note that make check leaves the following toplevel file [a symlink to 
> > itself]
> > behind:
> >
> > filesys-test-link.tmp  

> I have seen this and I don't know why this is, and I would prefer to fix
> it rather than ignoring it.

Ok, as I said I did not look at the test-suite source code, and I'm afraid I 
won't
have time to do so, just to let you know.

> >  config.log
> >  config.h
> >  *.doc
> > +*.html  

> doc/ref/guile.html please

Fine, let's apply the patch I sent for stable-2.0 when you're happy then.

> > @@ -142,6 +144,7 @@ INSTALL
> >  /test-suite/standalone/test-scm-spawn-thread
> >  /test-suite/standalone/test-pthread-create
> >  /test-suite/standalone/test-pthread-create-secondary
> > +/test-suite/standalone/test-smob-mark-race
> >  /lib/fcntl.h  

> Good catch!
> So just a couple of nits, then please resend.  Thanks :)

Attached

Cheers,
David
From 45795a5d90de5e87b452d32189a9b5b1eb410ae5 Mon Sep 17 00:00:00 2001
From: David Pirotte 
Date: Sat, 25 Jun 2016 17:42:09 -0300
Subject: [PATCH 2/2] Do not track some test-suite files

* .gitignore:  Adding test-smob-mark-race to the list of the test-suite
  files we do not track.
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 6375f2b..7f9d630 100644
--- a/.gitignore
+++ b/.gitignore
@@ -142,6 +142,7 @@ INSTALL
 /test-suite/standalone/test-scm-spawn-thread
 /test-suite/standalone/test-pthread-create
 /test-suite/standalone/test-pthread-create-secondary
+/test-suite/standalone/test-smob-mark-race
 /lib/fcntl.h
 /lib/sys/uio.h
 /lib/stdalign.h
-- 
2.8.1



pgpudub3Mgi7V.pgp
Description: OpenPGP digital signature


Re: Stable-2.0 - patch - Do not track html dirs and files

2016-06-25 Thread David Pirotte
Hello Andy,

> > diff --git a/.gitignore b/.gitignore
> > index 3deeab2..bce9756 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -13,6 +13,7 @@ config.status
> >  config.log
> >  config.h
> >  *.doc
> > +*.html
> >  *.x
> >  *.lo
> >  *.la  

> Can you make it more specific please?  I.e. doc/ref/guile.html

Is this what you meant ? If so it can be applied to master as well

David
From f816389b7164596d448605a3289c6894117e120b Mon Sep 17 00:00:00 2001
From: David Pirotte 
Date: Sat, 25 Jun 2016 17:27:36 -0300
Subject: [PATCH] Do not track r5rs doc html files

* doc/r5rs/.gitignore: New file.  We don't track documentation html
  files.
---
 doc/r5rs/.gitignore | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 doc/r5rs/.gitignore

diff --git a/doc/r5rs/.gitignore b/doc/r5rs/.gitignore
new file mode 100644
index 000..3a6b095
--- /dev/null
+++ b/doc/r5rs/.gitignore
@@ -0,0 +1 @@
+r5rs.html
-- 
2.8.1



pgpzlgQsT2v8P.pgp
Description: OpenPGP digital signature


Re: bug#15228: [PATCH] Close output port of I/O pipes

2016-06-25 Thread Josep Portella Florit
> I dunno how much we should push this "processes are a single port"
> abstraction.  In many ways for OPEN_BOTH pipes it's easier to deal with
> an input and an output port and a PID instead of the pipe abstraction.
> WDYT?  We could just expose `open-process' from (ice-9 popen) to start
> with.  It would be good to allow other fd's or ports to map to the child
> as well, e.g. stderr or any particular port; but I don't know what
> interface we should expose.

Since patching was inconvenient for me, I eventually used:

(use-modules ((ice-9 popen) #:select (open-process)))

Which works even though `open-process` is not exported.  For me,
exporting `open-process` and documenting it would be enough.

I also like the Racket interface to processes:

(I've mostly used the `process` procedure.)



Re: bug#15228: [PATCH] Close output port of I/O pipes

2016-06-25 Thread Andy Wingo
On Sat 25 Jun 2016 15:51, Josep Portella Florit  writes:

>> I dunno how much we should push this "processes are a single port"
>> abstraction.  In many ways for OPEN_BOTH pipes it's easier to deal with
>> an input and an output port and a PID instead of the pipe abstraction.
>> WDYT?  We could just expose `open-process' from (ice-9 popen) to start
>> with.  It would be good to allow other fd's or ports to map to the child
>> as well, e.g. stderr or any particular port; but I don't know what
>> interface we should expose.
>
> Since patching was inconvenient for me, I eventually used:
>
> (use-modules ((ice-9 popen) #:select (open-process)))
>
> Which works even though `open-process` is not exported.

Note that this behavior of #:select is a bug.  We won't remove it in
stable-2.0 but we have removed it in master.

> For me, exporting `open-process` and documenting it would be enough.

Fine with me, many people have asked for this at this point.  I guess
that's the next step for this bug.

> I also like the Racket interface to processes:
> 
> (I've mostly used the `process` procedure.)

Duly noted!  The more we steal from Racket, the better Guile will be :)

Andy



Re: Support open-process and friends on MS-Windows

2016-06-25 Thread Eli Zaretskii
> From: Andy Wingo 
> Cc: l...@gnu.org (Ludovic Courtès),  guile-devel@gnu.org
> Date: Sat, 25 Jun 2016 16:43:34 +0200
> 
> > @@ -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?

The previous block is not MinGW-specific.  It allows any system that
has 'raise' (which is Standard C, so should be available everywhere)
to at least kill the current process.  This code was there before my
changes, and I saw no reasons to remove it.

> 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.

I didn't want to call the function 'kill', as some other linked-in
library might have it, and then you'd have a clash.  'kill' is too
simple a name to overload.

> > @@ -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?

Make the cast MinGW-only?

> > @@ -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'.

Sorry, I don't follow: the change in fprintf fixes a simple type (the
function whose call failed is 'execvp', not 'execlp'.  Or are you
talking about something else?

> I guess that's OK in practice.  Would you mind updating the
> documentation in doc/ref/posix.texi to indicate this?  Thanks.

Once I understand the issue, sure.

Thanks.



Re: Support open-process and friends on MS-Windows

2016-06-25 Thread Andy Wingo
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



Re: Support open-process and friends on MS-Windows

2016-06-25 Thread Eli Zaretskii
[Please disregard the previous patch and use this one instead.]

> From: l...@gnu.org (Ludovic Courtès)
> Cc: Andy Wingo ,  guile-devel@gnu.org
> Date: Sat, 25 Jun 2016 15:02:42 +0200
> 
> >> Great!  I have two nits.  One, if it is possible for you, please attach
> >> the patch in the format that "git format-patch" makes.  That makes it
> >> easy to apply, otherwise I have to futz around with --author and I could
> >> accidentally fat-finger it and get it wrong.
> >> 
> >> Secondly, please make w32-proc override the definitions of
> >> HAVE_GETPRIORITY, HAVE_SETPRIORITY, HAVE_SCHED_GETAFFINITY, and
> >> HAVE_SCHED_SETAFFINITY.  That way you won't need this kind of change
> >> either:
> >> 
> >> > -#if HAVE_GETPRIORITY
> >> > +#if HAVE_GETPRIORITY || defined __MINGW32__
> >> 
> >> If you've already discussed this with Ludovic and decided to go this way
> >> explicitly, please disregard this second nit.
> >> 
> >> I will also wait a day or two for any comments from Ludovic before
> >> applying.
> >
> > Thanks, I will wait for Ludovic to tell he's okay with overriding the
> > HAVE_* macros,
> 
> Yes, I agree with Andy, I think it’ll be nicer.
> 
> > and will send a format-patch formatted changes after that.
> 
> Cool, thank you!

Updated patch below.

>From 21d718f0b1c9bba62204eab7342406c46e5cbdc2 Mon Sep 17 00:00:00 2001
From: Eli Zaretskii 
Date: Sat, 25 Jun 2016 16:29:22 +0300
Subject: [PATCH] Provide support for open-process and related functions on
 MS-Windows

* libguile/w32-proc.c: New file, with MinGW support code for
scm_open_process, scm_kill, scm_getpriority, scm_setpriority,
scm_getaffinity, and scm_setaffinity.  Also, provides macros that
on Posix hosts are in sys/wait.h, like WIFEXITED and WTERMSIG, and
simple definitions for getuid, getgid, setuid, setgid, and
waitpid.

* libguile/posix.c [__MINGW32__]: Include w32-proc.c.
(scm_kill) [__MINGW32__]: Support killing subprocesses on MS-Windows.
(scm_status_exit_val, scm_getuid, scm_getegid): Don't exclude from
compilation with MinGW.
(scm_execl, scm_execle): Cast arguments of execv/execve to avoid
compiler warnings.
(scm_open_process): Condition parts specific to 'fork'-based
implementation with "#ifdef HAVE_FORK".
[__MINGW32__]: MinGW alternative to 'fork'-based implementation;
most of the supporting code is in w32-proc.c.
(scm_getpriority, scm_setpriority, scm_getaffinity)
(scm_setaffinity, scm_init_popen): Don't exclude from MinGW
compilation.
(scm_init_posix): Register scm_init_popen extension even if
HAVE_FORK is not defined.
---
 libguile/posix.c|  59 +++-
 libguile/w32-proc.c | 919 
 2 files changed, 960 insertions(+), 18 deletions(-)
 create mode 100644 libguile/w32-proc.c

diff --git a/libguile/posix.c b/libguile/posix.c
index 2654716..8541f7d 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -84,6 +84,10 @@
 #if HAVE_SYS_WAIT_H
 # include 
 #endif
+#ifdef __MINGW32__
+# include 
+#endif	/* __MINGW32__ */
+
 #ifndef WEXITSTATUS
 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
 #endif
@@ -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;
 }
@@ -735,7 +743,6 @@ SCM_DEFINE (scm_waitpid, "waitpid", 1, 1, 0,
 #undef FUNC_NAME
 #endif /* HAVE_WAITPID */
 
-#ifndef __MINGW32__
 SCM_DEFINE (scm_status_exit_val, "status:exit-val", 1, 0, 0, 
 (SCM status),
 	"Return the exit status value, as would be set if a process\n"
@@ -786,7 +793,6 @@ SCM_DEFINE (scm_status_stop_sig, "status:stop-sig", 1, 0, 0,
 return SCM_BOOL_F;
 }
 #undef FUNC_NAME
-#endif /* __MINGW32__ */
 
 #ifdef HAVE_GETPPID
 SCM_DEFINE (scm_getppid, "getppid", 0, 0, 0,
@@ -801,7 +807,6 @@ SCM_DEFINE (scm_getppid, "getppid", 0, 0, 0,
 #endif /* HAVE_GETPPID */
 
 
-#ifndef __MINGW32__
 SCM_DEFINE (scm_getuid, "getuid", 0, 0, 0,
 (),
 	"Return an integer representing the current real user ID.")
@@ -905,10 +910,8 @@ SCM_DEFINE (scm_seteuid, "seteuid", 1, 0, 0,
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
-#endif /* __MINGW32__ */
 
 
-#ifdef HAVE_SETEGID
 SCM_DEFINE (scm_setegid, "setegid", 1, 0, 0,
 (SCM id),
 	"Sets the effective group ID to the integer @var{id}, provided the process\n"
@@ -931,7 +934,6 @@ SCM_DEFINE (scm_setegid, "setegid", 1, 0, 0,
 
 }
 #undef FUNC_NAME
-#endif
 
 
 #ifdef HAVE_GETPGRP
@@ -1141,7 +1143,7 @@ SCM_DEFINE (scm_execl, "execl", 

Re: Support open-process and friends on MS-Windows

2016-06-25 Thread Eli Zaretskii
> From: l...@gnu.org (Ludovic Courtès)
> Cc: Andy Wingo ,  guile-devel@gnu.org
> Date: Sat, 25 Jun 2016 15:02:42 +0200
> 
> >> Great!  I have two nits.  One, if it is possible for you, please attach
> >> the patch in the format that "git format-patch" makes.  That makes it
> >> easy to apply, otherwise I have to futz around with --author and I could
> >> accidentally fat-finger it and get it wrong.
> >> 
> >> Secondly, please make w32-proc override the definitions of
> >> HAVE_GETPRIORITY, HAVE_SETPRIORITY, HAVE_SCHED_GETAFFINITY, and
> >> HAVE_SCHED_SETAFFINITY.  That way you won't need this kind of change
> >> either:
> >> 
> >> > -#if HAVE_GETPRIORITY
> >> > +#if HAVE_GETPRIORITY || defined __MINGW32__
> >> 
> >> If you've already discussed this with Ludovic and decided to go this way
> >> explicitly, please disregard this second nit.
> >> 
> >> I will also wait a day or two for any comments from Ludovic before
> >> applying.
> >
> > Thanks, I will wait for Ludovic to tell he's okay with overriding the
> > HAVE_* macros,
> 
> Yes, I agree with Andy, I think it’ll be nicer.
> 
> > and will send a format-patch formatted changes after that.
> 
> Cool, thank you!

Thanks, updated patch attached below.

>From a02b0c9a95ce286669b2f7b76beba9709e8d9601 Mon Sep 17 00:00:00 2001
From: Eli Zaretskii 
Date: Sat, 25 Jun 2016 16:14:21 +0300
Subject: [PATCH] Provide support for open-process and related functions on
 MS-Windows

* libguile/w32-proc.c: New file, with MinGW support code for
scm_open_process, scm_kill, scm_getpriority, scm_setpriority,
scm_getaffinity, and scm_setaffinity.  Also, provides macros that
on Posix hosts are in sys/wait.h, like WIFEXITED and WTERMSIG, and
simple definitions for getuid, getgid, setuid, setgid, and
waitpid.

* libguile/posix.c [__MINGW32__]: Include w32-proc.c.
(scm_kill) [__MINGW32__]: Support killing subprocesses on MS-Windows.
(scm_status_exit_val, scm_getuid, scm_getegid): Don't exclude from
compilation with MinGW.
(scm_execl, scm_execle): Cast arguments of execv/execve to avoid
compiler warnings.
(scm_open_process): Condition parts specific to 'fork'-based
implementation with "#ifdef HAVE_FORK".
[__MINGW32__]: MinGW alternative to 'fork'-based implementation;
most of the supporting code is in w32-proc.c.
(scm_getpriority, scm_setpriority, scm_getaffinity)
(scm_setaffinity, scm_init_popen): Don't exclude from MinGW
compilation.
(scm_init_posix): Register scm_init_popen extension even if
HAVE_FORK is not defined.
---
 libguile/posix.c|  75 +++--
 libguile/w32-proc.c | 919 
 2 files changed, 968 insertions(+), 26 deletions(-)
 create mode 100644 libguile/w32-proc.c

diff --git a/libguile/posix.c b/libguile/posix.c
index 2654716..741867c 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -84,6 +84,10 @@
 #if HAVE_SYS_WAIT_H
 # include 
 #endif
+#ifdef __MINGW32__
+# include 
+#endif	/* __MINGW32__ */
+
 #ifndef WEXITSTATUS
 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
 #endif
@@ -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;
 }
@@ -735,7 +743,6 @@ SCM_DEFINE (scm_waitpid, "waitpid", 1, 1, 0,
 #undef FUNC_NAME
 #endif /* HAVE_WAITPID */
 
-#ifndef __MINGW32__
 SCM_DEFINE (scm_status_exit_val, "status:exit-val", 1, 0, 0, 
 (SCM status),
 	"Return the exit status value, as would be set if a process\n"
@@ -786,7 +793,6 @@ SCM_DEFINE (scm_status_stop_sig, "status:stop-sig", 1, 0, 0,
 return SCM_BOOL_F;
 }
 #undef FUNC_NAME
-#endif /* __MINGW32__ */
 
 #ifdef HAVE_GETPPID
 SCM_DEFINE (scm_getppid, "getppid", 0, 0, 0,
@@ -801,7 +807,6 @@ SCM_DEFINE (scm_getppid, "getppid", 0, 0, 0,
 #endif /* HAVE_GETPPID */
 
 
-#ifndef __MINGW32__
 SCM_DEFINE (scm_getuid, "getuid", 0, 0, 0,
 (),
 	"Return an integer representing the current real user ID.")
@@ -905,10 +910,8 @@ SCM_DEFINE (scm_seteuid, "seteuid", 1, 0, 0,
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
-#endif /* __MINGW32__ */
 
 
-#ifdef HAVE_SETEGID
 SCM_DEFINE (scm_setegid, "setegid", 1, 0, 0,
 (SCM id),
 	"Sets the effective group ID to the integer @var{id}, provided the process\n"
@@ -931,7 +934,6 @@ SCM_DEFINE (scm_setegid, "setegid", 1, 0, 0,
 
 }
 #undef FUNC_NAME
-#endif
 
 
 #ifdef HAVE_GETPGRP
@@ -1141,7 +1143,7 @@ SCM_DEFINE (scm_execl, "execl", 1, 0, 1,
 
   exec_argv = 

Re: Support open-process and friends on MS-Windows

2016-06-25 Thread Ludovic Courtès
Eli Zaretskii  skribis:

>> From: Andy Wingo 
>> Cc: l...@gnu.org,  guile-devel@gnu.org
>> Date: Sat, 25 Jun 2016 11:51:53 +0200
>> 
>> On Sat 25 Jun 2016 11:11, Eli Zaretskii  writes:
>> 
>> > Here's the modified patch with the couple of changes requested in
>> > response to the previous version:
>> 
>> Great!  I have two nits.  One, if it is possible for you, please attach
>> the patch in the format that "git format-patch" makes.  That makes it
>> easy to apply, otherwise I have to futz around with --author and I could
>> accidentally fat-finger it and get it wrong.
>> 
>> Secondly, please make w32-proc override the definitions of
>> HAVE_GETPRIORITY, HAVE_SETPRIORITY, HAVE_SCHED_GETAFFINITY, and
>> HAVE_SCHED_SETAFFINITY.  That way you won't need this kind of change
>> either:
>> 
>> > -#if HAVE_GETPRIORITY
>> > +#if HAVE_GETPRIORITY || defined __MINGW32__
>> 
>> If you've already discussed this with Ludovic and decided to go this way
>> explicitly, please disregard this second nit.
>> 
>> I will also wait a day or two for any comments from Ludovic before
>> applying.
>
> Thanks, I will wait for Ludovic to tell he's okay with overriding the
> HAVE_* macros,

Yes, I agree with Andy, I think it’ll be nicer.

> and will send a format-patch formatted changes after that.

Cool, thank you!

Ludo’.



Re: Support open-process and friends on MS-Windows

2016-06-25 Thread Eli Zaretskii
> From: Andy Wingo 
> Cc: l...@gnu.org,  guile-devel@gnu.org
> Date: Sat, 25 Jun 2016 11:51:53 +0200
> 
> On Sat 25 Jun 2016 11:11, Eli Zaretskii  writes:
> 
> > Here's the modified patch with the couple of changes requested in
> > response to the previous version:
> 
> Great!  I have two nits.  One, if it is possible for you, please attach
> the patch in the format that "git format-patch" makes.  That makes it
> easy to apply, otherwise I have to futz around with --author and I could
> accidentally fat-finger it and get it wrong.
> 
> Secondly, please make w32-proc override the definitions of
> HAVE_GETPRIORITY, HAVE_SETPRIORITY, HAVE_SCHED_GETAFFINITY, and
> HAVE_SCHED_SETAFFINITY.  That way you won't need this kind of change
> either:
> 
> > -#if HAVE_GETPRIORITY
> > +#if HAVE_GETPRIORITY || defined __MINGW32__
> 
> If you've already discussed this with Ludovic and decided to go this way
> explicitly, please disregard this second nit.
> 
> I will also wait a day or two for any comments from Ludovic before
> applying.

Thanks, I will wait for Ludovic to tell he's okay with overriding the
HAVE_* macros, and will send a format-patch formatted changes after
that.



Re: Support open-process and friends on MS-Windows

2016-06-25 Thread Andy Wingo
On Sat 25 Jun 2016 11:11, Eli Zaretskii  writes:

> Here's the modified patch with the couple of changes requested in
> response to the previous version:

Great!  I have two nits.  One, if it is possible for you, please attach
the patch in the format that "git format-patch" makes.  That makes it
easy to apply, otherwise I have to futz around with --author and I could
accidentally fat-finger it and get it wrong.

Secondly, please make w32-proc override the definitions of
HAVE_GETPRIORITY, HAVE_SETPRIORITY, HAVE_SCHED_GETAFFINITY, and
HAVE_SCHED_SETAFFINITY.  That way you won't need this kind of change
either:

> -#if HAVE_GETPRIORITY
> +#if HAVE_GETPRIORITY || defined __MINGW32__

If you've already discussed this with Ludovic and decided to go this way
explicitly, please disregard this second nit.

I will also wait a day or two for any comments from Ludovic before
applying.

Thanks again, great stuff!

Andy



Re: Master - Do not track html, tmp and some test-suite files

2016-06-25 Thread Andy Wingo
On Sat 25 Jun 2016 04:40, David Pirotte  writes:

> Note that make check leaves the following toplevel file [a symlink to itself] 
> behind:
>
>   filesys-test-link.tmp

I have seen this and I don't know why this is, and I would prefer to fix
it rather than ignoring it.

>  config.log
>  config.h
>  *.doc
> +*.html

doc/ref/guile.html please

> @@ -142,6 +144,7 @@ INSTALL
>  /test-suite/standalone/test-scm-spawn-thread
>  /test-suite/standalone/test-pthread-create
>  /test-suite/standalone/test-pthread-create-secondary
> +/test-suite/standalone/test-smob-mark-race
>  /lib/fcntl.h

Good catch!

So just a couple of nits, then please resend.  Thanks :)

Andy



Re: Stable-2.0 - patch - Do not track html dirs and files

2016-06-25 Thread Andy Wingo
On Sat 25 Jun 2016 04:08, David Pirotte  writes:

> diff --git a/.gitignore b/.gitignore
> index 3deeab2..bce9756 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -13,6 +13,7 @@ config.status
>  config.log
>  config.h
>  *.doc
> +*.html
>  *.x
>  *.lo
>  *.la

Can you make it more specific please?  I.e. doc/ref/guile.html.

Thanks,

Andy



reviewer for time-related bugs (srfi-19)

2016-06-25 Thread Andy Wingo
Thanks, that's great :)

For this and the other time-related bugs it sounds like you know what
you're doing but I would like someone to check the work just to make
sure we're not introducing new errors.

To that end, I ask guile-devel, in this top-post so that people will see
it :), for a volunteer!

Are you a person who is interested in the specifics of time
representation?  TAI, UTC, and all that?

If so your input is very much appreciated on the patch quoted below from
bug 21902, and also on these other bugs:

 https://debbugs.gnu.org/21902  doc incorrectly describes Julian Date
 https://debbugs.gnu.org/21903  date->string duff ISO 8601 negative years
 https://debbugs.gnu.org/21904  date->string duff ISO 8601 format for 
non-4-digit years
 https://debbugs.gnu.org/21906  julian-day->date negative input breakage
 https://debbugs.gnu.org/21907  date->string duff ISO 8601 zone format
 https://debbugs.gnu.org/21911  TAI-to-UTC conversion leaps at wrong time
 https://debbugs.gnu.org/21912  TAI<->UTC conversion botches the unknown
 https://debbugs.gnu.org/22033  time-utc format is lossy
 https://debbugs.gnu.org/22034  time-utc->date shows bogus zone-dependent leap 
second

To give feedback is very easy.  The first thing is to confirm the bug
report: does it make sense to you?  If you or Zefram comes up with a
patch to fix the issue, as below, that's even better of course, but
already just a confirmation of the bug would be great.

To comment on the bug, just send a mail to n...@debbugs.gnu.org, where
 is the bug number.  Super easy.

Cheers, and thanks in advance!

Andy

On Fri 24 Jun 2016 20:01, Zefram  writes:

> Andy Wingo wrote:
>>Would you like to propose a specific patch to the documentation?
>
> Sure.  Patch attached.
>
> -zefram
>
> --- a/doc/ref/srfi-modules.texi   2014-03-20 20:21:21.0 +
> +++ b/doc/ref/srfi-modules.texi   2016-06-24 18:57:59.088243245 +0100
> @@ -2461,8 +2461,8 @@
>  @cindex UTC
>  @cindex TAI
>  This module implements time and date representations and calculations,
> -in various time systems, including universal time (UTC) and atomic
> -time (TAI).
> +in various time systems, including Coordinated Universal Time (UTC)
> +and International Atomic Time (TAI).
>  
>  For those not familiar with these time systems, TAI is based on a
>  fixed length second derived from oscillations of certain atoms.  UTC
> @@ -2494,18 +2494,12 @@
>  @cindex julian day
>  @cindex modified julian day
>  Also, for those not familiar with the terminology, a @dfn{Julian Day}
> -is a real number which is a count of days and fraction of a day, in
> -UTC, starting from -4713-01-01T12:00:00Z, ie.@: midday Monday 1 Jan
> -4713 B.C.  A @dfn{Modified Julian Day} is the same, but starting from
> -1858-11-17T00:00:00Z, ie.@: midnight 17 November 1858 UTC.  That time
> -is julian day 240.5.
> -
> -@c  The SRFI-1 spec says -4714-11-24T12:00:00Z (November 24, -4714 at
> -@c  noon, UTC), but this is incorrect.  It looks like it might have
> -@c  arisen from the code incorrectly treating years a multiple of 100
> -@c  but not 400 prior to 1582 as non-leap years, where instead the Julian
> -@c  calendar should be used so all multiples of 4 before 1582 are leap
> -@c  years.
> +is a real number which is a count of days and fraction of a day, in UT,
> +starting from -4713-11-24T12:00:00Z, ie.@: midday UT on Monday 24 November
> +4714 BC in the proleptic Gregorian calendar (1 January 4713 BC in the
> +proleptic Julian calendar).  A @dfn{Modified Julian Day} is the same,
> +but starting from 1858-11-17T00:00:00Z, ie.@: midnight UT on Wednesday
> +17 November AD 1858.  That time is julian day 240.5.
>  
>  
>  @node SRFI-19 Time



Re: Support open-process and friends on MS-Windows

2016-06-25 Thread Eli Zaretskii
Here's the modified patch with the couple of changes requested in
response to the previous version:

Author: Eli Zaretskii 
Date:   Fri Jun 25 12:10:34 2016 +0300

Provide support for open-process and related functions on MS-Windows

* libguile/w32-proc.c: New file, with MinGW support code for
scm_open_process, scm_kill, scm_getpriority, scm_setpriority,
scm_getaffinity, and scm_setaffinity.  Also, provides macros that
on Posix hosts are in sys/wait.h, like WIFEXITED and WTERMSIG, and
simple definitions for getuid, getgid, setuid, setgid, and
waitpid.

* libguile/posix.c [__MINGW32__]: Include w32-proc.c.
(scm_kill) [__MINGW32__]: Support killing subprocesses on MS-Windows.
(scm_status_exit_val, scm_getuid, scm_getegid): Don't exclude from
compilation with MinGW.
(scm_execl, scm_execle): Cast arguments of execv/execve to avoid
compiler warnings.
(scm_open_process): Condition parts specific to 'fork'-based
implementation with "#ifdef HAVE_FORK".
[__MINGW32__]: MinGW alternative to 'fork'-based implementation;
most of the supporting code is in w32-proc.c.
(scm_getpriority, scm_setpriority, scm_getaffinity)
(scm_setaffinity, scm_init_popen): Don't exclude from MinGW
compilation.
(scm_init_posix): Register scm_init_popen extension even if
HAVE_FORK is not defined.

diff --git a/libguile/posix.c b/libguile/posix.c
index 2654716..741867c 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -84,6 +84,10 @@
 #if HAVE_SYS_WAIT_H
 # include 
 #endif
+#ifdef __MINGW32__
+# include 
+#endif /* __MINGW32__ */
+
 #ifndef WEXITSTATUS
 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
 #endif
@@ -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;
 }
@@ -735,7 +743,6 @@ SCM_DEFINE (scm_waitpid, "waitpid", 1, 1, 0,
 #undef FUNC_NAME
 #endif /* HAVE_WAITPID */
 
-#ifndef __MINGW32__
 SCM_DEFINE (scm_status_exit_val, "status:exit-val", 1, 0, 0, 
 (SCM status),
"Return the exit status value, as would be set if a process\n"
@@ -786,7 +793,6 @@ SCM_DEFINE (scm_status_stop_sig, "status:stop-sig", 1, 0, 0,
 return SCM_BOOL_F;
 }
 #undef FUNC_NAME
-#endif /* __MINGW32__ */
 
 #ifdef HAVE_GETPPID
 SCM_DEFINE (scm_getppid, "getppid", 0, 0, 0,
@@ -801,7 +807,6 @@ SCM_DEFINE (scm_getppid, "getppid", 0, 0, 0,
 #endif /* HAVE_GETPPID */
 
 
-#ifndef __MINGW32__
 SCM_DEFINE (scm_getuid, "getuid", 0, 0, 0,
 (),
"Return an integer representing the current real user ID.")
@@ -905,10 +910,8 @@ SCM_DEFINE (scm_seteuid, "seteuid", 1, 0, 0,
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
-#endif /* __MINGW32__ */
 
 
-#ifdef HAVE_SETEGID
 SCM_DEFINE (scm_setegid, "setegid", 1, 0, 0,
 (SCM id),
"Sets the effective group ID to the integer @var{id}, provided the 
process\n"
@@ -931,7 +934,6 @@ SCM_DEFINE (scm_setegid, "setegid", 1, 0, 0,
 
 }
 #undef FUNC_NAME
-#endif
 
 
 #ifdef HAVE_GETPGRP
@@ -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.  */
@@ -1170,7 +1172,7 @@ SCM_DEFINE (scm_execlp, "execlp", 1, 0, 1,
 
   exec_argv = scm_i_allocate_string_pointers (args);
 
-  execvp (exec_file, exec_argv);
+  execvp (exec_file, (char const * const *)exec_argv);
   SCM_SYSERROR;
 
   /* not reached.  */
@@ -1204,7 +1206,8 @@ SCM_DEFINE (scm_execle, "execle", 2, 0, 1,
   exec_argv = scm_i_allocate_string_pointers (args);
   exec_env = scm_i_allocate_string_pointers (env);
 
-  execve (exec_file, exec_argv, exec_env);
+  execve (exec_file, (char const * const *)exec_argv,
+ (char const * const *)exec_env);
   SCM_SYSERROR;
 
   /* not reached.  */
@@ -1246,6 +1249,7 @@ SCM_DEFINE (scm_fork, "primitive-fork", 0, 0, 0,
   return scm_from_int (pid);
 }
 #undef FUNC_NAME
+#endif /* HAVE_FORK */
 
 /* Since Guile uses threads, we have to be very careful to avoid calling
functions that are not async-signal-safe in the child.  That's why
@@ -1262,7 +1266,9 @@ scm_open_process (SCM mode, SCM prog, SCM args)
   int pid;
   char *exec_file;
   char **exec_argv;
+#ifdef HAVE_FORK
   int max_fd = 1024;
+#endif
 
   exec_file = scm_to_locale_string (prog);
   exec_argv = scm_i_allocate_string_pointers