summaryrefslogtreecommitdiff
path: root/test-suite
Commit message (Collapse)AuthorAgeFilesLines
* Use /dev/null in 'piped-process' if port is not backed by a fdes.HEADmainJosselin Poiret2023-05-081-1/+11
| | | | | | | | | | | | | | | | | 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>
* call-with-values builtin doesn't leave garbage on the stackAndy Wingo2023-05-072-5/+43
| | | | | | | | | | | | | | | Fixes https://debbugs.gnu.org/63279. The issue was that if the producer thunk caused a backtrace, pretty-printing the call-with-values frame would segfault because there was an unininitialized slot on the stack. For functions produced by the compiler this wouldn't be a problem because there are stack maps, but primitives require that all slots on a pending stack frame be packed (no uninitialized values) and tagged (all SCM values, no unboxed values). * test-suite/tests/error-handling.test: New test. * test-suite/Makefile.am: Add new file. * libguile/vm.c (define_vm_builtins): Fix call-with-values to have a more compact stack.
* Adjust 'spawn' tests to accept 'LD_ORIGIN_PATH' on GNU/Hurd.Ludovic Courtès2023-04-021-1/+7
| | | | | | | | Fixes <https://bugs.gnu.org/62501>. * test-suite/tests/posix.test ("spawn")["env with #:environment and #:output"]: Add workaround for GNU/Hurd. * NEWS: Update.
* Fix some invalid unicode handling issues with suspendable ports.Christopher Baines2023-03-201-0/+7
| | | | | | | | | | | | | | | | 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>
* scm_i_utf8_string_hash: compute u8 chars not bytesRob Browning2023-03-183-0/+71
| | | | | | | | | | | | | | | | | | 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.
* peval reduces some inlined case-lambda callsDaniel Llorens2023-02-271-0/+72
| | | | | | | * module/language/tree-il/peval.scm (peval): Reduce multiple case lambda in <call> trees according to the number of arguments. Do not try to reduce case-lambda using keyword arguments. * test-suite/tests/peval.test: Tests.
* Add -Wunused-module.Ludovic Courtès2023-02-241-1/+156
| | | | | | | | | | | * 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.
* 'spawn' ensures it is passed open file ports.Ludovic Courtès2023-01-261-0/+5
| | | | | | | | | Fixes <https://bugs.gnu.org/61073>. * libguile/posix.c (FDES_FROM_PORT_OR_INTEGER): When OBJ is not an integer, use 'SCM_VALIDATE_OPFPORT' before using 'SCM_FPORT_FDES'. * test-suite/tests/posix.test ("spawn")["non-file port argument"]: New test.
* linker: Do not store entire ELF in memory when writing to a file.Ludovic Courtès2023-01-171-0/+1
| | | | | | | | | | | | | | | | | | | | | This reduces the amount of memory that needs to be allocated while writing the ELF file to disk. Note: We're abusing #:page-aligned? in 'link-elf' to choose whether to return a bytevector or a procedure. * module/system/vm/linker.scm (process-reloc): Subtract SECTION-OFFSET when writing to BV. (write-linker-object): Pass BV directly to the linker object writer. (link-elf): When PAGE-ALIGNED? is false, call 'bytevector-slice' from here. When it is true, return a procedure that takes a port and writes to it, without having to allocate a bytevector for the whole ELF container. * module/language/bytecode/spec.scm (bytecode->value): Handle X being a procedure instead of a bytevector. (bytecode) <#:printer>: Likewise. * test-suite/tests/linker.test (link-elf-with-one-main-section): Pass #:page-aligned? #f.
* linker: Linker object writer takes a single argument.Ludovic Courtès2023-01-171-2/+2
| | | | | | | | | | | | | | * module/system/vm/linker.scm (write-linker-object): Pass the 'linker-object-writer' a single argument. (string-table-writer, add-elf-objects): Adjust writers accordingly. (string-table-writer): (add-elf-objects): * module/system/vm/assembler.scm (link-data, link-text-object) (link-frame-maps, link-dynamic-section) (link-symtab, link-arities, link-docstrs) (link-procprops, link-debug): Likewise. * test-suite/tests/linker.test (link-elf-with-one-main-section): Likewise.
* linker, assembler: Avoid intermediate bytevectors.Ludovic Courtès2023-01-171-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reduces the amount of memory used during linking and reduces the number of copies to be done between bytevectors. * module/system/vm/linker.scm (<linker-object>): Remove 'bv' field and add 'size' and 'writer'. (make-linker-object): Adjust accordingly. (string-table-size): New procedure. (link-string-table!): Remove. (string-table-writer): New procedure. (allocate-segment): Adjust 'make-linker-object' call. (find-shstrndx): Call the 'linker-object-writer' of O. (add-elf-objects): Adjust 'make-linker-object' call. Remove 'make-bytevector' allocations and move serialization to lazy 'writer' procedures. Define 'segments' and 'add-header-segment!'. Return the latter as the first value. * module/system/vm/assembler.scm (make-object): Remove 'bv' parameter and add 'size' and 'writer'. (link-data): Remove 'make-bytevector' call and move serialization to a lazy 'writer' procedure. (link-text-object): Likewise. (link-frame-maps): Likewise. (link-dynamic-section): Likewise. (link-shstrtab): Likewise. (link-symtab): Likewise. (link-arities): Likewise, and remove 'bytevector-append'. (link-docstrs): Likewise. (link-procprops): Likewise. (link-debug): Likewise, and define 'copy-writer'. * test-suite/tests/linker.test (link-elf-with-one-main-section): Adjust accordingly.
* Add test for 'string-ref' with a negative index at -O2.Ludovic Courtès2023-01-171-5/+14
| | | | | | | | | | This test would segfault prior to c0004442b7691f59a0e37869ef288eb26382ad9e. See <https://bugs.gnu.org/60488>. * test-suite/tests/strings.test ("string-ref"): Use 'with-test-prefix/c&e'. ["negative index"]: Check the reported bounds.
* Do not expand 'make-vector' primcall with wrong number of arguments.Ludovic Courtès2023-01-161-2/+11
| | | | | | | | | Fixes <https://bugs.gnu.org/60522>. Reported by Sascha Ziemann <ceving@gmail.com>. * module/language/tree-il/primitives.scm (make-vector): Return #f when passed an incorrect number of arguments. * test-suite/tests/peval.test ("partial evaluation"): Add tests.
* Add 'bytevector-slice'.Ludovic Courtès2023-01-141-1/+66
| | | | | | | | | * 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.
* Make 'system*' and 'piped-process' internally use 'spawn'.Josselin Poiret2023-01-131-1/+17
| | | | | | | | | | | | | 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>
* Add 'spawn'.Josselin Poiret2023-01-131-2/+77
| | | | | | | | | | | | | * 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>
* Test for 'frame-local-ref' errors when printing backtrace.Andrew Whatson2023-01-111-1/+22
| | | | | | | | | | | This test reproduces the error from <https://bugs.gnu.org/56493>, and passes with the workaround which was merged in commit c7fa78fc751eb336bcfafbb5ac59c460ee2c5d7a. * test-suite/tests/eval.test ("avoid frame-local-ref out of range"): New test. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Fix peval bug when expand-primitives introduces lexicalsAndy Wingo2022-12-011-1/+9
| | | | | | | | * module/language/tree-il/peval.scm (augment-var-table-with-externally-introduced-lexicals): New helper. * module/language/tree-il/peval.scm (peval): Augment store with any lexicals introduced by expand-primitives. * test-suite/tests/peval.test ("partial evaluation"): Add tests.
* Fix order-of-side-effects bug in (eq? x y z) expansionAndy Wingo2022-12-011-0/+11
| | | | | | | | | * module/language/tree-il/primitives.scm (bind-lexicals): New helper. (expand-eq, expand-chained-comparisons): Ensure all arguments are eagerly evaluated. Previously an intermediate #f result would shortcut the evaluation. * test-suite/tests/compiler.test ("size effects in multi-arg eq / <"): Add test.
* Add tests for warning locations.Andrew Whatson2022-11-291-1/+47
| | | | | | | | These would have caught <https://bugs.gnu.org/56493>. * test-suite/tests/tree-il.test ("warnings")("location")["unused variable", "unbound variable (spaces)", "unbound variable (tabs)"]: New tests.
* Define Scheme bindings to ‘openat’ when available.Maxime Devos2022-10-211-0/+73
| | | | | | | | | | | | | | | | * configure.ac: Detect if ‘openat’ is defined. * libguile/filesys.c (flags_to_mode): Extract from ... (scm_mode): ... here. (scm_open_fdes_at, scm_openat): Define the Scheme bindings. * libguile/filesys.h (scm_open_fdes_at, scm_openat): Make them part of the API. * doc/ref/posix.texi (File System): Document them. * test-suite/tests/filesys.test ("openat"): Test ‘openat’. * libguile/syscalls.h (openat_or_openat64): Decide between ‘openat’ and ‘openat64’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define a Scheme binding to ‘fstatat’ when available.Maxime Devos2022-10-211-0/+80
| | | | | | | | | | | * configure.ac: Detect if ‘fstatat’ is defined. * libguile/filesys.c (scm_statat): Define a Scheme binding to ‘fstatat’. * libguile/filesys.h (scm_statat): Make it part of the C API. * doc/ref/posix.texi (File System): Document it. * libguile/syscalls.h (fstatat_or_fstatat64): Choose between ‘fstatat’ and ‘fstatat64’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define a Scheme binding to ‘unlinkat’ when it exists.Maxime Devos2022-10-211-0/+59
| | | | | | | | | | | | | | | | ‘unlinkat’ is used for both unlinking regular files and removing empty directories. * configure.ac: Detect if ‘unlinkat’ exists. * doc/ref/posix.texi (File System): Document why there is no ‘rmdirat’ procedure, and document the ‘delete-file-at’ procedure. * libguile/filesys.c (scm_rmdir): Adjust the docstring here as well. (scm_delete_file_at): Define a Scheme binding to ‘unlinkat’. * libguile/filesys.h (scm_delete_file_at): Make ‘scm_delete_file_at’ part of the C API. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define a Scheme binding to ‘fchmodat’ when it exists.Maxime Devos2022-10-211-0/+53
| | | | | | | | | * configure.ac: Detect existence of fchmodat. * libguile/filesys.c (scm_chmodat): New procedure. * libguile/filesys.h (scm_chmodat): Make it part of the API. * test-suite/tests/filesys.test ("chmodat"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define a Scheme binding to ‘renameat’ when it exists.Maxime Devos2022-10-211-0/+104
| | | | | | | | | | | * configure.ac: Detect if ‘renameat’ is defined. * libguile/filesys.c (scm_renameat): Define a Scheme binding to the ‘renameat’ system call. * doc/ref/posix.texi (File System): Document it. * libguile/filesys.h (scm_renameat): Make it part of the C API. * test-suite/tests/filesys.test ("rename-file-at"): New tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define bindings to ‘mkdirat’ when the C function exists.Maxime Devos2022-10-211-0/+38
| | | | | | | | * configure.ac: Detect if ‘mkdirat’ exists. * libguile/filesys.c (scm_mkdirat): Define the Scheme binding. * doc/ref/posix.texi (File System): Document it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Define ‘symlinkat’ wrapper when supported.Maxime Devos2022-10-211-0/+27
| | | | | | | | | | | * configure.ac: Detect whether ‘symlinkat’ exists. * libguile/filesys.c (scm_symlinkat): Define a Scheme binding when it exists. * libguile/filesys.h: Make the binding part of the public C API. * doc/ref/posix.texi (File System): Document the binding. * test-suite/tests/filesys.test ("symlinkat"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Allow file ports in ‘utime’.Maxime Devos2022-10-211-1/+70
| | | | | | | | | | | | Ports representing symbolic links are currently unsupported. * configure.ac: Detect 'futimens'. * doc/ref/posix.texi (utime): Update documentation. * libguile/posix.c (scm_utime): Support ports. * libguile/posix.h (scm_utime): Rename argument. * test-suite/tests/posix.test ("utime"): Add more tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Allow file ports in ‘readlink’.Maxime Devos2022-10-211-0/+61
| | | | | | | | | | | * configure.ac: Detect whether ‘readlinkat’ is defined. * libguile/filesys.c (scm_readlink): Support file ports when ‘readlinkat’ exists. (scm_init_filesys): Provide ‘chdir-ports’ when it exists. * doc/ref/posix.texi (File System): Document it. * test-suite/tests/filesys.test ("readlink"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Allow file ports in ‘chdir’ when supported.Maxime Devos2022-10-211-0/+41
| | | | | | | | | | | | | * configure.ac: Check for ‘fchdir’. * libguile/filesys.c (scm_chdir): Support file ports. (scm_init_filesys): Report support of file ports. * doc/ref/posix.texi (Processes): Update accordingly. * doc/ref/guile.texi: Add copyright line for new documentation in this patch and later patches. * test-suite/tests/filesys.test ("chdir"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Presume ISO C90 headers are always availableMike Gran2022-10-141-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | This includes <assert.h>, <ctype.h>, <errno.h>, <float.h>, <iso646.h>, <limits.h>, <locale.h>, <math.h>, <setjmp.h>, <signal.h>, <stdarg.h>, <stddef.h>, <stdio.h>, <stdlib.h>, <string.h>, <time.h>, <wchar.h>, and <wctype.h>. * configure.ac: don't check for <limits.h>, <string.h>, <time.h>, <assert.h>. Remove AC_INCLUDES_DEFAULT macro * libguile/bytevectors.c: include <limits.h>, remove HAVE_LIMITS_H * libguile/filesys.c: include <string.h>, remove HAVE_STRING_H * libguile/fports.c: include <string.h>, remove HAVE_STRING_H * libguile/gen-scmconfig.c: remove HAVE_LIMITS_H, HAVE_TIME_H, STDC_HEADERS Remove SCM_HAVE_STDC_HEADERS * libguile/hash.c: include <wchar.h>, remove HAVE_WCHAR_H * libguile/net_db.c: include <string.h>, remove HAVE_STRING_H * libguile/numbers.h: remove SCM_HAVE_STDC_HEADERS * libguile/regex-posix.c: include <wchar.h>, remove HAVE_WCHAR_H (fixup_multibyte_match): always defined (scm_regexp_exec): use fixup_multibyte_match * libguile/scmsigs.c: remove STDC_HEADERS * libguile/socket.c: include <string.h>, remove HAVE_STRING_H * test-suite/standalone/test-unwind.c: include <string.h>, remove HAVE_STRING_H
* Test for out of range depth in fluid-ref*Daniel Llorens2022-10-031-0/+4
| | | | | Test for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58154, which was fixed in c0004442b7691f59a0e37869ef288eb26382ad9e.
* Modifies command line quoting in c-api.testMike Gran2022-10-021-1/+1
| | | | | | | | | On MinGW, 'system' uses a non-posix shell that does not handle apostrophe as a quoting character. For this test, quoting a command-line with double quotes allows it to be run with both /bin/sh and cmd.exe. * test-suite/tests/c-api.test (egrep): use double quotes when quoting command line
* Avoids deprecated egrep in c-api.testMike Gran2022-10-021-2/+2
| | | | | | | The standalone egrep script has been deprecated by GNU grep. 'grep -E' is the suggested replacement. * test-suite/tests/c-api.test (egrep): replace egrep with grep -E
* srfi-35: Fix expansion of 'condition' for compound conditions.Ludovic Courtès2022-10-011-2/+16
| | | | | | | * module/srfi/srfi-35.scm (condition): Use 'make-exception' instead of 'make-compound-condition', which is unbound in this module. * test-suite/tests/srfi-35.test ("syntax")["compound condition, hygienic macro expansion"]: New test.
* Baseline compiler no longer crashes on (not (list 1 2)).Ludovic Courtès2022-10-011-1/+7
| | | | | | | | | | 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.
* in ftw test, skip EACCESS test on MinGWMike Gran2022-09-201-3/+9
| | | | | | | | MinGW ACL-based permissions don't follow POSIX standard, so 'chmod' has unexpected behavior. * test-suite/tests/ftw.test (mingw?): new define ("file system fold: EACCES"): skip test on MinGW
* in ftw test, don't presume symlink is definedMike Gran2022-09-201-34/+40
| | | | | | * test-suite/tests/ftw.test (dangling symlink and lstat) (dangling symlink and stat, symlink to directory): skip if symlink undefined
* When fork unavailable, skip standalone tests that require itMichael Gran2022-09-202-1/+7
| | | | | | | MinGW is missing fork. * test-suite/standalone/test-close-on-exec: modified * test-suite/standalone/test-signal-fork: modified
* test-suite: Remove obsolete use of 'debug-enable'.Ludovic Courtès2022-09-191-3/+2
| | | | * test-suite/guile-test (enable-debug-mode): Remove 'debug-enable' call.
* 'pipe' now takes an optional 'flags' parameter.Ludovic Courtès2022-09-191-0/+35
| | | | | | | | | | | | | This is the same strategy as used for the 'accept4' bindings introduced in 6e0965104c579431e5a786b60e1a964a112c73b8. * 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.
* Add support for "e" flag (O_CLOEXEC) to 'open-file'.Ludovic Courtès2022-09-072-1/+42
| | | | | | | | | * 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.
* In curried definitions, move docstrings to outermost lambdaJean Abou Samra2022-08-291-2/+50
| | | | | | | This makes the docstring attached to the curried function being defined rather than the result of its application until a function that runs the body is obtained, fixing https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50068
* 'system*' can no longer close file descriptor 2.Ludovic Courtès2022-08-051-2/+14
| | | | | | | | | | Fixes <https://bugs.gnu.org/55596>. Reported by Hugo Nobrega <hugonobrega@ic.ufrj.br> and Jack Hill <jackhill@jackhill.us>. * libguile/posix.c (start_child): Close OUT only if it's greater than 2. * test-suite/tests/posix.test ("system*")["exit code for nonexistent file"] ["https://bugs.gnu.org/55596"]: New tests.
* web: Don't hide missing data in the chunked input port.Christopher Baines2022-07-041-8/+17
| | | | | | | | | | | | | | | | | This port is of limited use if it cannot be used reliably. Rather than behaving as if the input has finished when it ends unexpectedly, instead raise an exception. * module/web/http.scm (make-chunked-input-port): Raise an exception on premature termination. (&chunked-input-ended-prematurely): New exception type. (chunked-input-ended-prematurely-error?): New procedure. * test-suite/tests/web-http.test (pass-if-named-exception): Rename to pass-if-named-exception. (pass-if-named-exception): New syntax. ("Exception on premature chunk end"): New test for this behaviour. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* web: Handle ending CRLF (\r\n) for chunked input and output ports.Christopher Baines2022-07-041-2/+2
| | | | | | | | | | | | | | | | | The chunked transfer encoding specifies the chunked body ends with CRLF. This is in addition to the CRLF at the end of the last chunk, so there should be CRLF twice at the end of the chunked body: https://datatracker.ietf.org/doc/html/rfc2616#section-3.6.1 * module/web/http.scm (make-chunked-input-port): Read two extra bytes at the end of the chunked input. (make-chunked-output-port): Write the missing \r\n when closing the port. * test-suite/tests/web-http.test (chunked encoding): Add missing \r\n to test data. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* web: send capitalized authorization header schemeAleix Conchillo Flaqué2022-07-041-3/+8
| | | | | | | | | | | * module/web/http.scm (write-credentials): capitalize authorization header scheme. The standard allows the scheme to be case-insensitive, however most libraries out there expect the scheme to be capitalized, which is what it is actually used in RFC docs (e.g. https://datatracker.ietf.org/doc/html/rfc7617#section-2). Some libraries even reject lowercase scheme making Guile incompatible. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Allow null bytes in UNIX sockets.Liliana Marie Prikler2022-06-161-4/+75
| | | | | | | | | | | | | | | | | | | | | | The current socket address constructors all assume, that there are no null bytes in the socket path. This assumption does not hold in Linux, which uses an initial null byte to demarcate abstract sockets and ignores all further null bytes [1]. [1] https://www.man7.org/linux/man-pages/man7/unix.7.html * libguile/sockets.c (scm_fill_sockaddr)[HAVE_UNIX_DOMAIN_SOCKETS]: Use scm_to_locale_stringn to construct c_address. Use memcpy instead of strcpy and calculate size directly instead of using SUN_LEN. (_scm_from_sockaddr): Copy the entire path up to the limits imposed by addr_size. * test-suite/tests/00-socket.test: ("make-socket-address"): Add case for abstract unix sockets. ("AF_UNIX/SOCK_STREAM"): Add abstract socket versions of bind, listen, connect and accept. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Allow empty vendor string in GNU target triplets.Taylor R Campbell2022-06-161-1/+3
| | | | | | | | | | | | | | | | | NetBSD and pkgsrc have been using an empty vendor string since the mid-'90s, such as x86_64--netbsd. pkgsrc has been carrying around a workaround just the guile build for a long time. (Before that, NetBSD omitted the vendor altogether, so if x86_64 existed then it might have been `x86_64-netbsd', but that caused more problems.) This change makes Guile accept an empty vendor string so workarounds are no longer necessary. * module/system/base/target.scm (validate-target): Allow empty vendor string in GNU target triplets. * test-suite/tests/cross-compilation.test ("cross-compilation"): Add tests for "x86_64--netbsd". Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* Fix "non-revealed port is closed" ports.testRob Browning2022-03-161-3/+4
| | | | | | | | Don't close the test port's file descriptor because the port still has a reference to it, and could still close it at any time when finally garbage collected. This did soemetimes break subsequent tests. Bug: https://debbugs.gnu.org/43521