1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
Commit graph

1016 commits

Author SHA1 Message Date
Morgan Smith
c7d170c5d1
Fix typos throughout codebase.
* NEWS:
* README:
* doc/r5rs/r5rs.texi:
* doc/ref/api-data.texi:
* doc/ref/api-debug.texi:
* doc/ref/api-evaluation.texi:
* doc/ref/api-io.texi:
* doc/ref/api-macros.texi:
* doc/ref/api-procedures.texi:
* doc/ref/api-scheduling.texi:
* doc/ref/api-undocumented.texi:
* doc/ref/libguile-concepts.texi:
* doc/ref/posix.texi:
* doc/ref/srfi-modules.texi:
* doc/ref/vm.texi:
* doc/ref/web.texi:
* examples/box-dynamic-module/box.c:
* examples/box-dynamic/box.c:
* examples/box-module/box.c:
* examples/box/box.c:
* examples/safe/safe:
* examples/scripts/README:
* examples/scripts/hello:
* gc-benchmarks/larceny/twobit-input-long.sch:
* gc-benchmarks/larceny/twobit-smaller.sch:
* gc-benchmarks/larceny/twobit.sch:
* libguile/expand.c:
* libguile/load.c:
* libguile/net_db.c:
* libguile/scmsigs.c:
* libguile/srfi-14.c:
* libguile/threads.c:
* meta/guile.m4:
* module/ice-9/match.upstream.scm:
* module/ice-9/ports.scm:
* module/language/cps/graphs.scm:
* module/scripts/doc-snarf.scm:
* module/srfi/srfi-19.scm:
* module/system/repl/command.scm:
* test-suite/tests/srfi-18.test:
Fix typos.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-07-16 22:09:01 +02:00
Ludovic Courtès
85520354a8
Fix possible deadlock in 'scm_sigaction_for_thread'.
Fixes <https://bugs.gnu.org/64666>.

* libguile/scmsigs.c (scm_sigaction_for_thread): Swap the
'scm_dynwind_block_asyncs' and 'scm_i_dynwind_pthread_mutex_lock'
calls.
* NEWS: Update.
2023-07-16 21:35:47 +02:00
Josselin Poiret
36fd2b4920
Use /dev/null in 'piped-process' if port is not backed by a fdes.
In Guile 3.0.9, 'system*' would no longer open /dev/null for file
descriptors 0, 1, and 2 when its 'current-input-port',
'current-output-port', or 'current-output-port' is not bound to a file
port.  This patch reinstates that behavior.

Fixes <https://bugs.gnu.org/63024>.

* libguile/posix.c (piped_process): Open /dev/null to use as in/out/err
if the corresponding port is not backed by a file descriptor.
* test-suite/tests/posix.test ("system*")["https://bugs.gnu.org/63024"]:
New test.
* NEWS: Update.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2023-05-08 16:06:28 +02:00
Ludovic Courtès
e93525e549
Adjust 'spawn' tests to accept 'LD_ORIGIN_PATH' on GNU/Hurd.
Fixes <https://bugs.gnu.org/62501>.

* test-suite/tests/posix.test ("spawn")["env with #:environment
and #:output"]: Add workaround for GNU/Hurd.
* NEWS: Update.
2023-04-02 15:39:57 +02:00
Ludovic Courtès
21ad54b694
'spawn' closes only open file descriptors on non-GNU/Linux systems.
Fixes <https://bugs.gnu.org/61095>.
Reported by Omar Polo <op@omarpolo.com>.

* libguile/posix.c (close_inherited_fds_slow): On systems other than
GNU/Linux, call 'addclose' only when 'fcntl' succeeds on MAX_FD.
* NEWS: Update.
2023-04-02 15:36:25 +02:00
Ludovic Courtès
e334e59589
Update NEWS. 2023-03-20 23:25:01 +01:00
Christopher Baines
cba2e7e3fe
Fix some invalid unicode handling issues with suspendable ports.
Fixes <https://bugs.gnu.org/62290>.

Based on the implementation in ports.c.  I don't understand what this
code is really doing, but the suspendable ports implementation differs
from the similar C code for a couple of inequalities.

* module/ice-9/suspendable-ports.scm (decode-utf8, bad-utf8-len): Flip a
couple of inequalities.
* test-suite/tests/ports.test ("string ports"): Add additional invalid
UTF-8 test case.
* NEWS: Update.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-03-20 23:23:29 +01:00
Rob Browning
ffb95239aa scm_i_utf8_string_hash: compute u8 chars not bytes
Noticed while investigating a migration to utf-8 strings.  After making
changes that routed non-ascii symbol hashing through this function,
encoding-iso88597.test began intermittently failing because it would
traverse trailing garbage when u8_strnlen reported 8 chars instead of 4.

Change the scm_i_str2symbol and scm_i_str2uninterned_symbol internal
hash type to unsigned long to explicitly match the scm_i_string_hash
result type.

* libguile/hash.c (scm_i_utf8_string_hash): Call u8_mbsnlen not u8_strnlen.
* libguile/symbols.c (scm_i_str2symbol, scm_i_str2uninterned_symbol):
Use unsigned long for scm_i_string_hash result.
* test-suite/standalone/.gitignore: Add test-hashing.
* test-suite/standalone/Makefile.am: Add test-hashing.
* test-suite/standalone/test-hashing.c: Add.
2023-03-18 13:24:43 -05:00
Ludovic Courtès
89c3bae3cf
Add -Wunused-module.
* module/language/tree-il/analyze.scm (<module-info>): New record type.
(unused-module-analysis): New variable.
(make-unused-module-analysis): New analysis.
(make-analyzer): Add it.
* module/system/base/message.scm (%warning-types): Add 'unused-module'.
* test-suite/tests/tree-il.test (%opts-w-unused-module): New variable.
("warnings")["unused-module"]: New test prefix.
* NEWS: Update.
2023-02-24 16:49:00 +01:00
Ludovic Courtès
181f7ee4a7 Update NEWS. 2023-01-23 11:56:12 +01:00
Ludovic Courtès
9a004606e0 Update NEWS.
* NEWS: Update.
2023-01-17 17:49:05 +01:00
Ludovic Courtès
e441c34f16 Add 'bytevector-slice'.
* module/rnrs/bytevectors/gnu.scm: New file.
* am/bootstrap.am (SOURCES): Add it.
* libguile/bytevectors.c (scm_bytevector_slice): New function.
* libguile/bytevectors.h (scm_bytevector_slice): New declaration.
* test-suite/tests/bytevectors.test ("bytevector-slice"): New tests.
* doc/ref/api-data.texi (Bytevector Slices): New node.
2023-01-14 16:14:17 +01:00
Andrew Whatson
9332b63240 Reduce redundant 'close' calls when forking on some systems.
Fixes <https://bugs.gnu.org/59321>.
Reported by <hylophile@posteo.de>.

Some systems provide "/proc/self/fd" which is a directory containing an
entry for each open file descriptor in the current process.  We use this
to limit the number of close() calls needed to ensure file descriptors
aren't leaked to the child process when forking.

* libguile/posix.c (close_inherited_fds_slow):
(close_inherited_fds): New static helper functions.
(scm_spawn_process): Attempt to close inherited file descriptors
efficiently using 'close_inherited_fds', falling back to the brute-force
approach in 'close_inherited_fds_slow'.
* NEWS: Update.
2023-01-13 16:07:42 +01:00
Josselin Poiret
527c257d6e Make 'system*' and 'piped-process' internally use 'spawn'.
Fixes <https://bugs.gnu.org/52835>.

* libguile/posix.c (scm_system_star, scm_piped_process): Use do_spawn.
(start_child): Remove function.
* test-suite/tests/posix.test ("system*")["https://bugs.gnu.org/52835"]:
New test.
* NEWS: Update.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-13 16:05:56 +01:00
Josselin Poiret
551929e4fb Add 'spawn'.
* libguile/posix.c: Include spawn.h from Gnulib.
(do_spawn, scm_spawn_process): New functions.
(kw_environment, hw_input, kw_output, kw_error, kw_search_path): New
variables.
* doc/ref/posix.texi (Processes): Document it.
* test-suite/tests/posix.test ("spawn"): New test prefix.
* NEWS: Update.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-13 16:05:30 +01:00
Ludovic Courtès
11dea3c363 disassembler: Show intrinsic name for 'call-' instructions.
* module/system/vm/disassembler.scm (code-annotation)[intrinsic-name]:
New procedure.
Add clauses for intrinsics.
* NEWS: Update.
2022-11-01 22:02:19 +01:00
Maxime Devos
793fb46a1e Update NEWS.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:43:36 +02:00
Ludovic Courtès
e2797f529b Baseline compiler no longer crashes on (not (list 1 2)).
Fixes <https://bugs.gnu.org/58217>.

* module/language/tree-il/compile-bytecode.scm (canonicalize)
[finish-conditional](predicate?): Do not assume 'lookup-primitive'
returns true.
* test-suite/tests/compiler.test ("regression tests")
["(not (list 1 2))"]: New test.
2022-10-01 16:00:05 +02:00
Ludovic Courtès
1d313bf5f0 'pipe' now takes an optional 'flags' parameter.
This is the same strategy as used for the 'accept4' bindings introduced
in 6e0965104c.

* libguile/posix.c (scm_pipe): Rename to...
(scm_pipe2): ... this.  Add an optional 'flags' parameter and honor it.
(scm_pipe): Rewrite as a call to 'scm_pipe2'.
* libguile/posix.h (scm_pipe2): New declaration.
* test-suite/tests/posix.test ("pipe"): New tests.
* configure.ac: Look for 'pipe2'.
* NEWS: Update.
2022-09-19 22:30:16 +02:00
Ludovic Courtès
0aa1a9976f 'primitive-load' opens files with O_CLOEXEC.
Fixes <https://bugs.gnu.org/57567>.

* libguile/load.c (scm_primitive_load): Add "e" flag to
'scm_open_file_with_encoding' argument.
* NEWS: Update.
2022-09-07 18:00:30 +02:00
Ludovic Courtès
a356ceebee Add support for "e" flag (O_CLOEXEC) to 'open-file'.
* libguile/fports.c (scm_i_mode_to_open_flags): Add 'e' case.
(scm_open_file_with_encoding): Document it.
* test-suite/standalone/test-close-on-exec: New file.
* test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.
* doc/ref/api-io.texi (File Ports): Document it.
* NEWS: Update.
2022-09-07 18:00:30 +02:00
Ludovic Courtès
01e960edea Update NEWS.
* NEWS: Update.
2022-08-04 16:01:55 +02:00
Ludovic Courtès
8c976c6a1f Update NEWS.
* NEWS: Update.
2022-07-04 11:52:14 +02:00
Ludovic Courtès
7e048c6c51 Update NEWS.
* NEWS: Update.
2022-06-16 10:06:32 +02:00
Ludovic Courtès
4468427334 Update NEWS.
* NEWS: Mention srfi-14.i.c built from source.
2022-03-24 14:34:18 +01:00
Sergei Trofimovich
f047133e7b build: Test '-flto' on both compiler and linker.
Before the change ./configure incorrectly enabled -flto on toolchains
that support -flto on compiler side but don't support -flto on linker
side. This caused incorrect type size detection on nixpkgs' Darwin:

 configure:54594: checking size of size_t
 configure:54600: clang -std=gnu11 -o conftest -g -O2 -flto   conftest.c  >&5
 ld: warning: ignoring file /private/tmp/nix-build-guile-3.0.8.drv-0/conftest-00e93d.o,
   building for macOS-x86_64 but attempting to link with file built
   for unknown-unsupported file format ( 0xDE 0xC0 0x17 0x0B 0x00 0x00 0x00 0x00 0x14 0x00 0x00 0x00 0x80 0x1A 0x00 0x00 )
 Undefined symbols for architecture x86_64:
   "_main", referenced from:
      implicit entry/start for main executable
 ld: symbol(s) not found for architecture x86_64
 clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

Taken from https://github.com/NixOS/nixpkgs/pull/160051#issuecomment-1046105041

The change makes sure -flto support tests basic support of just for
object file generation but for linker as well.

* configure.ac: use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-07 10:54:16 +01:00
Ludovic Courtès
347321ece9 psyntax: Honor source properties for things other than syntax objects.
Commit 54bbe0b284 inadvertently led
psyntax to dismiss source location info for data returned by read hash
extensions, because read hash extensions return plain data with
associated source properties, even when called from 'read-syntax'.

This change reverts part of this commit to restore that behavior.

Fixes <https://issues.guix.gnu.org/54003>.

* module/ice-9/psyntax.scm (datum-sourcev): New procedure.
(source-annotation): Fall back to 'datum-sourcev'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* test-suite/tests/compiler.test ("psyntax")["syntax-source with
read-hash-extend"]: New test.
2022-03-07 10:52:16 +01:00
Ludovic Courtès
a1a1400c7c Update NEWS.
* NEWS: Add 3.0.9 section.
2022-03-07 10:52:16 +01:00
Andy Wingo
3d69993295 Minor NEWS tweaks
* NEWS: Minor tweaks.
2022-02-10 20:54:16 +01:00
Andy Wingo
7e3470343a NEWS fixup
* NEWS: Remove duplicate word.
2022-02-06 20:18:19 +01:00
Ludovic Courtès
8e2e2ceb17 Deprecate symbol properties.
* libguile/strings.c (scm_i_make_symbol): Remove 'props' argument.  Use
3 words instead of 'scm_double_cell'.
* libguile/strings.h: Adjust accordingly.
* libguile/symbols.c (scm_i_str2symbol, scm_i_str2uninterned_symbol):
Likewise.
(scm_symbol_fref, scm_symbol_pref, scm_symbol_fset_x,
scm_symbol_pset_x): Move to...
* libguile/deprecated.c: ... here.  Rewrite in terms of object
properties.
(symbol_function_slot, symbol_property_slot): New variables.
* libguile/symbols.h (SCM_SYMBOL_FUNC, SCM_SET_SYMBOL_FUNC)
(SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS)
(scm_symbol_fref, scm_symbol_pref, scm_symbol_fset_x)
(scm_symbol_pset_x): Move to...
* libguile/deprecated.h: ... here.  Mark declarations as 'SCM_DEPRECATED'.
* module/system/base/types.scm (cell->object): Remove 'props' field for
%TC7-SYMBOL.
* doc/ref/api-data.texi (Symbol Props): Remove.
* NEWS: Update.
2022-02-04 11:12:28 +01:00
Andy Wingo
4e92f1d7cc Update NEWS
* NEWS: Update.
2022-02-02 20:53:46 +01:00
Daniel Llorens
d70c1dbebf New function bitvector-copy (scm_bitvector_copy)
* libguile/bitvectors.h:
* libguile/bitvectors.c: As stated.
* test-suite/tests/bitvectors.test: Tests.
* doc/ref/api-data.texi: Update "Bit vectors" section.
* NEWS: Update.
2022-01-04 12:28:41 +01:00
Daniel Llorens
5759e37181 New function srfi-4-vector-type-size in (srfi srfi-4 gnu)
This patch removes the undocumented function make-srfi-4-vector from
(guile). That function is still exported from (srfi srfi-4 gnu).

* libguile/srfi-4.h (scm_init_srfi_4): Split into scm_bootstrap_srfi_4()
  and scm_init_srfi_4(), after the pattern of scm_init_bytevectors() and
  scm_bootstrap_bytevectors().
* libguile/init.c: Replace scm_init_srfi_4() call by scm_bootstrap_srfi_4().
* module/srfi/srfi-4.scm: Load newly defined srfi-4 extension. This
  provides undocumented make-srfi-4-vector.
* module/srfi/srfi-4/gnu.scm: Export srfi-4-vector-type-size.
* doc/ref/srfi-modules.texi: Document srfi-4-vector-type-size.
2021-12-06 14:00:03 +01:00
Daniel Llorens
496f69dba2 Support C99 complex types in (system foreign)
* libguile/foreign.h (SCM_FOREIGN_TYPE_COMPLEX_FLOAT,
  SCM_FOREIGN_TYPE_COMPLEX_DOUBLE): New enums.
* module/system/foreign.scm (complex-float, complex-double): Export new types.
  (make-c-struct, parse-c-struct): Support the new types.
* libguile/foreign.c (complex-float, complex-double): Define new types.
  (alignof, sizeof, pack, unpack): Support the new types.
* test-suite/tests/foreign.test: Test.
2021-11-15 11:34:09 +01:00
Daniel Llorens
708df04f3b Update NEWS 2021-10-27 10:09:59 +02:00
Ludovic Courtès
b1bbafa500 Update NEWS. 2021-10-22 13:52:40 +02:00
Andy Wingo
f7fdc3edc9 Update NEWS
* NEWS: Update.
2021-05-10 10:26:12 +02:00
Andy Wingo
0991bd6af3 Update NEWS
* NEWS: Update
2021-05-10 10:24:44 +02:00
Ludovic Courtès
93a242c0ec Update NEWS.
* NEWS: Update.
2021-05-08 22:48:25 +02:00
Ludovic Courtès
bef971105d Update NEWS.
* NEWS: Mention O_* constants.
2021-05-08 12:04:22 +02:00
Ludovic Courtès
a242d2d2b2 NEWS: Fix typos.
* NEWS: Fix typos in Guile 3.0.0 bit about #:verify-certificate?.
2021-05-07 17:14:14 +02:00
Andy Wingo
102f0da664 Update NEWS
* NEWS: Update.
2021-04-27 21:39:55 +02:00
Andy Wingo
75babf8df9 Add GUILE_INSTALL_GMP_MEMORY_FUNCTIONS to NEWS; use at build-time
* NEWS (GUILE_INSTALL_GMP_MEMORY_FUNCTIONS): Update
* libguile/numbers.c: Add needed include.
* meta/build-env.in (GUILE_INSTALL_GMP_MEMORY_FUNCTIONS): Set when
building Guile.
2021-04-27 21:23:08 +02:00
Mikael Djurfeldt
01bfd18f3d Fix handling of parameter lists to elisp defun to allow nil.
Thanks to Vasilij Schneidermann.
2021-04-01 20:56:22 +02:00
Andy Wingo
ef7952984c Update NEWS
* NEWS: Updates.
2021-03-18 22:05:58 +01:00
Andy Wingo
e30ee90478 Revert "Handle CRLF and Unicode line endings in read-line"
This reverts commit 0f983e3db0.

After discussing with Mike we are going to punt the read-line changes
for now.  Open the port in O_TEXT mode if you want to chomp the CR in
CFLF sequences.
2021-03-12 22:08:16 +01:00
Michael Gran
1c472fef54 Add read-line and ftw changes to NEWS
* NEWS: updated
2021-03-11 20:03:10 -08:00
Andy Wingo
85433fc2b1 Add mkstemp; undocument mkstemp!
* doc/ref/posix.texi (File System): Update to document mkstemp only.
* libguile/filesys.c: Make a mkstemp that doesn't modify the input
template.  Instead the caller has to get the file name from
port-filename.
(scm_mkstemp): Use the new mkstemp to implement mkstemp!.  Can't
deprecate yet though as the replacement hasn't been there for long
enough.
* libguile/posix.c (scm_tempnam): Update to mention mkstemp instead.
* module/system/base/compile.scm (call-with-output-file/atomic): Use
mkstemp.
* test-suite/tests/posix.test:
* test-suite/tests/r6rs-files.test: Use mkstemp.
* NEWS: Update.
2021-03-10 20:40:10 +01:00
Linus
0bd7497b61 Write a proper vector-map and vector-for-each for (rnrs base)
* module/rnrs/base.scm (vector-map vector-for-each): Rewrite to not be
slow.
* NEWS: Update.
2021-03-09 21:10:04 +01:00