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

20859 commits

Author SHA1 Message Date
Mike Gran
9b357bace3 Presume ISO C90 headers are always available
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
2022-10-14 08:40:23 -07:00
Mike Gran
128e0a3479 Remove AC_HEADER_STDC from configure.ac
Requiring C99 implies standard headers are available

* configure.ac: remove AC_HEADER_STDC
2022-10-14 08:40:23 -07:00
Mike Gran
a274e1ced4 Remove obsolete macro AM_PROG_CC_C_O in configure script
It has been replaced by new functionality in AC_PROG_CC

* configure.ac: remove AM_PROG_CC_C_O
2022-10-14 08:40:23 -07:00
Mike Gran
78a98062a4 Use autoconf's ability to choose the latest version of C
Modern AC_PROG_CC will add flags to enable C11 when necessary.

* configure.ac: remove AC_PROG_CC_C99, rely on updated AC_PROG_CC
2022-10-14 08:40:23 -07:00
Mike Gran
bec1918b38 Presume const is always available
* configure.ac (AC_C_CONST): removed
2022-10-14 08:40:23 -07:00
Mike Gran
da254d6778 Update libtool initialization in configure script
* configure.ac (AC_LIBTOOL_WIN32_DLL, AC_LIBTOOL_DLOPEN): removed
  (AC_PROG_LIBTOOL): removed
  (LT_INIT): added
2022-10-14 08:40:23 -07:00
Jean Abou Samra
bc3b1a4e2d doc: Document how (ice-9 format) replaces 'format'.
* doc/ref/misc-modules.texi (Formatted Output): Add paragraph.
* module/ice-9/format.scm: Add comment.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-10-12 22:49:00 +02:00
Christopher Baines
6847365a9f Define SO_RCVTIMEO and SO_SNDTIMEO.
These are important for reliable networking, since they prevent network
operations from hanging indefinitely.

* libguile/socket.c (scm_init_socket): Define SO_RCVTIMEO and
SO_SNDTIMEO.
(scm_getsockopt, scm_setsockopt): Include SO_RCVTIMEO and SO_SNDTIMEO in
docstring and handle them.
* doc/ref/posix.texi (Network Sockets and Communication): Document them.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-12 22:28:07 +02:00
Daniel Llorens
328d6039d2 Update reference to the GNU Coding Standards. 2022-10-12 13:11:33 +02:00
Daniel Llorens
584ba588e5 Test for out of range depth in fluid-ref*
Test for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58154, which was
fixed in c0004442b7.
2022-10-03 12:19:58 +02:00
Mike Gran
45cc892fe3 Modifies command line quoting in c-api.test
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
2022-10-02 07:30:48 -07:00
Mike Gran
f5c064576d Avoids deprecated egrep in c-api.test
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
2022-10-02 07:23:52 -07:00
Ludovic Courtès
3ed7673ac0 srfi-35: Fix expansion of 'condition' for compound conditions.
* 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.
2022-10-01 18:04:16 +02:00
Antoine Kalmbach
78c7772eb7 doc: Fix typo in 'coverage-data->lcov' example.
* doc/ref/api-coverage.texi (Code Coverage): Close PORT, not FILE, in
the example.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-01 16:00:05 +02:00
Fulbert
b16dbb14bc doc: Fix typo under "CPS Soup".
* doc/ref/compiler.texi (CPS Soup) : fix small typo in doc (closing
paren out of @code{} tag).

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-01 16:00:05 +02:00
Fulbert
6c4738ee4c doc: Clarify reference to (sxml transform) module.
* doc/ref/sxml.texi (7.21.4 Transforming SXML): Adds a mention to the
module to be imported for the procedures introduced in this section of
the documentation..

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-10-01 16:00:05 +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
df86a2a8c8 Finalization thread exits when it gets EOF on its pipe.
Avoids spurious "error in finalization thread: Success" messages when
the finalization pipe gets closed.

* libguile/finalizers.c (finalization_thread_proc): Return when 'data.n'
is zero.
2022-10-01 16:00:05 +02:00
Daniel Llorens
d1a4b101bf Fix doc for string args to error C API 2022-09-30 12:04:15 +02:00
Daniel Llorens
c0004442b7 Fix bad arguments to range_error() in numbers.c
Fixes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58154. Ouch.
2022-09-30 12:02:12 +02:00
Mike Gran
426ed4068a in ftw test, skip EACCESS test on MinGW
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
2022-09-20 19:50:14 -07:00
Mike Gran
775149f0f5 in ftw test, don't presume symlink is defined
* test-suite/tests/ftw.test (dangling symlink and lstat)
  (dangling symlink and stat, symlink to directory):
    skip if symlink undefined
2022-09-20 19:30:38 -07:00
Michael Gran
130463be2a When fork unavailable, skip standalone tests that require it
MinGW is missing fork.

* test-suite/standalone/test-close-on-exec: modified
* test-suite/standalone/test-signal-fork: modified
2022-09-20 15:09:35 -07:00
Ludovic Courtès
61393a5da6 test-suite: Remove obsolete use of 'debug-enable'.
* test-suite/guile-test (enable-debug-mode): Remove 'debug-enable' call.
2022-09-19 22:30:16 +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
jgart
9592516bfa string-fun: Fix typo 2022-09-17 13:41:47 +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
3cd4881504 doc: Add documentation of the "b" flag to 'open-file'.
* doc/ref/api-io.texi (File Ports): Add documentation of the "b" flag,
taken from the 'open-file' docstring.
2022-09-07 18:00:30 +02:00
Jean Abou Samra
61d8dab8ea In curried definitions, move docstrings to outermost lambda
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
2022-08-29 11:45:39 +02:00
Andrew Whatson
eb5ecf4944 Properly display locations in "source vector" form.
Locations are stored in tree-il records in "source vector" form, but
`location-string' was rendering these as <unknown-location>.

* module/system/base/message.scm (location-string): Support locations
passed as a file/line/column vector.
2022-08-26 12:34:39 +02:00
jgart
c746586de3 doc: Add car+cdr example 2022-08-11 13:31:48 +02:00
Ludovic Courtès
56b1ea9002 'system*' can no longer close file descriptor 2.
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.
2022-08-05 14:20:51 +02:00
Ludovic Courtès
01e960edea Update NEWS.
* NEWS: Update.
2022-08-04 16:01:55 +02:00
Ludovic Courtès
317b06bf86 web: 'tls-wrap' retries handshake upon non-fatal errors.
Fixes <https://bugs.gnu.org/49223>.
Reported by Domagoj Stolfa <ds815@gmx.com>.

Backport of Guix commit b36267b1d96ac344d2b42c9822ce04b4c3117f85.

* guix/build/download.scm (tls-wrap): Retry up to 5 times when
'handshake' throws a non-fatal error.
2022-08-04 15:59:23 +02:00
Ludovic Courtès
c01ca10b3f web: Do not wrap TLS port on GnuTLS >= 3.7.7.
The custom input/output port wrapping the TLS session record port would
introduce overhead, and it would also prevent its uses in a non-blocking
context--e.g., with Fibers.  The port close mechanism added in GnuTLS
3.7.7 allows us to get rid of that wrapper.

Backported from Guix commit dd573ceea73295c7a872088ecd91e5f0fd74bf2b.

* web/client.scm (wrap-record-port-for-gnutls<3.7.7): New procedure,
with code formerly in 'tls-wrap'.
(tls-wrap): Check for 'set-session-record-port-close!' and use it when
available; otherwise call 'wrap-record-port-for-gnutls<3.7.7'.
2022-08-04 15:59:23 +02:00
Daniel Llorens
50d4b50203 Check for gperf at configure time
Edited Arne Babenhauserheide's patch
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51129;att=0;filename=0001-autoconf-Check-for-gperf-if-running-from-git.patch;msg=5.

Fixes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51129.
2022-08-02 15:08:57 +02:00
Ludovic Courtès
8c976c6a1f Update NEWS.
* NEWS: Update.
2022-07-04 11:52:14 +02:00
Ludovic Courtès
abd39f3328 Define IPPROTO_IPV6 and IPV6_V6ONLY.
* libguile/socket.c (scm_init_socket): Define IPPROTO_IPV6 and IPV6_V6ONLY.
* doc/ref/posix.texi (Network Sockets and Communication): Document them.
2022-07-04 11:49:31 +02:00
Ludovic Courtès
6da4be170a Define IN6ADDR_ANY and IN6ADDR_LOOPBACK.
* libguile/socket.c (scm_init_socket): Define IN6ADDR_ANY and IN6ADDR_LOOPBACK.
* doc/ref/posix.texi (Network Address Conversion): Document them.
2022-07-04 11:39:14 +02:00
Christopher Baines
baa1424335 web: Don't hide missing data in the chunked input port.
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>
2022-07-04 11:22:13 +02:00
Christopher Baines
9a3353a993 web: Handle ending CRLF (\r\n) for chunked input and output ports.
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>
2022-07-04 11:22:11 +02:00
Aleix Conchillo Flaqué
a84d8f6473 web: send capitalized authorization header scheme
* 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>
2022-07-04 11:16:36 +02:00
Ludovic Courtès
7e048c6c51 Update NEWS.
* NEWS: Update.
2022-06-16 10:06:32 +02:00
Jessica Tallon
4456245753 Add missing #:modules argument for coverage-data->lcov.
The code coverage function `coverage-data->lcov` has a documented
`modules` argument, however that was missing from the source. I have
added it so when supplied it only converts the coverage data for the
supplied modules. If not supplied it defaults the old behavour of
including all the modules currently loaded.

* module/system/vm/coverage.scm (coverage-data->lcov): Add #:modules
parameter and honor it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16 10:01:06 +02:00
Liliana Marie Prikler
01b686b701 Allow null bytes in UNIX sockets.
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>
2022-06-16 09:54:29 +02:00
Taylor R Campbell
e4e8afd6c8 Allow empty vendor string in GNU target triplets.
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>
2022-06-16 09:42:05 +02:00
Mihail Iosilevich
158da6966b Allow (library ...) form in cond-expand inside R7RS define-library.
Guile (3.0.8) reports a compilation error when cond-expand tries to
check existence of a missing library:

    scheme@(guile-user)> (define-library (test)
                           (cond-expand
                            ((library (scheme sort))
                             (import (scheme sort)))))
    While compiling expression:
    no code for module (scheme sort)

It looks like bug #40252 was not fully eliminated.

Also, (library ...) cannot handle module names like (srfi 1), though
(import (srfi 1)) works fine. For example, this code fails:

    scheme@(guile-user)> (define-library (test)
                           (cond-expand
                            ((library (srfi 1))
                             (import (srfi 1)))))
    While compiling expression:
    In procedure symbol->string: Wrong type argument in position 1
    (expecting symbol): 1

There are probably other cases when (library ...) and (import ...) does
not work identically: (library ...) uses resolve-interface while
(import ...) uses resolve-r6rs-interface.

This patch fixes both issues.

* module/ice-9/r7rs-libraries.scm (define-library): Replace
'resolve-interface' call by 'resolve-r6rs-interface', wrapped in
'cond-expand'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16 09:36:31 +02:00
Ludovic Courtès
e8a41aee29 'module-define!' honors the 'module' parameter.
* module/ice-9/boot-9.scm (module-define!): In 'module-add!' call, pass
MODULE rather than (current-module).
2022-06-16 09:31:36 +02:00
Ludovic Courtès
64449a835a 'connect' handles EAGAIN like EINPROGRESS.
* libguile/socket.c (scm_connect): Handle EAGAIN the same way as
EINPROGRESS (connect(2) returns EAGAIN for Unix-domain sockets and
socketpairs).
2022-06-16 09:31:36 +02:00