bug#61073: ‘spawn’ crashes when passed a non-file port

2023-01-26 Thread Ludovic Courtès
Here’s an example:

--8<---cut here---start->8---
$ ./meta/guile
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (with-error-to-port (%make-void-port "w") (lambda () 
(spawn "date" (list "date"
Segmentation fault
--8<---cut here---end--->8---

This is due to the careless use of ‘SCM_FPORT_FDES’ there.

Ludo’.





bug#61073: ‘spawn’ crashes when passed a non-file port

2023-01-26 Thread Ludovic Courtès
Ludovic Courtès  skribis:

> Here’s an example:
>
> $ ./meta/guile
> GNU Guile 3.0.9
> Copyright (C) 1995-2023 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guile-user)> (with-error-to-port (%make-void-port "w") (lambda () 
> (spawn "date" (list "date"
> Segmentation fault
>
> This is due to the careless use of ‘SCM_FPORT_FDES’ there.

Fixed in 5b42f8c154906584455a4989038406c88b723cb0.

Ludo’.





bug#61079: [3.0.9] ‘system*’ broken on GNU/Hurd

2023-01-26 Thread Ludovic Courtès
This test fails on GNU/Hurd:

--8<---cut here---start->8---
checking for library containing posix_spawn... none required
checking whether posix_spawn is declared... yes
checking for posix_spawn... yes
checking whether posix_spawn is declared... (cached) yes
checking whether posix_spawn works... yes
checking whether posix_spawn rejects scripts without shebang... yes
checking whether posix_spawnp rejects scripts without shebang... yes
checking whether posix_spawnattr_setschedpolicy is supported... yes
checking whether posix_spawnattr_setschedparam is supported... yes
checking for mbstate_t... yes
checking for ssize_t... yes
checking for sched.h... yes
checking for struct sched_param... yes
checking whether  is self-contained... yes
checking whether setenv is declared... yes
checking for search.h... yes
checking for tsearch... yes
checking for sigset_t... yes
checking for uid_t in sys/types.h... yes
checking for volatile sig_atomic_t... yes
checking for sighandler_t... yes
checking for posix_spawnattr_t... yes
checking for posix_spawn_file_actions_t... yes

[…]

make[5]: Entering directory 
'/tmp/guix-build-guile-3.0.9rc1.drv-0/guile-3.0.9rc1/test-suite/standalone'
In execvp of guile: Bad file descriptor
test-system-cmds: system* exit status was 127 rather than 42
FAIL: test-system-cmds
--8<---cut here---end--->8---

This looks like a bug in the new ‘posix_spawn’-based ‘system*’, or (more
likely) in the ‘posix_spawn’ implementation for the Hurd in glibc.

Ludo’.





bug#61086: [3.0.9] Wrong ‘AR’ value in ‘--enable-lto’ builds

2023-01-26 Thread Ludovic Courtès
In 3.0.9, ‘configure --enable-lto’ goes like this:

--8<---cut here---start->8---
checking for ar... ar
checking the archiver (ar) interface... ar
checking for ar... (cached) ar
checking for ranlib... ranlib
checking for gcc option to enable large file support... none needed
configure: autobuild project... GNU Guile
configure: autobuild revision... 3.0.9
./configure: line 8292: hostname: command not found
configure: autobuild timestamp... 20230126T203648Z
checking whether the compiler supports -flto... yes
checking for lto-specific prefix for ar, nm, objcopy, ranlib... gcc
checking for gcc-nm... gcc-nm
checking for gcc-objcopy... no
checking for objcopy... objcopy
checking compiler's C standard... c11
--8<---cut here---end--->8---

Notice that there’s no line for ‘gcc-ar’.  ‘configure.ac’ reads this:

--8<---cut here---start->8---
AC_MSG_CHECKING([for lto-specific prefix for ar, nm, objcopy, ranlib])
if test "$GCC" = yes; then
   TOOLCHAIN_PREFIX=gcc
else
   # Assuming LLVM if not GCC.  Probably won't hurt.
   TOOLCHAIN_PREFIX=llvm
fi
AC_MSG_RESULT([$TOOLCHAIN_PREFIX])
AC_CHECK_TOOLS([AR], [$TOOLCHAIN_PREFIX-ar ar])
AC_CHECK_TOOLS([NM], [$TOOLCHAIN_PREFIX-nm nm])
AC_CHECK_TOOLS([OBJCOPY], [$TOOLCHAIN_PREFIX-objcopy objcopy])
AC_CHECK_TOOLS([RANLIB], [$TOOLCHAIN_PREFIX-ranlib ranlib])
--8<---cut here---end--->8---

… but here the ‘AR’ and ‘RANLIB’ bits are omitted, because their value
were already computed earlier.

Contrast with 3.0.8, where the LTO tool search happened before:

--8<---cut here---start->8---
checking dependency style of gcc... gcc3
checking whether the compiler supports -flto... yes
checking for lto-specific prefix for ar, nm, objcopy, ranlib... gcc
checking for gcc-ar... gcc-ar
checking for gcc-nm... gcc-nm
checking for gcc-objcopy... no
checking for objcopy... objcopy
checking for gcc-ranlib... gcc-ranlib
checking how to enable C11 support... -std=gnu11

[...]

checking for Minix Amsterdam compiler... no
checking the archiver (gcc-ar) interface... ar
checking for ar... (cached) gcc-ar
checking for special C compiler options needed for large files... no
--8<---cut here---end--->8---

The effect is that 3.0.9 fails to build when doing a static build as
with (@ (gnu packages make-bootstrap) %guile-static-3.0) in Guix:

--8<---cut here---start->8---
  CCLD libguile-3.0.la
ar: libguile_3.0_la-alist.o: plugin needed to handle lto object
ranlib: .libs/libguile-3.0.a(libguile_3.0_la-alist.o): plugin needed to handle 
lto object
  CCLD guile
ld: /tmp/guix-build-guile-static-3.0.9.drv-0/ccQkracO.ltrans0.ltrans.o: in 
function `inner_main':
/tmp/guix-build-guile-static-3.0.9.drv-0/guile-3.0.9/libguile/guile.c:50: 
undefined reference to `scm_shell'
ld: /tmp/guix-build-guile-static-3.0.9.drv-0/ccQkracO.ltrans0.ltrans.o: in 
function `main':
/tmp/guix-build-guile-static-3.0.9.drv-0/guile-3.0.9/libguile/guile.c:94: 
undefined reference to `scm_boot_guile'
collect2: error: ld returned 1 exit status
--8<---cut here---end--->8---

(Notice the “plugin needed” message, due to the fact that we’re using
‘ranlib’ instead of ‘gcc-ranlib’.)

This may be a side effect of aeb22f486139f457ae7fc44c2d931312aaae52d8,
which moved ‘gl_EARLY’ earlier (not surprisingly).

Ludo’.