In MinGW, sigset_t is not availab.e
* libguile/gen-scmconfig.c (SCM_HAVE_PTHREAD_SIGMASK): new conditional
* libguile/null-threads.h (scm_i_pthread_sigmask): now conditional on
SCM_HAVE_PTHREAD_SIGMASK
When system* was called to execute a script/excutable without args, if
that did not exist, it would launch an interactive session. Now it fails
with an error.
* libguile/posix-w32.c (start_child): return when cmd not found
* test-suite/tests/posix.test (system*): system* test should handle errors
Adds CRLF, NEL, PS and LS as line endings. %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 more line delimiters
* test-suite/tests/rdelim.test ("two lines, split, CRLF"): new test
("two long lines, split, CRLF", "two lines, split, NEL"): new tests
("two lines, split, LS", "two lines, split, PS"): new tests
Previously 'load-thunk-from-memory' would often throw to 'system-error'
when passed an incorrect ELF file, leading to incorrect error messages.
* libguile/loader.c (load_thunk_from_memory): Reset 'errno' when
'check_elf_header' returns non-NULL.
* test-suite/tests/vm.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add it.
* libguile/posix.c (scm_crypt): Take 'scm_i_misc_mutex' right before
calling 'crypt'. Move 'SCM_SYSERROR' call after 'scm_dynwind_end'.
* test-suite/tests/posix.test ("crypt"): New test prefix.
Fixes <https://bugs.gnu.org/29151> and <https://bugs.gentoo.org/613986>.
Backtrace looks like that:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x200000000014a5c0 in scm_ia64_longjmp (JB=0x6000000000817020, VAL=1) at continuations.c:372
372 t->pending_rbs_continuation->backing_store,
[Current thread is 1 (Thread 0x2000000000049340 (LWP 8190))]
(gdb) bt
#0 0x200000000014a5c0 in scm_ia64_longjmp (JB=0x6000000000817020, VAL=1) at continuations.c:372
#1 0x2000000000148e00 in scm_c_abort (vm=0x60000000000edea0, tag=0x6000000000795ba0, n=0, argv=0x60000fffff7f0ce0, cookie=-1) at control.c:239
#2 0x2000000000149070 in scm_at_abort (tag=0x6000000000795ba0, args=0x304) at control.c:258
(gdb) print t
$2 = (scm_i_thread *) 0x6000000000068000
(gdb) print t->pending_rbs_continuation
$3 = (scm_t_contregs *) 0xffeb
The problem here is the value of 't->pending_rbs_continuation' pointer.
It's supposed to poin to a register stack pointer or be NULL if not yet
backed up.
The problem is it is never initialized to NULL at creation time and
contained garbage on stack. Sometimes people are lucky and have zeros
on stack and guile works. But sometimes there is something and guile
crashes.
The fix is trivial: initialize 'pending_rbs_continuation = NULL'
at thread registration time (the same way other threads are registered).
Reported-by: Matt Turner
* libguile/threads.c (guilify_self_1): Initialize pending_rbs_continuation
to avoid crash on ia64.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Fixes <https://bugs.gnu.org/29226>.
* libguile/load.c (scm_primitive_load_path): Set 'compiled_thunk' to
SCM_BOOL_F when *scm_loc_fresh_auto_compile is true.
* module/ice-9/boot-9.scm (load-in-vicinity)[load-absolute]: Call
'pre-compiled' only when %FRESH-AUTO-COMPILE is false.
If 'readdir' returned an error, we'd call SCM_SYSERROR, which would try
to acquire 'scm_i_misc_mutex' and sit there forever because it was
already taken.
Reported at <https://bugs.gnu.org/29335>.
* libguile/filesys.c (scm_opendir): Allocate storage for a mutex and
store it as the third word of the SMOB.
(scm_readdir): Use that mutex instead of 'scm_i_misc_mutex'. Fixes the
deadlock upon error.
(scm_rewindir): Lock the mutex around the 'rewinddir' call.
* libguile/Makefile.am (INSTANTIATE): New variable.
(install-data-hook): Use it.
* libguile/libguile-2.2-gdb.scm: Autoload (system vm debug).
Augment %load-path and %load-compiled-path, and reload (system base
types).
* module/system/base/types.scm: Remove #:hide to be 2.0-compatible.
Use (system syntax internal) conditionally when on 2.2.
* libguile/weak-table.c (scm_t_weak_table); Add last_gc_no member.
* libguile/weak-table.c (vacuum_weak_table): Only vacuum if we haven't
done so since the last GC.
(scm_c_weak_table_ref, scm_c_weak_table_put_x, scm_c_weak_table_remove_x)
(scm_c_weak_table_fold): Vacuum the weak table if needed.
(scm_weak_table_clear_x): Update last_gc_no flag, as no more vacuuming
will be needed.
This change should make weak tables work better with libgc, as the weak
components that need mark functions are smaller, so they don't overflow
the mark queue. Also this prevents the need to move disappearing
links.
* libguile/weak-table.c (scm_t_weak_entry): Change to be a hash table
chain entry.
(struct weak_entry_data, do_read_weak_entry, read_weak_entry): Read
out the key and value directly.
(GC_move_disappearing_link, move_disappearing_links, move_weak_entry):
Remove.
(scm_t_weak_table): Rename "entries" member to "buckets", and "size" to
"n_buckets".
(hash_to_index, entry_distance, rob_from_rich, give_to_poor): Remove.
(mark_weak_key_entry, mark_weak_value_entry): Mark a single link, and
the next link.
(mark_doubly_weak_entry): New kind.
(allocate_entry): Allocate a single entry.
(add_entry): New helper.
(resize_table): Reimplement more like normal hash tables.
(vacuum_weak_table): Adapt to new implementation.
(weak_table_ref, weak_table_put_x, weak_table_remove_x): Adapt.
(make_weak_table): Adapt.
(scm_weak_table_clear_x): Actually unregister the links to prevent a
memory leak.
(scm_c_weak_table_fold): Collect items in an alist, then fold outside
the lock.
(scm_weak_table_prehistory): Initialize doubly_weak_gc_kind.
* module/ice-9/arrays.scm (array-print-prefix): New private function.
* libguile/arrays.c (scm_i_print_array): Reuse (array-print-prefix) from
(ice-9 arrays). Make sure to release the array handle.
* module/ice-9/pretty-print.scm (truncated-print): Support
bitvectors.
Don't try to guess the array prefix but call array-print-prefix from
(ice-9 arrays) instead.
Fix call to print-sequence to support non-zero lower bound arrays.
* test-suite/tests/arrays.test: Test that arrays print properly.
* test-suite/tests/print.test: Test truncated-print with bitvectors,
non-zero lower bound arrays.
* module/ice-9/arrays.scm (array-copy): New function, export.
* module/Makefile.am: Install (ice-9 arrays).
* doc/ref/api-data.texi: Add documentation for (ice-9 arrays).
* libguile/quicksort.i.c: Use signed bounds throughout.
* libguile/sort.c (scm_restricted_vector_sort_x): Fix error calls. Fix
calls to quicksort.
* test-suite/tests/sort.test: Actually test that the sorted results
match the original data. Test cases for non-zero base index arrays for
sort, sort!, and stable-sort!.
* libguile/array-handle.c (initialize_vector_handle): Set both element
pointers to NULL if the vector is empty.
* libguile/array-map.c (racp): Ignore immutability if destination is
empty.
* test-suite/tests/sort.test: Check empty/mutable/immutable vectors with
sort!.
* test-suite/tests/array-map.test: Check array-copy! with
empty/immutable destination.
Reported at <https://bugs.gnu.org/28784>.
Discussed at
<https://lists.gnu.org/archive/html/guile-devel/2017-10/msg00003.html>.
* libguile/fports.c (revealed_ports, revealed_lock): Remove.
(scm_revealed_count): Just return 'SCM_REVEALED (port)'.
(scm_set_port_revealed_x, scm_adjust_port_revealed_x): Remove
REVEALED_PORTS manipulation.
(fport_close): Do nothing when SCM_REVEALED (port) > 0.
* libguile/fports.h (scm_t_fport): Adjust comment; make 'revealed'
unsigned.
* libguile/ports.c (do_close): Call 'close_port' instead of
'scm_close_port'.
(scm_close_port): Rename to...
(close_port): ... this. Add 'explicit' parameter. Clear 'revealed'
field when PORT is a file port and EXPLICIT is true.
(scm_close_port): Call 'close_port'.
* test-suite/tests/ports.test ("close-port & revealed port")
("revealed port fdes not closed"): New tests.
* libguile/print.h (SCM_PRINT_STATE_LAYOUT): Use a normal slot instead
of a self slot.
* libguile/print.c (make_print_state): Initialize "handle" slot
manually.
* libguile/struct.c (issue_deprecation_warning_for_self_slots): New
helper, called when making vtables to issue deprecation warnings for
"self" slots. Avoids warning for the "self" slot that's part of the
fixed vtable slots.
(scm_i_struct_inherit_vtable_magic): Call
issue_deprecation_warning_for_self_slots.
* doc/ref/api-data.texi (Vtables, Structure Basics): Remove references
to self slots.
* NEWS: Add entry.
* libguile/struct.c: Replace uses of scm_make_struct with
scm_make_struct_no_tail or scm_c_make_struct.
(scm_make_struct_no_tail): Move this function to C instead of Scheme
to be able to deprecate scm_make_struct.
* libguile/struct.h (scm_make_struct_no_tail): New public declaration.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_make_struct): Deprecate.
* libguile/print.c:
* libguile/procs.c:
* libguile/stacks.c: Replace uses of scm_make_struct with
scm_make_struct_no_tail.
* test-suite/tests/coverage.test:
* test-suite/tests/structs.test: Use make-struct/no-tail instead of
make-struct.
* NEWS: Add entry.
* libguile/r6rs-ports.c (scm_put_bytevector, scm_unget_bytevector): When
three arguments (port bv start) are provided, allow start to be equal to
the length of the bytevector, resulting in a zero-length write.
* libguile/filesys.c (scm_i_relativize_path): When DIR is a prefix of
SCANON, make sure DIR ends with a separator or SCANON starts with a
separator.
* test-suite/tests/ports.test (%temporary-directory): New variable.
("%file-port-name-canonicalization")["relative canonicalization with
common prefixes"]: New test.
* libguile/eq.c (scm_equal_p, scm_raw_ihash): Add cases for syntax
objects, which should be comparable with equal?.
* test-suite/tests/syntax.test ("syntax objects"): Add tests.
* configure.ac: Check for GC_is_heap_ptr, added after libgc 7.2.
* libguile/pairs.h (GC_is_heap_ptr): Define a shim for GC_is_heap_ptr,
inside BUILDING_LIBGUILE so as not to expose it to users.
* libguile/guile-func-name-check (/^SCM_DEFINE /): Fix pattern to not
produce spurious warnings. Thanks to Dale Smith for the suggestion.
Fixes https://bugs.gnu.org/26123.
* libguile/_scm.h (SCM_OBJCODE_MINIMUM_MINOR_VERSION): New definition,
indicating the oldest objcode version that we support.
(SCM_OBJCODE_MINOR_VERSION): Bump.
* libguile/loader.c (process_dynamic_segment): Support a range of
versions.
* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump.