For systems that do not have a posix shell.
* configure.ac (GUILE_TOOLS_EXE): new conditional
* libguile/Makefile.am (guile-tools)[GUILE_TOOLS_EXE]: new binary target
* libguile/guile-tools.c: new file
* meta/Makefile.am (guile.scm): new data
[!GUILE_TOOLS_EXE](install-exec-hook): don't alias guile-tools to guild
(CLEANFILES): add guild.exe
fr_FR was mostly being tested as an 8-bit locale. This changes
the tests to focus on fr_FR.utf8. But it adds a section for fr_FR 8-bit
currency. Divergence in vendor-supplied locales often occurs
in currency.
MINGW, which only handles 8-bit locales when using MSVCRT, was being tested
as if its 8-bit CP1252 locale was UTF-8. While the tests were included
as better than nothing, it is technically incorrect. These tests are
no longer run. Soon, Guile's MINGW build will link to UCRT, and it will
have UTF-8 locales.
The responses for some tests were modified to allow reasonable responses
from Cygwin/MSYS/MinGW locales and to skip on unreasonable responses.
* test-suite/tests/i18n.test (mingw?): rename to old-ms?
(old-ms?): new helper
(%french-locale-name): use platform's default 8-bit locale
(%french-utf8-locale-name, %turkish-utf8-locale-name, %german-utf8-locale-name)
(%greek-utf8-locale-name): don't use 8-bit locales on MINGW
("text collation (French)"): use utf-8
("locale-digit-grouping (French)"): use utf-8
(french-number-string=?): modify to make symmetric and to handle
U+2024 as a valid spacer
("French: integer", "negative integer" "fraction", "fraction, 1 digit"):
("French"): rename to "French UTF-8"
("French UTF-8: 12345.678", "Fraction"): use utf-8, allow U+2024
("French UTF-8: positive inexact zero"): expect euro sign
("French 8-bit"): new currency tests
Adds CRLF as a line ending. %read-line will return
these. In the case of CRLF, %read-line will return a string "\r\n"
as the line ending.
* libguile/rdelim.c (scm_read_line): handle CRLF line delimiter
* module/ice-9/suspendable-ports.scm (%read-line): modify to handle CRLF
line delimiter
(read-line): use modified %read-line
* test-suite/tests/rdelim.test ("two lines, split, CRLF"): new test
("two long lines, split, CRLF"): new test
* doc/ref/api-io.texi: update read-line documentation
On systems without SIGALRM, the other features of eval-in-sandbox
may still be useful. This adds the option to set #:time-limit to
#f to indicate no timeout.
* NEWS: updated
* module/ice-9/sandbox.scm (eval-in-sandbox): allow #:time-limit key
to be #f to disable time limit
* doc/ref/api-evaluation.texi (eval-in-sandbox): update documentation
* test-suite/tests/sandbox.scm ("eval-in-sandbox"): throw unsupported
if no SIGALARM
("eval-in-sandbox no timeout"): new tests for eval-in-sandbox
This variable will help indicate if, on Win32, the C library is
closer to C99 capable.
* libguile/posix.c (scm_init_posix): new define %UCRT
* test-suite/tests/i18n.test (old-ms?): use new define allow UTF-8
tests on MINGW
The line counter tests presumes newline-only line endings. Use binary
mode to avoid CRLF endings.
* test-suite/tests/ports.test ("line endings"): write test file in binary
mode
Guile has an enum scm_inline_gc_kind used to replace GC constants
that were private. Those defines were made public in 2015, so it
is should be safe to use them now.
Replace SCM_INLINE_GC_KIND_POINTERLESS with GC_I_PTRFREE.
Replace SCM_INLINE_GC_KIND_NORMAL with GC_I_NORMAL.
* libguile/gc-inline.h (scm_inline_gc_kind): remove type
(scm_inline_gc_alloc): kind argument is now int
(scm_inline_gc_malloc_pointerless): use GC_I_PTRFREE
(scm_inline_gc_malloc): use GC_I_NORMAL
* libguile/intrinsics.c (allocate_words_with_freelist): use GC_I_NORMAL
(allocate_pointerless_words): use GC_I_PTRFREE
For 64-bit Windows, there was an existing special setjmp handling
to avoid jumping into Guile frames. Expand this handling to 32-bit
Windows as well.
*
* 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
FFS is missing on MINGW.
* libguile/lightening/lightening/x86-cpu.c
[__GNUC__ && _WIN32](USE_BUILTIN_FFS): new macro
(__ffs): wrapper function
(ffsw): use __ffs;
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
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.
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
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
* 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.
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.
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.
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.
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>
* 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.
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
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
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
* 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
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
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
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