1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-19 03:00:25 +02:00
Commit graph

21349 commits

Author SHA1 Message Date
Michael Gran
4cac137b01 Lightening: _WIN32 updates from upstream lightning
Pulls in a few updates for WIN32 from upstream GNU lightning.
Based on patches from GNU Lightning.
2025-03-30 18:10:58 -07:00
Michael Gran
0b70769247 Win32: add replacement for mkdtemp
* libguile/posix-w32.c (mkdtemp): new win32 replacement procedure
* libguile/posix-w32.h: add declaration for mkdtemp
  (HAVE_MKDTEMP): new define
* libguile/filesys.c: include posix-w32.h
2025-03-30 18:10:48 -07:00
Michael Gran
c08debbd39 In lightening, don't use visibility hidden on DLL using systems
* libguile/lightening/lightening.h
  [!_WIN32 && !__CYGWIN__] (JIT_API): don't define to visiblity hidden
2025-03-30 18:10:35 -07:00
Michael Gran
faa6b8cf82 WIN32: use GCC builtin ffs to replace missing function
FFS is missing on MINGW.

* libguile/lightening/lightening/x86-cpu.c
  [__GNUC__ && _WIN32](USE_BUILTIN_FFS): new macro
  (__ffs): wrapper function
  (ffsw): use __ffs;
2025-03-30 18:10:30 -07:00
Michael Gran
2177f3f6c5 filesys.test: fixes for copy-file test on MinGW
In the copy-file test, is uses call-with-input-file and get-string-all
to retrieve file contents. Since the file is not opened in binary mode,
CRLF line ending may be added when writing and then reading the string
back from the filesystem.

* test-suite/tests/filesys.test (normalize-newlines): new helper function
  ("copy file: copy-file dest content"): pass even if CRLF line endings
  are added
  ("copy file: read only dest"): handle posibility of geteuid not
  being defined
2025-03-30 18:10:24 -07:00
Michael Gran
6b4d829d40 in filesys test, add helper function for deleting files and symlinks
On Windows, a file needs to have write permission to be deleted.
This adds a helper to handle that case, but, is used generally.

* test-suite/tests/filesys.test (%delete-file): new helper function
  Replace every delete-file call with %delete-file.
2025-03-30 18:10:16 -07:00
Michael Gran
cc1c79ae34 In test suite, ensure file ports are closed before deletion
On Windows, open file ports cannot be deleted.

* test-suite/tests/ports.test ("relative canonicalization with common prefixes"):
    close port before deletion
* test-suite/tests/posix.test (utime-unless-unsupported): take a port arg
  ("file port"): use new utime-unless-unsupported. Close port before deletion.
* test-suite/tests/filesys.test ("port representing a regular file"):
    throw unsupported before creating file
2025-03-30 18:10:07 -07:00
Michael Gran
1174e1eb9d Allows modification of shell used by open-pipe
open-pipe executes a shell command in a subprocess. This commit adds
the ability to modify the shell used for executing commands.
The default "/bin/sh -c" can be inspected and modified by the
new procedure-with-setter 'pipe-shell-command-transformer'.

This useful in MinGW since its "sh" is not in "/bin".

* module/ice-9/popen.scm (%command-transformer): new procedure
  (pipe-shell-command-transformer): new procedure-with-setter
  (open-pipe): use new command transformer
* doc/ref/posix.texi (open-pipe): mention pipe-shell-command-transformer
  (pipe-shell-command-transformer): document new procedure
* test-suite/tests/popen.test ("pipe-shell-command-transformer"): new tests
  Also, modify open-pipe shell for MinGW
* NEWS: updated
* test-suite/tests/ports.test (mingw?): new variable
    Also, modify open-pipe shell for MinGW
2025-03-30 18:09:37 -07:00
Michael Gran
9d625278f7 fixes for chmodat test
* test-suite/tests/filesys.test (chmodat): some chmodat tests don't test if it
   exists. Mark unwritable file writable before deleting.
  ("port representing a regular file"): reorder to avoid unclosed
     port on exception.
2025-03-30 18:02:21 -07:00
Michael Gran
afda13e4ac For MinGW, use native signal func in sigaction
For MinGW, there is a native signal function in UCRT. It handles
a limited set of signals.

* libguile/scmsigs.c (scm_sigaction_for_thread)[__MINGW32__]: removed
  (scm_sigaction_for_thread)[!__MINGW32__]: use for MinGW as well.
    For signals outside UCRT's native signal set, always return SIG_IGN.
2025-03-30 18:02:02 -07:00
Jan (janneke) Nieuwenhuizen
70f434111b guix: Add guile-patched, guile-mingw.
Build it:

    GUIX_PACKAGE_PATH=guix guix build --target=x86_64-w64-mingw32 guile-mingw

Run it:

    WINEPATH=$(guix shell wine64 -- winepath -w                                     \
        $(echo $(guix gc -R                                                         \
                      $(GUIX_PACKAGE_PATH=guix guix build                           \
                                         --target=x86_64-w64-mingw32 guile-mingw))) \
                   | sed 's,$,/bin,g' | tr '\n' ';')                                \
            guix shell wine64 -- wine                                               \
            $(GUIX_PACKAGE_PATH=guix guix build --target=x86_64-w64-mingw32         \
                               guile-mingw)/bin/guile.exe                           \
            -c '(format #t "Hello  ~a world!\n" %host-type)'

* guix/guile-patched.scm,
guix/mingw.scm: New files.
2025-03-30 18:01:15 -07:00
Rutger van Beusekom
12ad1a9ad2 DRAFT Add partial `scm_fcntl' support for MinGW.
* libguile/filesys.c (_mingw_debug_p)[__MINGW32__: New function.
(scm_fcntl)[__MINGW32__]: Add support creating non-blocking sockets.
2025-03-30 17:59:44 -07:00
Jan (janneke) Nieuwenhuizen
2b86a3b1cb Add `scm_sigaction_for_thread' stub for MinGW.
* libguile/scmsigs.c (scm_sigaction_for_thread)[__MINGW32__]: New stub.
(SIGHUP, SIGPIPE)[__MINGW32__]: New defines.
2025-03-30 17:59:38 -07:00
Jan (janneke) Nieuwenhuizen
eaa38d6381 Install 'mingw_take_signal' on MinGW.
After installing a signal handler, these are handled

    * C-c
    * kill -SIGINT <guile.exe-pid> (the wine process) works

these result in a direct terminate (or kill even?)

    - kill <guile.exe-pid>
    - wine cmd /c guile -c '(kill <guile-exe.pid> SIGINT)'
    - wine cmd /c guile -c '(kill <guile-exe.pid> SIGTERM)'

* libguile/scmsigs.c (mingw_take_signal)[__MINGW32__]: New function.
install_mingw_take_signal)[__MINGW32__]: New function.
(scm_init_scmsigs)[__MINGW32__]: Use it.
2025-03-30 17:59:22 -07:00
Jan (janneke) Nieuwenhuizen
b55397ea5d Make `read-bytes' suspendable for socket reads on MinGW.
On MinGW, port-read will block on sockets if no data is available.
Avoid blocking by using select first.

* module/ice-9/suspendable-ports.scm (read-bytes): For socket ports,
guard port-read with select.
2025-03-30 17:59:11 -07:00
Jan (janneke) Nieuwenhuizen
a043eaf349 Support for x86_64-w64-mingw32.
On x86-64-MinGW the size of long is 4.  As long is used for
SCM_FIXNUM_BIT, that would mean incompatible .go files, and waste of
cell space.  So we would like to use long long, but the GMP interface
uses long.

To get around this, the x86-64-MinGW port now requires the use of
mini-GMP.  Mini-GMP has been changed to use intptr_t and uintptr_t.

Likewise, "integers.{h,c}" and "numbers.{h,c}" now use intptr_t instead
of scm_t_inum or long, and uintptr_t instead of unsigned long.

* configure.ac: When x86_64-w64-mingw32, require mini-GMP.
* libguile/mini-gmp.h: Use intptr_t instead of long, uintptr_t instead
of unsigned long throughout.
* libguile/mini-gmp.c: Likewise.
* libguile/scm.h (SCM_INTPTR_T_BIT): New define.
* libguile/numbers.h (SCM_FIXNUM_BIT): Use it.
* libguile/numbers.c (L1, UL1): New macros.  Use them thoughout instead
of 1L, 1UL.
(verify): Use SCM_INTPTR_T_BIT.
(verify): Use SCM_INTPTR_T_MAX and SCM_INTPTR_T_MIN.
(scm_from_inum): Remove macro.
Use intptr_t and uintptr_t instead of scm_t_inum or long, and unsigned
long.
* libguile/numbers.h (scm_from_intptr, scm_from_uintptr, scm_to_intptr,
scm_to_uintptr): New defines.
* libguile/integers.h: Use intptr_t and uintptr_t instead of scm_t_inum
and unsigned long.
* libguile/integers.c (L1) : New macro.  Use it thoughout instead of 1L.
Use intptr_t and uintptr_t instead of long and unsigned long.
(long_magnitude): Rename to...
(intptr_t_magnitude): ...this.  Use intptr_t, uintptr_t.
(negative_long): Rename to...
(negative_t_intptr): ...this.  Use uintptr_t, INTPTR_MIN.
(inum_magnitude): Use intptr_t.
(ulong_to_bignum): Rename to...
(uintptr_t_to_bignum): ...this.  Use uintptr_t.
(long_to_bignum): Rename to...
(intptr_t_to_bignum): ...this.  Use intptr_t.
(long_to_scm): Rename to...
(intptr_t_to_scm): ...this.  Use intptr_to_bignum.
(ulong_to_scm): Rename to...
(uintptr_t_to_scm): ...this.  Use uintptr_to_bignum.
(long_sign): Rename to..
(intptr_t_sign): ...this.  Use SCM_SIZEOF_INTPTR_T.
(bignum_cmp_long): Rename to...
(bignum_cmp_intptr_t): ...this.  Use uintptr_t.
* libguile/array-map.c (array_compare): Use uintptr_t instead of
unsigned long and intptr_t instead of long.
* libguile/arrays.c (make-shared-array): Use ssize_t instead of long.
* libguile/bytevectors.c (is_signed_int32, is_unsigned_int32)
[MINGW32 && __x86_64__]: Use ULL.
(twos_complement): Use uintptr_t instead of unsigned long.
* libguile/hash.c (JENKINS_LOOKUP3_HASHWORD2): Likewise.
(narrow_string_hash, wide_string_hash, scm_i_string_hash,
scm_i_locale_string_hash, scm_i_latin1_string_hash,
scm_i_utf8_string_hash, scm_i_struct_hash, scm_raw_ihashq,
scm_raw_ihash): Use and return uintptr_t instead of unsigned long.
(scm_hashv, scm_hash): Use SCM_UINTPTR_T_MAX.
* libguile/hash.h (scm_i_locale_string_hash, scm_i_latin1_string_hash,
scm_i_utf8_string_hash): update prototypes.
* libguile/scmsigs.c (sigaction): Use intptr_t instead of long.
* libguile/strings.c (scm_i_make_symbol, (scm_i_c_make_symbol): Use
uintptr_t instead of unsigned long.
* libguile/strings.h (scm_i_make_symbol, (scm_i_c_make_symbol): Update
declacations.
* libguile/srfi-60.c: Use scm_to_uintptr, scm_from_intptr and variants
throughout.
* libguile/symbols.c (symbol-hash): Use scm_from_uintptr.

Co-authored-by: Mike Gran <spk121@yahoo.com>
Co-authored-by: Andy Wingo <wingo@pobox.com>
2025-03-30 17:57:12 -07:00
Jan (janneke) Nieuwenhuizen
5caf66a51a Add 'set-port-binary/text-mode!' procedure for MinGW.
* libguile/ports.c (scm_init_ports)[O_BINARY]: Define 'O_BINARY'.
[O_TEXT]: Define 'O_TEXT'.
(scm_c_set_port_binary_text_mode_x): New function.
* libguile/ports.h (scm_set_binary_text_mode_x): Declare it.
* module/ice-9/ports.scm (ice-9): Export it as
'set-port-binary/text-mode!'.
* doc/ref/api-io.texi (File Ports): Document it.
2025-03-30 16:38:05 -07:00
Jan (janneke) Nieuwenhuizen
a3018d6d0e mingw: canonicalize-path: Also canonicalize drive letter and '/'.
* libguile/posix-w32.c (canonicalize_device_name,
slashify_file_name): New static functions.
(canonicalize_file_name_mingw): Use them in new function.
* libguile/posix-w32.h (canonicalize_file_name_mingw): Declare it.
(canonicalize_file_name): New define.
* libguile/filesys.c[__MINGW32__]: Include posix-w32.h to use it.
* libguile/fports.c[__MINGW32__]: Likewise.
2025-03-30 16:38:00 -07:00
Jan (janneke) Nieuwenhuizen
79ea1082d0 Link fix for MinGW.
This fixes

    libguile/threads.c:1502: undefined reference to `select_used_without_including_sys_select_h'

* libguile/threads.c: Include sys/select.h.
2025-03-30 16:34:17 -07:00
Michael Gran
af96820e07 Windows 11: for fport input from the console, ignore terminal returns
There is an apparent bug in Windows 11 (not Windows 10) where,
when reading from an fd backed by the Console, a single
return character will always be available.

* libguile/posix-w32.c (console_has_return_keyevent_w32): new procedure
* libguile/posix-w32.h: declare console_has_return_keyevent_w32
* libguile/fports.c [__MINGW32__](fport_input_waiting): ignore return keyevent
2025-03-23 10:26:40 -07:00
Michael Gran
adbf2156ab Remove posix-w32 subsitutes that require access to process handles
Now that Guile uses the posix_spawn gnulib module, several of Guile's
custom w32 functions substitutes no longer work. Some functions
relied on populating and maintaining an internal PID-to-Handle database,
which is no longer possible.

kill, getpriority, setpriority, getaffinity and setaffinity
are removed. waitpid is simplified and does not handle ENOHANG.

* NEWS: updated
* libguile/posix-w32.c (struct proc_record, find_proc, proc_handle): removed
  (record_proc, delete_proc, prepare_child_handle, compenv): removed
  (prepare_envblk, lookup_cmd, prepare_cmdline, start_child): removed
  (kill, getpriority, setpriority, sched_getaffinity): removed
  (sched_setaffinity): removed
  (waitpid): modified to just use _cwait. ENOHANG emlation removed.
* libguile/posix-w32.h (CPU_ZERO, CPU_ISSET, CPU_SET, CPU_SETSIZE): removed
  (cpu_set_t, PRIO_PROCESS, PRIO_PGRP, PRIO_USER): removed
  (HAVE_START_CHILD, HAVE_KILL, HAVE_GETPRIORITY): removed
  (HAVE_SETPRIORITY, HAVE_SCHED_GETAFFINITY, HAVE_SCHED_SETAFFINITY): removed
  declarations for waitpid, start_child, kill, getpriority: removed
  declarations for setpriority, sched_getaffinity, sched_set_affinity: Removed
2025-03-22 21:57:59 -07:00
Michael Gran
2e51d3fa26 In piped_process, replace dprintf with more portable functions
dprint is missing on many non-glic platforms

* libguile/posix.c (piped_process): replace dprintf with sprintf+write
2025-03-22 21:33:33 -07:00
Michael Gran
9c86c5936e Allow piped-process and system* to exist when fork is undefined
piped-process only uses fork to match legacy behavior, but on systems
that never had fork, there is no need to match that behavior.
piped-process and system* can be provided without fork.

* libguile/posix.c (piped_process): allow function definition without HAVE_FORK,
    but stub out internal dummy process with HAVE_FORK
  (restore_sigaction, scm_dynwind_sigaction, scm_system_star): don't
    require HAVE_FORK
  (scm_init_popen): don't require HAVE_FORK
  (scm_init_posix): don't require HAVE_FORK to add posix feature or
    register popen extension
2025-03-22 21:32:45 -07:00
Michael Gran
87402c849e MinGW32: cast arguments to execvp
MinGW32's MSVCRT library requires strict casting for exec family functions

* libguile/posix.c (scm_execl, scm_execlp, scm_execle) [__MINGW32__]: cast
  arguments
2025-03-22 21:02:42 -07:00
Michael Gran
0f2125e66f Add missing #include in syscalls.h
SCM_SYSCALL uses scm_async_tick.

* libguile/syscalls.h: include async.h
2025-03-22 14:17:41 -07:00
Michael Gran
0e20c0c8c6 Add replacement for missing getpagesize() on MINGW
* libguile/posix-w32.c (getpagesize_w32): new procedure
* libguile/posix-w32.h: declaration of getpagesize_w32
* libguile/loader.c [__MINGW32__](scm_bootstrap_loader): use new procedure
* libguile/vm.c [__MINGW32__](scm_i_vm_prepare_stack): use new procedure
2025-03-22 14:17:30 -07:00
Michael Gran
0b9f58c339 Fix NEWS for load-foreign-library
NEWS update was in wrong location. This fixes news entry
from 7b41294049

* NEWS: update
2025-03-22 11:31:24 -07:00
Michael Gran
7b41294049 Improve DLL search strategy for load-foreign-library
The new non-libltdl foreign library loading algorithm from 3.0.6
fails to cover common cases regarding how libtool names and installs
DLL files.  Notably, it fails to recognize when libtool has added the
major version number into the filename itself, such as libfoo-1.dll
Also, it does not search in binary directories and the PATH for DLL
files, where libtool is likely to install DLLs.

This adds the option to search for dlls with major version numbers
in the filename, and modifies the search strategy for DLL-using
OSs to check bindir and PATH.

For MSYS, libraries are installed with the 'msys-' prefix. So this
modifies load-foreign-library to handle that prefix as well.
It changes the #:rename-on-cygwin? option to #:host-type-rename? to
better reflect that is works on both Cygwin and MSYS.

Partially based on a patch by Hannes Müller.

* NEWS: updated
* doc/ref/api-foreign.texi: document updates to load-foreign-library
  and system-dll-path
* module/system/foreign-library.scm (is-integer-string?): new utility function
  (dll-name-match?): new utility function
  (find-best-dll-from-matches): new utility function
  (dll-exists-with-version): new function that implements new dll search logic
  (file-exists-with-extension): add flag argument to allow new dll search
  (file-exists-in-path-with-extension): add flag argument to all new dll search
  (system-dll-path): new parameter
  (lib->msys): new helper function
  (load-foreign-library): add new optarg flag #:allow-dll-version-suffix?
    Pass new flag to library search functions.
    Implement new search strategy for #:search-system-paths? on DLL systems'
    replace #:rename-on-cygwin? with #:host-type-rename?
        Use that option to rename both MSYS and Cygwin libraries.
  (guile-system-extensions-path): prefer bindir to libdir on DLL systems
* test-suite/tests/foreign.test ("dll-name-match?"): new test category
  ("find-best-dll-from-matches"): new test category
  ("lib->msys"): new unit tests
2025-03-22 07:05:31 -07:00
Michael Gran
c9a19a03f8 Cygwin/MSYS: 00-socket.test: abstract sockets are unsupported
Binding to AF_UNIX abstract sockets is not supported on Cygwin and
presumably MSYS as well.

* test-suite/tests/00-socket.text ("AF_UNIX abstract"): throw unsupported
  on Cygwin and MSYS
2025-03-22 06:42:21 -07:00
Michael Gran
73a8ca88fb ports.test: catch pipe errors
Refactors a couple of the ports tests to catch errors in the test runner,
so that the test suite will print ERROR on failure.

* test-suite/tests/ports.test (pipe:write, pipe:read): modified
2025-03-22 06:27:51 -07:00
Michael Gran
b572f187af version.test: incorrect test logic
Since string-contains returns an integer on success, this test
was reporting unresolved instead of pass on success.

* test-suite/tests/version.test ("version reporting works"): fix
  boolean check logic
2025-03-22 05:57:27 -07:00
Ludovic Courtès
462d3c85ed
Provide ‘scm_i_is_finalizer_thread’ when building ‘--without-threads’.
Fixes a regression in ‘--without-threads’ builds introduced in
b8031fc965.

* libguile/finalizers.c (scm_i_is_finalizer_thread) [!SCM_USE_PTHREAD_THREADS]:
New function.
2025-03-21 18:10:07 +01:00
Arun Isaac
7dde220750 Replace "either" with "either array" in make-shared-array docs
* doc/ref/api-data.texi (Shared Arrays): Replace "either" with "either
array" in make-shared-array documentation.

Closes: 42228
2025-03-20 13:37:04 -05:00
Arun Isaac
117c398341 Fix typo in transform-string docstring
* module/texinfo/string-utils.scm (transform-string): Replace "te" with
"the" in docstring.

Fixes: 42228
2025-03-20 13:36:58 -05:00
Rob Browning
c6e0826667 libguile/Makefile.am: move date -d arg before format string
This fixes a problem on at least NetBSD.

* libguile/Makefile.am (libpath.h): move date -d argument before format
string.

Thanks to Thomas Klausner for reporting the problem and proposing the
fix.

Closes: 26121
2025-03-20 13:22:14 -05:00
Rob Browning
4527371d1b filesys.test: skip copy-file EACCES test when root
Accidentally omitted from b3b7477128.

* test-suite/tests/filesys.test: skip copy-file EACCES test when root.
2025-03-20 13:21:56 -05:00
Tomas Volf
4f39181b2f filesys.c: Use scm_sendfile to copy files
Use scm_sendfile instead of read-write loop.  This moves the work into
the kernel, improving performance.  This implements Ludovic's suggestion
from https://debbugs.gnu.org/68504

* libguile/filesys.c (scm_copy_file2): Use scm_sendfile.

[rlb@defaultvalue.org: add NEWS]
2025-03-19 21:25:40 -05:00
Rob Browning
b3b7477128 Add missing, read-only, and typical copy-file tests
* test-suite/guile-test: add call-with-temp-dir and exception-errno.
* test-suite/tests/filesys.test: add further copy-file tests.
2025-03-19 21:25:40 -05:00
Rob Browning
11b027d7e2 piped_process: silence spurious -Wmaybe-uninitialized warnings
libguile/posix.c: initialize pipes to silence spurious warnings.
2025-03-18 14:34:49 -05:00
Rob Browning
aeb89f6ad6 configure: add -Werror=array-bounds to CFLAGS when available
This would have prevented https://bugs.gnu.org/76907

* configure.ac: add -Werror=array-bounds to CFLAGS when available
2025-03-18 14:34:38 -05:00
Michael Gran
4af6331a65 Fixes potential buffer overflow in getsockopt for timevals
struct timeval is a possible return value of getsockopt (e.g. SO_RCVTIMEO
and SO_SNDTIMEO), but it is not included in the scm_t_getsockopt_result
union, which may then be too small (and is on Debian amd64).
* libguile/socket.c: add struct timeval to scm_t_getsockopt union

[rlb@defaultvalue.org: adjust commit message; add NEWS]

Closes: 76907
2025-03-18 12:24:31 -05:00
Zheng Junjie
402e0dfa33
build: Mark JIT as supported on riscv64.
This is a followup to 5d3f561d7d.

* acinclude.m4 (GUILE_ENABLE_JIT): Mark riscv64 as JIT available.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-03-06 17:28:18 +01:00
Rob Browning
5012581745 r6rs-ports.test: don't race with gc close in custom port tests
The tests share a "log" for custom port events and didn't always
explicitly close the test ports, so the close might come later, during
another test.  Change the tests to always close their ports immediately,
and clear the log after checking for expected "inter-test" events.

test-suite/tests/r6rs-ports.test: don't race with gc close in custom
port tests.
2025-03-02 14:44:53 -06:00
Rob Browning
d7475d4073 configure.ac: enable -ffat-lto-objects with -flto when available
Without -ffat-lto-objects libguile.a ends up with no symbols, visible
via "nm t libguile.a".
cf. https://lintian.debian.org/tags/no-code-sections.html

* configure.ac: enable -ffat-lto-objects with -flto when available.
2025-03-02 14:44:51 -06:00
Rob Browning
e1a6622b3b Note setlocale raises a system-error when locale doesn't exist
doc/ref/posix.texi: note setlocale raises a system-error when locale
doesn't exist

Thanks to Francesco P. Lovergine for suggesting the
addition (https://bugs.debian.org/1078681).
2025-03-02 14:33:30 -06:00
Dale P. Smith
29c27afe96 Allow trailing "." in urls
Fixes https://debbugs.gnu.org/53201

* module/web/uri.scm (valid-host?): Allow trailing "." in URLs
* test-suite/tests/web-uri.test: Add tests for trailing "."
2025-03-02 21:18:19 +01:00
Ludovic Courtès
5be5a10a8a
Update NEWS.
* NEWS: Update for c1353972ee.
2025-02-28 22:12:04 +01:00
Olivier Dion
7b7340b2d9
Warn about mutation of ‘environ’ when multi-threaded.
This is an amendment to 84bf840322.

The warning was only emitted for calling `environ', even if only reading
and no mutation occurred.

However, it is correct to read the environment in a multi-threaded
process.  It is however unsafe to mutate it.

The same logic also applies to `putenv'.

* libguile/posix.c
  (maybe_warn_about_environ_mutation): New private procedure ...
  (scm_environ): ... called here when mutating the environment ...
  (scm_putenv): ... and here.
* NEWS: Update.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-02-28 22:12:04 +01:00
Ludovic Courtès
b8031fc965
Exclude the finalizer thread from the ‘all-threads’ result.
Fixes <https://bugs.gnu.org/76343>.

Fixes a bug whereby “echo '(environ)' | guile” would wrongfully trigger
the multiple-thread warning.

* libguile/finalizers.c (finalizer_thread): New variable.
(finalization_thread_proc): Set it.
(scm_i_is_finalizer_thread): New function.
(run_finalization_thread): Clear FINALIZER_THREAD.
* libguile/finalizers.h (scm_i_is_finalizer_thread): New declaration.
* libguile/threads.c (scm_all_threads): Use it.
* NEWS: Update.

Reported-by: Simon Josefsson <simon@josefsson.org>
2025-02-28 22:12:03 +01:00
Maxim Cournoyer
75fd1d6434
Remove lib/malloc/.dirstamp and register to .gitignore.
* lib/malloc/.dirstamp: Delete file.
* .gitignore: Register.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-02-28 22:12:03 +01:00