platform/upstream/guile.git
2 years agopackaging: fix asan build 53/278553/1 accepted/tizen_7.0_base accepted/tizen_7.0_base_hotfix accepted/tizen_7.0_base_tool accepted/tizen_7.0_base_tool_hotfix accepted/tizen_8.0_base accepted/tizen_9.0_base accepted/tizen_base accepted/tizen_base_tool accepted/tizen_base_toolchain accepted/tizen_base_x tizen_7.0_base tizen_7.0_base_hotfix tizen_8.0_base tizen_9.0_base tizen_base accepted/tizen/7.0/base/20230714.002923 accepted/tizen/7.0/base/hotfix/20230714.003738 accepted/tizen/7.0/base/tool/20221028.121305 accepted/tizen/7.0/base/tool/hotfix/20221115.085816 accepted/tizen/8.0/base/20231005.044755 accepted/tizen/9.0/base/20241030.075558 accepted/tizen/base/20230714.003329 accepted/tizen/base/tool/20220725.043005 accepted/tizen/base/toolchain/20240513.230941 accepted/tizen/base/x/20240520.013357 submit/tizen_7.0_base/20221028.201101 submit/tizen_7.0_base_hotfix/20221115.161601 submit/tizen_base/20220722.055237 tizen_7.0_m2_release tizen_8.0_m2_release tizen_9.0_m2_release
Dongkyun Son [Fri, 22 Jul 2022 02:56:16 +0000 (11:56 +0900)]
packaging: fix asan build

Change-Id: If5908d239e1ba0ab02e9f2888d96618bcee11106
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
3 years agoRemove build gperf dependency 43/266243/1 accepted/tizen/base/tool/20211110.061338 submit/tizen_base/20211109.151642
Slava Barinov [Tue, 9 Nov 2021 12:08:45 +0000 (15:08 +0300)]
Remove build gperf dependency

gperf requirement breaks build in :Base:Tool project

Change-Id: I196e9d14477b70d6fa497ef2d0b7a9d98f19846a
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
3 years agotime_rz: fix heap buffer overflow vulnerability 42/266242/1
Pádraig Brady [Mon, 24 Apr 2017 08:43:36 +0000 (01:43 -0700)]
time_rz: fix heap buffer overflow vulnerability

This issue has been assigned CVE-2017-7476 and was
detected with American Fuzzy Lop 2.41b run on the
coreutils date(1) program with ASAN enabled.

  ERROR: AddressSanitizer: heap-buffer-overflow on address 0x...
  WRITE of size 8 at 0x60d00000cff8 thread T0
  #1 0x443020 in extend_abbrs lib/time_rz.c:88
  #2 0x443356 in save_abbr lib/time_rz.c:155
  #3 0x44393f in localtime_rz lib/time_rz.c:290
  #4 0x41e4fe in parse_datetime2 lib/parse-datetime.y:1798

A minimized reproducer is the following 120 byte TZ value,
which goes beyond the value of ABBR_SIZE_MIN (119) on x86_64.
Extend the aa...b portion to overwrite more of the heap.

  date -d $(printf 'TZ="aaa%020daaaaaab%089d"')

localtime_rz and mktime_z were affected since commit 4bc76593.
parse_datetime was affected since commit 4e6e16b3f.

* lib/time_rz.c (save_abbr): Rearrange the calculation determining
whether there is enough buffer space available.  The rearrangement
ensures we're only dealing with positive numbers, thus avoiding
the problematic promotion of signed to unsigned causing an invalid
comparison when zone_copy is more than ABBR_SIZE_MIN bytes beyond
the start of the buffer.
* tests/test-parse-datetime.c (main): Add a test case written by
Paul Eggert, which overwrites enough of the heap so that
standard glibc will fail with "free(): invalid pointer"
without the patch applied.
Reported and analyzed at https://bugzilla.redhat.com/1444774

(cherry-pick from gnulib commit 94e01571507835ff59dd8ce2a0b56a4b566965a4)

Change-Id: Ie44025ff673705a339f6cbead646a47173bcbcbd

4 years agopackaging: Fix bdwgc dependency sandbox/vbarinov/pkgconfig
Slava Barinov [Thu, 4 Mar 2021 09:45:24 +0000 (12:45 +0300)]
packaging: Fix bdwgc dependency

Change-Id: I97bfe65e14b5850c01f0c7b1e8b633bca9350f10
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
5 years agoEnable static build 62/230562/4 accepted/tizen_6.0_base accepted/tizen_6.0_base_tool accepted/tizen_6.0_base_tool_hotfix tizen_6.0_base tizen_6.0_base_hotfix accepted/tizen/6.0/base/20201029.110705 accepted/tizen/6.0/base/20230713.142849 accepted/tizen/6.0/base/tool/20201029.112058 accepted/tizen/6.0/base/tool/hotfix/20201030.124902 accepted/tizen/6.0/base/tool/hotfix/20201102.090110 accepted/tizen/6.5/base/tool/20211027.115339 accepted/tizen/base/20200419.223850 submit/tizen_6.0_base/20201029.184801 submit/tizen_6.0_base_hotfix/20201030.192501 submit/tizen_6.0_base_hotfix/20201102.162701 submit/tizen_6.5_base/20211026.180901 submit/tizen_6.5_base/20211027.183101 submit/tizen_6.5_base/20211027.200601 submit/tizen_base/20200416.121222 tizen_6.0.m2_release tizen_6.5.m2_release
Slava Barinov [Wed, 15 Apr 2020 11:43:14 +0000 (14:43 +0300)]
Enable static build

guile binary must be static to provide support for qemu-accel
environment and run build in cross-build environments

Change-Id: Ide6d9208802bf77dbcfce0daf9d2e2cd84313cad
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
5 years agoEnable UTF-8 by default 73/230873/1
Slava Barinov [Wed, 15 Apr 2020 11:42:37 +0000 (14:42 +0300)]
Enable UTF-8 by default

Default build environment is set for UTF-8, so support is required to
enable build of dependent packages (e.g. autogen)

Change-Id: I0bca17bf0caa44f86f465184e47f7267d5ef266a
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
5 years agoTurn off arm build until proper acceleration is ready. tizen accepted/tizen/base/20200403.032836 submit/tizen_base/20200402.112753
Slava Barinov [Thu, 2 Apr 2020 08:42:46 +0000 (11:42 +0300)]
Turn off arm build until proper acceleration is ready.

Signed-off-by: Slava Barinov <v.barinov@samsung.com>
5 years agoVersion bump
Slava Barinov [Fri, 13 Mar 2020 12:45:05 +0000 (15:45 +0300)]
Version bump

Signed-off-by: Slava Barinov <v.barinov@samsung.com>
5 years agoPackaging added
Slava Barinov [Tue, 4 Dec 2018 13:27:18 +0000 (16:27 +0300)]
Packaging added

5 years agoBump version for Guile 2.2.6. upstream/2.2.6 v2.2.6
Ludovic Courtès [Sun, 30 Jun 2019 20:01:10 +0000 (22:01 +0200)]
Bump version for Guile 2.2.6.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
(LIBGUILE_INTERFACE_REVISION): Increment.

5 years agoUpdate NEWS.
Ludovic Courtès [Sun, 30 Jun 2019 20:00:20 +0000 (22:00 +0200)]
Update NEWS.

* NEWS: Update.

5 years agoREPL server: Avoid deprecated '_IOFBF'.
Ludovic Courtès [Sun, 30 Jun 2019 19:41:52 +0000 (21:41 +0200)]
REPL server: Avoid deprecated '_IOFBF'.

* module/system/repl/server.scm (drain-input-and-close): Use 'block
instead of _IOFBF.

5 years ago'strftime' and 'strptime' honor the locale encoding.
Ludovic Courtès [Sun, 30 Jun 2019 19:31:36 +0000 (21:31 +0200)]
'strftime' and 'strptime' honor the locale encoding.

Fixes <https://bugs.gnu.org/35920>.
Reported by Christopher Lam <christopher.lck@gmail.com>.

* libguile/stime.c (scm_strftime): Use 'scm_to_locale_stringn' instead
of 'scm_to_utf8_stringn'.
(scm_strptime): Likewise, and use 'scm_string_length' instead of
'u8_strnlen'.
* test-suite/tests/time.test ("strftime")["strftime passes wide
characters"]: Wrap body in 'with-locale'.
["strftime fr_FR.utf8", "strftime fr_FR.iso88591"]: New tests.
("strptime")["strftime fr_FR.utf8", "strftime fr_FR.iso88591"]: New
tests.

5 years agodoc: Document optional parameter of 'stat'.
Ludovic Courtès [Sun, 30 Jun 2019 15:26:43 +0000 (17:26 +0200)]
doc: Document optional parameter of 'stat'.

Fixes <https://bugs.gnu.org/34860>.
Reported by Tim Gesthuizen <tim.gesthuizen@yahoo.de>.

* doc/ref/posix.texi (File System): Document 'exception_on_error'
parameter of 'stat'.

5 years agotests: Add (web server) test.
Ludovic Courtès [Sun, 30 Jun 2019 15:20:54 +0000 (17:20 +0200)]
tests: Add (web server) test.

* test-suite/tests/web-server.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add it.

5 years agoports: Export 'current-load-port'.
Ludovic Courtès [Tue, 25 Jun 2019 12:47:27 +0000 (14:47 +0200)]
ports: Export 'current-load-port'.

This binding was forgotten when (ice-9 ports) was introduced in
44b3342c4d5ebd4bbf21c7c7608a5f1a53ba0eb4.  Thus it has always been
missing in Guile 2.2.

* module/ice-9/ports.scm: Export 'current-load-port'.

5 years agoRevert "web: Add support for HTTP header continuation lines."
Mark H Weaver [Mon, 24 Jun 2019 14:24:28 +0000 (10:24 -0400)]
Revert "web: Add support for HTTP header continuation lines."

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

This reverts commit 73cde5ed7218a090ecee888870908af5445796f0.

5 years agodoc: Fix argument list in match-lambda docs
Paul Morris [Sat, 17 Nov 2018 13:54:06 +0000 (08:54 -0500)]
doc: Fix argument list in match-lambda docs

* doc/ref/match.texi: Fix argument list for match-lambda.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
5 years agodoc: Fix minor typo in the HTTP headers documentation.
Arun Isaac [Mon, 7 Jan 2019 12:12:31 +0000 (17:42 +0530)]
doc: Fix minor typo in the HTTP headers documentation.

* doc/ref/web.texi (HTTP Headers): Fix minor typo.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
5 years agoRemove references to 'inet-ntoa' and 'inet-aton'.
Ludovic Courtès [Mon, 24 Jun 2019 13:10:13 +0000 (15:10 +0200)]
Remove references to 'inet-ntoa' and 'inet-aton'.

These procedures were removed in Guile 2.2 by commit
fc7bd367ab4b5027a7f80686b1e229c62e43c90b (May 2011).

* libguile/socket.h (scm_inet_aton, scm_inet_ntoa): Remove.
* module/system/repl/server.scm (make-tcp-server-socket): Use
'inet-pton' instead of 'inet-aton'.
* doc/ref/web.texi (HTTP): Likewise in 'declare-header!' example.
* doc/ref/posix.texi (Network Address Conversion): Remove documentation
of 'inet-ntoa' and 'inet-aton'.

5 years agoBump version for Guile 2.2.5. v2.2.5
Ludovic Courtès [Thu, 20 Jun 2019 09:37:24 +0000 (11:37 +0200)]
Bump version for Guile 2.2.5.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
(LIBGUILE_INTERFACE_CURRENT): Increment.
(LIBGUILE_INTERFACE_AGE): Increment.
(LIBGUILE_INTERFACE_REVISION): Reset.

5 years agoCopy terminating zero in 'scm_cat_path'.
Ludovic Courtès [Thu, 20 Jun 2019 09:43:08 +0000 (11:43 +0200)]
Copy terminating zero in 'scm_cat_path'.

* libguile/script.c (scm_cat_path): Pass N + 1, not N, to 'strncat'.
Reported by GCC 9.1.0.

5 years agosrfi-14: Fix possible buffer overrun in '%char-set-dump'.
Ludovic Courtès [Thu, 20 Jun 2019 09:34:46 +0000 (11:34 +0200)]
srfi-14: Fix possible buffer overrun in '%char-set-dump'.

* libguile/srfi-14.c (scm_sys_char_set_dump): Change array size from 9
to 11 as suggested by GCC 9.1.0.

5 years agoNEWS: Add information to remaining news items.
Mark H Weaver [Wed, 19 Jun 2019 02:23:26 +0000 (22:23 -0400)]
NEWS: Add information to remaining news items.

* NEWS: Update.

5 years agoNEWS: Fix typo.
Mark H Weaver [Tue, 18 Jun 2019 20:08:36 +0000 (16:08 -0400)]
NEWS: Fix typo.

* NEWS: Fix typo.

5 years agoNEWS: More tweaks.
Mark H Weaver [Tue, 18 Jun 2019 19:57:11 +0000 (15:57 -0400)]
NEWS: More tweaks.

* NEWS: Update.

5 years agoNEWS: Add more details.
Mark H Weaver [Tue, 18 Jun 2019 19:46:43 +0000 (15:46 -0400)]
NEWS: Add more details.

* NEWS: Update text.

5 years agoNEWS: Add more text.
Mark H Weaver [Tue, 18 Jun 2019 17:53:56 +0000 (13:53 -0400)]
NEWS: Add more text.

* NEWS: Update.

5 years agoNEWS: Add first draft of 2.2.5 changes.
Mark H Weaver [Tue, 18 Jun 2019 15:53:06 +0000 (11:53 -0400)]
NEWS: Add first draft of 2.2.5 changes.

* NEWS: Add draft updates.

5 years agoTHANKS: Christopher Allan Webber -> Christopher Lemmer Webber.
Mark H Weaver [Tue, 18 Jun 2019 14:57:53 +0000 (10:57 -0400)]
THANKS: Christopher Allan Webber -> Christopher Lemmer Webber.

* THANKS: Update name and re-sort.

5 years agoUpdate THANKS.
Mark H Weaver [Tue, 18 Jun 2019 14:47:49 +0000 (10:47 -0400)]
Update THANKS.

* THANKS: Thank Christopher Allan Webber, Christopher Baines, and
Timothy Sample for contributions.  Thank Andrea Azzarone, Михаил
Бахтерев, Jonathan Brielmaier, Josh Datko, Massimiliano Gubinelli, Arun
Isaac, Shea Levy, Chris Marusich, Jan Smydke, Tom de Vries, Jeffrey
Walton, and Zefram for fixes.  Move Michael Talbot-Wilson and Michael
Tuexen to their proper place to fix the sorting.

5 years agostexi->shtml: Add support for @i, @math, @tie and @dots.
Christopher Baines [Sun, 16 Jun 2019 14:36:24 +0000 (15:36 +0100)]
stexi->shtml: Add support for @i, @math, @tie and @dots.

* module/texinfo/html.scm (tag-replacements): Add support for @i
and @math.  The tags used come from the texinfo documentation.
(rules): Convert @tie and @dots to the appropriate HTML entities.

5 years agoAvoid regexp ranges in HTTP inter-protocol exploitation check.
Mark H Weaver [Tue, 18 Jun 2019 12:59:47 +0000 (08:59 -0400)]
Avoid regexp ranges in HTTP inter-protocol exploitation check.

* module/system/repl/server.scm (permissive-http-request-line?): Avoid
character ranges in regexp.

5 years agoweb: Add support for HTTP header continuation lines.
Mark H Weaver [Tue, 18 Jun 2019 12:26:00 +0000 (08:26 -0400)]
web: Add support for HTTP header continuation lines.

* module/web/http.scm (spaces-and-tabs, space-or-tab?): New variables.
(read-header-line): After reading a header, if a space or tab follows,
read the continuation lines and join them.
* test-suite/tests/web-http.test: Add test.

5 years agoRename 'scm_c_make_char' to 'scm_i_make_char'.
Mark H Weaver [Tue, 18 Jun 2019 11:30:54 +0000 (07:30 -0400)]
Rename 'scm_c_make_char' to 'scm_i_make_char'.

* libguile/chars.c, libguile/chars.h, libguile/ports.c,
libguile/print.c, libguile/read.c, libguile/srfi-13.c,
libguile/strings.c, libguile/vm-engine.c: Rename 'scm_c_make_char' to
'scm_i_make_char'.

5 years agoMake 'get-bytevector-n!' suspendable.
Mark H Weaver [Fri, 19 Apr 2019 06:58:44 +0000 (02:58 -0400)]
Make 'get-bytevector-n!' suspendable.

* module/ice-9/suspendable-ports.scm (get-bytevector-n!): New procedure.
(get-bytevector-n): Rewrite in terms of 'get-bytevector-n!'.
(port-bindings): Add 'get-bytevector-n!'.

5 years agoSRFI-19: Rename 'tai-epoch-in-jd' to 'utc-epoch-in-jd'.
Mark H Weaver [Wed, 24 Oct 2018 07:14:49 +0000 (03:14 -0400)]
SRFI-19: Rename 'tai-epoch-in-jd' to 'utc-epoch-in-jd'.

* module/srfi/srfi-19.scm: Rename 'tai-epoch-in-jd' to
'utc-epoch-in-jd', to reflect its actual meaning and usage.

5 years agofport_seek: Eliminate a fruitless use of 'off_t_or_off64_t'.
Mark H Weaver [Tue, 18 Jun 2019 07:28:18 +0000 (03:28 -0400)]
fport_seek: Eliminate a fruitless use of 'off_t_or_off64_t'.

This is a followup to commit 91ba73b397fcc2a36ae7e434522a924c7a8887d0.

* libguile/fports.c (fport_seek): Use 'lseek' instead of
'lseek_or_lseek64', and use 'scm_t_off' uniformly.  That's the type used
in the function signature, and there's no benefit to using a wider type
internally.  Remove the overflow check, which is no longer needed.

5 years agoFix documentation of R6RS 'binary-port?' to reflect reality.
Mark H Weaver [Sun, 28 Apr 2019 07:55:40 +0000 (03:55 -0400)]
Fix documentation of R6RS 'binary-port?' to reflect reality.

* doc/ref/r6rs.texi (rnrs io ports): Improve the descriptions of
'binary-port?' and 'textual-port?'.
* module/rnrs/io/ports.scm (binary-port?, textual-port?): Update the
docstrings.

5 years agoopen-process: Fix dup(2) and execvp(2) error handling.
Mark H Weaver [Sat, 11 May 2019 07:47:41 +0000 (03:47 -0400)]
open-process: Fix dup(2) and execvp(2) error handling.

Previously, in the case where OUT is 0, or ERR is 0 or 1,
e.g. when (current-error-port) points to STDOUT, the code in
'start_child' to relocate OUT/ERR out of the way to another file
descriptor had multiple bugs:

(1) It neglected to close the original file descriptor.

(2) It checked 'errno' without first checking the return value of
    dup(2).  This doesn't work because dup(2) leaves 'errno' unchanged
    if there's no error.

(3) In case 'errno' contained EINTR, the retry code failed because
    OUT (or ERR) was overwritten by the result of the previous failed
    dup(2) call.

This commit fixes these problems, as well as another problem with
'execvp' error reporting.

* libguile/posix.c (renumber_file_descriptor): New static helper
function.
(start_child): Use 'renumber_file_descriptor'.  If 'execvp' fails, write
the error message to file descriptor 2.  Previously, we wrote the error
message to ERR, which was the old file descriptor before being relocated
to 2.

5 years agoRefresh a stale comment.
Mark H Weaver [Sat, 11 May 2019 07:44:58 +0000 (03:44 -0400)]
Refresh a stale comment.

* libguile/numbers.h: In a comment, update the count of number subtypes.

5 years agoscm_mkstrport: Optimize the POS -> BYTE_POS conversion.
Mark H Weaver [Tue, 18 Jun 2019 06:09:16 +0000 (02:09 -0400)]
scm_mkstrport: Optimize the POS -> BYTE_POS conversion.

* libguile/strports.c (scm_mkstrport): Use 'scm_c_string_utf8_length' to
avoid the conversion to UTF-8.

5 years agoMake 'get-bytevector-some' and 'get-bytevector-some!' suspendable.
Mark H Weaver [Wed, 17 Apr 2019 03:13:37 +0000 (23:13 -0400)]
Make 'get-bytevector-some' and 'get-bytevector-some!' suspendable.

* module/ice-9/suspendable-ports.scm (get-bytevector-some)
(get-bytevector-some!): New procedures.
(port-bindings): Add them.

5 years agoopen-pipe*: Improve performance of OPEN_BOTH mode.
Mark H Weaver [Mon, 8 Apr 2019 10:21:20 +0000 (06:21 -0400)]
open-pipe*: Improve performance of OPEN_BOTH mode.

* module/ice-9/popen.scm (make-rw-port): Re-implement using R6RS
custom binary input/output ports.

5 years agoAdd get-bytevector-some!.
Mark H Weaver [Wed, 17 Apr 2019 03:13:06 +0000 (23:13 -0400)]
Add get-bytevector-some!.

* libguile/r6rs-ports.c (scm_get_bytevector_some_x): New procedure.
* libguile/r6rs-ports.h (scm_get_bytevector_some_x): Add prototype.
(scm_unget_bytevector): Move prototype next to 'scm_get_bytevector_some_x'.
* module/ice-9/binary-ports.scm: Export 'get-bytevector-some!'.
* doc/ref/api-io.texi (Binary I/O): Document it.

5 years agoscm_to_stringn: Avoid passing NULL to c_strcasecmp.
Mark H Weaver [Wed, 29 May 2019 19:31:42 +0000 (15:31 -0400)]
scm_to_stringn: Avoid passing NULL to c_strcasecmp.

Reported by Massimiliano Gubinelli <m.gubinelli@gmail.com> in
<https://lists.gnu.org/archive/html/guile-user/2019-05/msg00070.html>.

* libguile/strings.c (scm_to_stringn): Check for (encoding == NULL)
before passing it to 'c_strcasecmp'.  Eliminate redundant 'enc'
variable.

5 years agotime.test: Use 'pass-if-equal' in more tests.
Mark H Weaver [Fri, 31 May 2019 02:07:48 +0000 (22:07 -0400)]
time.test: Use 'pass-if-equal' in more tests.

* test-suite/tests/time.test ("strftime"): Change some uses of 'pass-if'
to instead use 'pass-if-equal'.

5 years agoFix typo in tags.h comment.
Mark H Weaver [Wed, 22 May 2019 03:15:41 +0000 (23:15 -0400)]
Fix typo in tags.h comment.

* libguile/tags.h: Fix typo in comment.

5 years agoSave and restore errno in the signal handler.
Mark H Weaver [Sat, 25 May 2019 09:20:42 +0000 (05:20 -0400)]
Save and restore errno in the signal handler.

* libguile/scmsigs.c (take_signal): Save and restore errno.

5 years agoImprove overflow checks in bytevector, string, and I/O operations.
Mark H Weaver [Fri, 19 Apr 2019 04:59:59 +0000 (00:59 -0400)]
Improve overflow checks in bytevector, string, and I/O operations.

* libguile/bytevectors.c (INTEGER_ACCESSOR_PROLOGUE)
(scm_bytevector_copy_x, bytevector_large_set): Rewrite checks to reliably
detect overflows.
(make_bytevector): Constrain the bytevector length to avoid later
overflows during allocation.
(make_bytevector_from_buffer): Fix indentation.
(scm_bytevector_length): Use 'scm_from_size_t' to convert a 'size_t',
not 'scm_from_uint'.
* libguile/fports.c (fport_seek): Check for overflow before the implicit
conversion of the return value.
* libguile/guardians.c (guardian_print): Use 'scm_from_ulong' to convert
an 'unsigned long', not 'scm_from_uint'.
* libguile/ports.c (scm_unread_string): Change a variable to type 'size_t'.
(scm_seek, scm_truncate_file): Use 'scm_t_off' instead of
'off_t_or_off64_t' to avoid implicit type conversions that could
overflow, because 'ptob->seek' and 'ptob->truncate' use 'scm_t_off'.
* libguile/r6rs-ports.c (bytevector_input_port_seek)
(custom_binary_port_seek, bytevector_output_port_seek): Rewrite offset
calculations to reliably detect overflows.  Use 'scm_from_off_t' to
convert a 'scm_t_off', not 'scm_from_long' nor 'scm_from_int'.
(scm_get_bytevector_n_x, scm_get_bytevector_all, scm_unget_bytevector)
(bytevector_output_port_write): Rewrite checks to reliably detect
overflows.  Use 'size_t' where appropriate.
(bytevector_output_port_buffer_grow): Rewrite size calculations to
reliably detect overflows.  Minor change in the calculation of the new
size: now it is max(min_size, 2*current_size), whereas previously it
would multiply current_size by the smallest power of 2 needed to surpass
min_size.
* libguile/strings.c (make_stringbuf): Constrain the stringbuf length to
avoid later overflows during allocation.
(scm_string_append): Change overflow check to use INT_ADD_OVERFLOW.
* libguile/strports.c (string_port_write): Rewrite size calculations to
reliably detect overflows.
(string_port_seek): Rewrite offset calculations to reliably detect
overflows.  Use 'scm_from_off_t' to convert a 'scm_t_off', not
'scm_from_long'.
(string_port_truncate): Use 'scm_from_off_t' to convert a 'scm_t_off',
not 'scm_from_off_t_or_off64_t'.
* libguile/vectors.c (scm_c_make_vector): Change a variable to type
'size_t'.

6 years agoMake URI handling locale independent.
Timothy Sample [Sun, 2 Jun 2019 18:41:20 +0000 (14:41 -0400)]
Make URI handling locale independent.

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

* module/web/uri.scm (digits, hex-digits, letters): New variables.
(ipv4-regexp, ipv6-regexp, domain-label-regexp, top-label-regexp,
userinfo-pat, host-pat, ipv6-host-pat, port-pat, scheme-pat): Explicitly
list each character instead of using character ranges.
* test-suite/tests/web-uri.test: Add corresponding tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
6 years ago'basename' correctly handles "/" and "//".
Ludovic Courtès [Tue, 4 Jun 2019 19:20:15 +0000 (21:20 +0200)]
'basename' correctly handles "/" and "//".

* libguile/filesys.c (scm_basename): Special-case "/" and "//".
* test-suite/tests/filesys.test ("basename"): New test prefix.

6 years agoUpdate iconv.m4 from gnulib.
Mark H Weaver [Tue, 14 May 2019 05:39:39 +0000 (01:39 -0400)]
Update iconv.m4 from gnulib.

* m4/iconv.m4: Update from gnulib-v0.1-2176-ga79f2a287.

6 years agoStrings, i18n: Limit the use of alloca to approximately 8 kilobytes.
Mark H Weaver [Tue, 7 May 2019 01:11:26 +0000 (21:11 -0400)]
Strings, i18n: Limit the use of alloca to approximately 8 kilobytes.

* libguile/i18n.c (SCM_MAX_ALLOCA): New macro.
(SCM_STRING_TO_U32_BUF): Accept an additional variable to remember
whether we used malloc to allocate the buffer.  Use malloc if the
allocation size is greater than SCM_MAX_ALLOCA.
(SCM_CLEANUP_U32_BUF): New macro.
(compare_u32_strings, compare_u32_strings_ci, str_to_case): Adapt.
* libguile/strings.c (SCM_MAX_ALLOCA): New macro.
(normalize_str, unistring_escapes_to_r6rs_escapes): Use malloc if the
allocation size is greater than SCM_MAX_ALLOCA.
* test-suite/tests/i18n.test, test-suite/tests/strings.test: Add tests.

6 years agoput-u8: Always write a single byte, regardless of the port encoding.
Mark H Weaver [Wed, 1 May 2019 09:20:36 +0000 (05:20 -0400)]
put-u8: Always write a single byte, regardless of the port encoding.

Previously, 'put-u8' used textual I/O to write a single character,
relying on the usual practice of setting the port encoding to ISO-8859-1
for binary ports.

* libguile/r6rs-ports.c (scm_put_u8): Use 'scm_c_write', not 'scm_putc'.

6 years agoOptimize fixnum exact integer square roots.
Mark H Weaver [Sun, 28 Apr 2019 07:45:11 +0000 (03:45 -0400)]
Optimize fixnum exact integer square roots.

* libguile/numbers.c (scm_exact_integer_sqrt, scm_sqrt)
(exact_integer_is_perfect_square, exact_integer_floor_square_root):
Where it is trivial to do so, use GMP's low-level mpn functions to
avoid heap allocation.

6 years agoAvoid 'with-latin1-locale' in binary I/O tests.
Mark H Weaver [Fri, 19 Apr 2019 07:09:37 +0000 (03:09 -0400)]
Avoid 'with-latin1-locale' in binary I/O tests.

* test-suite/tests/r6rs-ports.test ("put-bytevector [2 args]")
("put-bytevector [3 args]", "put-bytevector [4 args]"): Set the default
port encoding instead of setting the locale.

6 years agoFix indentation in scm_sum.
Mark H Weaver [Tue, 7 May 2019 01:13:18 +0000 (21:13 -0400)]
Fix indentation in scm_sum.

6 years agoFix typo in comment.
Mark H Weaver [Wed, 17 Apr 2019 11:32:23 +0000 (07:32 -0400)]
Fix typo in comment.

6 years agoAdd 'scm_c_make_char' and use it where appropriate.
Mark H Weaver [Tue, 7 May 2019 06:28:26 +0000 (02:28 -0400)]
Add 'scm_c_make_char' and use it where appropriate.

This reverts the change to SCM_MAKE_CHAR made in the previous commit
63818453ad226cd3c2d1fd8ade12e3d7c1d43c05, which used an arithmetic trick
to avoid evaluating its argument more than once.

Here, we restore the previous implementation of SCM_MAKE_CHAR, which
evaluates its argument twice.  Instead, we introduce a new inlinable
function 'scm_c_make_char' and replace uses of SCM_MAKE_CHAR with calls
to 'scm_c_make_char' where appropriate.

* libguile/chars.h (scm_c_make_char): New inline function.
* libguile/inline.c: Include chars.h.
* libguile/srfi-13.c (REF_IN_CHARSET, scm_string_any, scm_string_every)
(scm_string_trim, scm_string_trim_right, scm_string_trim_both)
(scm_string_index, scm_string_index_right, scm_string_skip)
(scm_string_skip_right, scm_string_count, string_titlecase_x)
(string_reverse_x, scm_string_fold, scm_string_fold_right)
(scm_string_for_each, scm_string_filter, scm_string_delete):
Use 'scm_c_make_char' instead of 'SCM_MAKE_CHAR' in cases where the
argument calls a function.
* libguile/chars.c (scm_char_upcase, scm_char_downcase, scm_char_titlecase),
libguile/ports.c (scm_port_decode_char),
libguile/print.c (scm_simple_format),
libguile/read.c (scm_read_character),
libguile/strings.c (scm_string_ref, scm_c_string_ref),
libguile/vm-engine.c ("string-ref"): Ditto.

6 years agoReimplement SCM_MAKE_CHAR to evaluate its argument only once.
Mark H Weaver [Wed, 17 Apr 2019 03:11:42 +0000 (23:11 -0400)]
Reimplement SCM_MAKE_CHAR to evaluate its argument only once.

The motivation for this change is that SCM_MAKE_CHAR is sometimes passed
an expression that involves a procedure call that is not always trivial.
In other cases, the results are not guaranteed to be the same both
times, which could lead to the creation of invalid SCM objects.

* libguile/chars.h (SCM_MAKE_CHAR): Reimplement.

6 years agoFix gc.test "after-gc-hook gets called" failures.
Andrea Azzarone [Thu, 11 Apr 2019 15:30:58 +0000 (16:30 +0100)]
Fix gc.test "after-gc-hook gets called" failures.

* libguile/scmsigs.c (signal_delivery_thread): Call scm_async_tick to
give any pending asyncs a chance to run before we block indefinitely
waiting for a signal to arrive.

6 years agoUpdate user-visible copyright years.
Mark H Weaver [Mon, 15 Apr 2019 23:16:28 +0000 (19:16 -0400)]
Update user-visible copyright years.

* doc/ref/guile.texi: Update years in copyright notice.
* module/ice-9/command-line.scm (version-etc): Update 'copyright-year'.
* module/system/repl/common.scm (*version*): Update copyright years.

6 years agoAvoid passing NULL to 'memcpy' and 'memcmp'.
Mark H Weaver [Tue, 2 Apr 2019 02:11:35 +0000 (22:11 -0400)]
Avoid passing NULL to 'memcpy' and 'memcmp'.

Reported by Jeffrey Walton <noloader@gmail.com> in
<https://lists.gnu.org/archive/html/guile-devel/2019-03/msg00001.html>.

Note that C11 section 7.1.4 (Use of library functions) states that:
"unless explicitly stated otherwise in the detailed descriptions [of
library functions] that follow: If an argument to a function has an
invalid value (such as ... a null pointer ...) ..., the behavior is
undefined."  Note that 'strxfrm' is an example of a standard C function
that explicitly states otherwise, allowing NULL to be passed in the
first argument if the size argument is zero, but no similar allowance is
specified for 'memcpy' or 'memcmp'.

* libguile/bytevectors.c (scm_uniform_array_to_bytevector): Call memcpy
only if 'byte_len' is non-zero.
* libguile/srfi-14.c (charsets_equal): Call memcmp only if the number of
ranges is non-zero.
* libguile/stime.c (setzone): Pass 1-character buffer to
'scm_to_locale_stringbuf', instead of NULL.
* libguile/strings.c (scm_to_locale_stringbuf): Call memcpy only if the
number of bytes to copy is non-zero.

6 years agoRemove vestigial comment in tags.h.
Mark H Weaver [Mon, 15 Apr 2019 04:17:21 +0000 (00:17 -0400)]
Remove vestigial comment in tags.h.

* libguile/tags.h: Remove a vestigial comment which seems to have been
separated from its associated code long ago.

6 years agoFix typo in comment.
Mark H Weaver [Thu, 15 Nov 2018 07:47:22 +0000 (02:47 -0500)]
Fix typo in comment.

* module/ice-9/boot-9.scm: Fix typo.

6 years agoDisable test for current value of setitimer on Cygwin
Michael Gran [Sun, 24 Feb 2019 07:23:19 +0000 (23:23 -0800)]
Disable test for current value of setitimer on Cygwin

* test-suite/tests/signals.test ("current itimers are 0"): throws unresolved
    for cygwin

6 years agoMake locale monetary conversion tests be less strict on terminal whitespace
Michael Gran [Sun, 24 Feb 2019 07:16:31 +0000 (23:16 -0800)]
Make locale monetary conversion tests be less strict on terminal whitespace

* test-suite/tests/i18n.test (monetary-amount->locale-string): modified

6 years agoHandle newlib C library's langinfo constant names
Michael Gran [Sun, 24 Feb 2019 00:33:50 +0000 (16:33 -0800)]
Handle newlib C library's langinfo constant names

The newlib C library (used in Cygwin) has alternative names for
nl_langinfo GNU extensions

* configure.ac (_NL_NUMERIC_GROUPING): new test
* libguile/i18n.c (INT_CURR_SYMBOL, MON_DECIMAL_POINT, MON_THOUSANDS_SEP)
   (MON_GROUPING, POSITIVE_SIGN, NEGATIVE_SIGN, GROUPING, INT_FRAC_DIGITS)
   (FRAC_DIGITS, P_CS_PRECEDES, P_SEP_BY_SPACE, N_CS_PRECEDES, N_SEP_BY_SPACE)
   (P_SIGN_POSN, N_SIGN_POSN, INT_P_CS_PRECEDES, INT_P_SEP_BY_SPACE)
   (INT_N_CS_PRECEDES, INT_N_SEP_BY_SPACE, INT_P_SIGN_POSN, INT_N_SIGN_POSN)
   [HAVE_DECL__NL_NUMERIC_GROUPING]: map to newlib C constants, when present

6 years agoAdd a fallback value for the locale-monetary-decimal-point
Michael Gran [Sun, 24 Feb 2019 00:19:05 +0000 (16:19 -0800)]
Add a fallback value for the locale-monetary-decimal-point

* module/ice-9/i18n.scm (locale-monetary-decimal-point): use "." as fallback

6 years agoFix race when expanding syntax-parameterize and define-syntax-parameter
Andy Wingo [Fri, 22 Feb 2019 14:25:21 +0000 (15:25 +0100)]
Fix race when expanding syntax-parameterize and define-syntax-parameter

* module/ice-9/psyntax.scm (put-global-definition-hook)
  (get-global-definition-hook): Inline into uses.
  (make-binding): Change format of lexically defined or rebound syntax
  parameters to just be the transformer, not a list of the transformer.
  (resolve-identifier, expand-install-global, expand-body)
  (syntax-parameterize): Adapt to use the variable object (box) holding
  the top-level syntax parameter as the "key" for lookups into the
  lexical environment, instead of a fresh object associated with the
  syntax transformer.
* module/ice-9/psyntax-pp.scm: Regenerate.

Fixes #27476, a horrible race when one thread is expanding a
syntax-parameterize form including uses, and another thread is expanding
the corresponding define-syntax-parameter.  See
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27476#102.

6 years agoFix crypt-on-glibc test error
Andy Wingo [Fri, 1 Feb 2019 16:18:50 +0000 (17:18 +0100)]
Fix crypt-on-glibc test error

* test-suite/tests/posix.test ("crypt"): Allow for the given salt being
  valid.  Thanks to Jonathan Brielmaier for the report and debugging!

6 years agoFix binary output on files created by mkstemp!
Mike Gran [Sun, 10 Feb 2019 00:59:38 +0000 (16:59 -0800)]
Fix binary output on files created by mkstemp!

Some operating systems require a O_BINARY flag.

* libguile/filesys.c (scm_i_mkstemp): Don't mask out O_BINARY flag
* test-suite/tests/posix.test ("binary mode honored"): new test

6 years agoAvoid leaking a file descriptor in test-unwind
Mike Gran [Sun, 10 Feb 2019 00:39:19 +0000 (16:39 -0800)]
Avoid leaking a file descriptor in test-unwind

* test-suite/standalone/test-unwind.c (check_ports): explicitly close temp file

6 years agoFix strftime compile with null threads
Mike Gran [Sun, 10 Feb 2019 00:20:13 +0000 (16:20 -0800)]
Fix strftime compile with null threads

* libguile/stime.c (scm_strftime): use correct pthread lock function

6 years agoRemove redefinition of when & unless in snarf-check-and-output-texi
Mike Gran [Sat, 9 Feb 2019 17:54:55 +0000 (09:54 -0800)]
Remove redefinition of when & unless in snarf-check-and-output-texi

* module/scripts/snarf-check-and-output-texi.scm (when, unless): removed

6 years agoDon't mutate read-only string in ports test
Mike Gran [Sat, 9 Feb 2019 17:44:28 +0000 (09:44 -0800)]
Don't mutate read-only string in ports test

* test-suite/tests/ports.test ("valid wide mode string"): modified

6 years agoDo not warn the user when 'madvise' returns ENOSYS.
Ludovic Courtès [Sat, 15 Dec 2018 17:04:27 +0000 (18:04 +0100)]
Do not warn the user when 'madvise' returns ENOSYS.

* libguile/vm.c (return_unused_stack_to_os): Avoid 'perror' calls when
'madvise' returns ENOSYS.

6 years agoFix tests for SRFI-19 date->string ~N
Daniel Llorens [Wed, 12 Dec 2018 07:01:05 +0000 (08:01 +0100)]
Fix tests for SRFI-19 date->string ~N

6 years agoSupport ~N in SRFI-19 string->date
Daniel Llorens [Mon, 10 Dec 2018 10:57:05 +0000 (11:57 +0100)]
Support ~N in SRFI-19 string->date

* module/srfi/srfi-19.scm (fractional-integer-reader,
  make-fractional-integer-reader): From reference implementation.
  (reader-directives): Handle #\N, from reference implementation.
* test-suite/tests/srfi-19: Add tests for string->date ~N.
* doc/ref/srfi-modules.texi (string->date): Add line for ~N.

6 years agoUpdate (ice-9 match) to include selected bug fixes from upstream.
Mark H Weaver [Mon, 12 Nov 2018 04:07:47 +0000 (23:07 -0500)]
Update (ice-9 match) to include selected bug fixes from upstream.

Fixes <https://bugs.gnu.org/22925> and other bugs.

* module/ice-9/match.upstream.scm: Apply selected fixes from the
upstream match.scm in Chibi-Scheme.
* test-suite/tests/match.test.upstream: Add more tests from upstream.

6 years agoFix spelling of ellipsis in (ice-9 match).
Mark H Weaver [Mon, 12 Nov 2018 04:02:00 +0000 (23:02 -0500)]
Fix spelling of ellipsis in (ice-9 match).

* module/ice-9/match.upstream.scm: Change several occurrences
of 'ellipse' and 'ellipses' to 'ellipsis', to more closely match
match.scm from Chibi-Scheme.

6 years agoDocumentation fixes
Mikael Djurfeldt [Wed, 31 Oct 2018 18:08:58 +0000 (19:08 +0100)]
Documentation fixes

* doc/ref/api-control:
* doc/ref/compiler.texi: Language fixes
* doc/ref/compiler ($kfun): Renamed argument clauses -> clause.

6 years agoBootstrap optimization
Mikael Djurfeldt [Thu, 25 Oct 2018 11:53:47 +0000 (13:53 +0200)]
Bootstrap optimization

* bootstrap/Makefile.am: Build both eval.go and psyntax-pp.go before
  the rest of the .go files so that they are handled by a fast macro
  expander. This saves time for a parallel build.

6 years agoAdd texinfo dependency to README
Mikael Djurfeldt [Wed, 24 Oct 2018 18:56:16 +0000 (20:56 +0200)]
Add texinfo dependency to README

* README: Add texinfo dependency.

6 years agoSRFI-19: Minor refactor of leap second table lookups.
Mark H Weaver [Tue, 23 Oct 2018 00:19:39 +0000 (20:19 -0400)]
SRFI-19: Minor refactor of leap second table lookups.

* module/srfi/srfi-19.scm (leap-second-delta): Replace with ...
(utc->tai): ... this.
(leap-second-neg-delta): Replace with ...
(tai->utc): ... this.
(current-time-tai, priv:time-tai->time-utc!, priv:time-utc->time-tai!)
(time-tai->julian-day, time-monotonic->julian-day): Adapt accordingly.

6 years agoSRFI-19: time-utc->date: Support non-integer nanoseconds values.
Mark H Weaver [Mon, 22 Oct 2018 07:21:40 +0000 (03:21 -0400)]
SRFI-19: time-utc->date: Support non-integer nanoseconds values.

* module/srfi/srfi-19.scm (time-utc->date): Use 'floor-remainder'
instead of 'modulo'.

6 years agoSRFI-19: Check for incompatible types in time comparisons.
Mark H Weaver [Sun, 21 Oct 2018 23:38:18 +0000 (19:38 -0400)]
SRFI-19: Check for incompatible types in time comparisons.

Fixes <https://bugs.gnu.org/26163>.
Reported by Zefram <zefram@fysh.org>.

* module/srfi/srfi-19.scm (time-compare-check): New procedure.
(time=?): Use 'time-compare-check' to check the arguments and raise an
error in case of mismatched types.  Previously, mismatched types would
cause time=? to return #f.
(time>?, time<?, time>=?, time<=?, time-difference!): Use
'time-compare-check' to check the arguments.

6 years agoSRFI-19: Fix normalization of seconds and nanoseconds in time records.
Mark H Weaver [Sun, 21 Oct 2018 23:21:47 +0000 (19:21 -0400)]
SRFI-19: Fix normalization of seconds and nanoseconds in time records.

Fixes <https://bugs.gnu.org/26162>.
Reported by Zefram <zefram@fysh.org>.

* module/srfi/srfi-19.scm (time-normalize!): Rewrite.
* test-suite/tests/srfi-19.test: Add tests.

6 years agoSRFI-19: Add a few more tests.
Mark H Weaver [Sun, 21 Oct 2018 03:30:15 +0000 (23:30 -0400)]
SRFI-19: Add a few more tests.

This is a followup to commit a58c7abd72648f77e4ede5f62a2c4e7969bb7f95.

* test-suite/tests/srfi-19.test: Add tests for large positive years.

6 years agoSRFI-19: Fix handling of negative years and negative julian days.
Mark H Weaver [Sun, 21 Oct 2018 03:02:16 +0000 (23:02 -0400)]
SRFI-19: Fix handling of negative years and negative julian days.

Fixes <https://bugs.gnu.org/21906>.
Mitigates <https://bugs.gnu.org/21903> and <https://bugs.gnu.org/21904>.
Reported by: Zefram <zefram@fysh.org>.

* module/srfi/srfi-19.scm (encode-julian-day-number)
(decode-julian-day-number, date-week-number): Use 'floor-quotient'
instead of 'quotient', and 'floor' instead of 'truncate', where
appropriate.
(time-utc->date): Ensure that the 'nanoseconds' field of the returned
date is non-negative.
(leap-year): Handle negative years properly, and reformulate the
computation.
(week-day): Handle negative years properly.  Use 'floor-quotient'
instead of 'quotient' where appropriate.
(directives): In the handler for '~Y' format escapes, improve the
handling of years outside of the range 0-9999.
(read-directives): Add a FIXME comment to fix the '~Y' reader to handle
years outside of the range 0-9999.
* test-suite/tests/srfi-19.test: Import (srfi srfi-1).  Use Guile's
modern keyword notation in the 'define-module' form.  Add more tests.

6 years agoSRFI-19: Fix TAI->UTC conversions, leap second handling, etc.
Mark H Weaver [Sat, 20 Oct 2018 07:34:56 +0000 (03:34 -0400)]
SRFI-19: Fix TAI->UTC conversions, leap second handling, etc.

Fixes <https://bugs.gnu.org/21911>.
Fixes <https://bugs.gnu.org/22034>.
Fixes <https://bugs.gnu.org/21902>.
Partially fixes <https://bugs.gnu.org/21904>.
Reported by Zefram <zefram@fysh.org>.

* doc/ref/srfi-modules.texi (SRFI-19 Introduction): Fix the definitions
of Julian Day and Modified Julian Day.  Give the correct full names of
UTC and TAI.
* module/srfi/srfi-19.scm: Import (srfi srfi-1).  Use modern Guile
keyword syntax in the 'define-module' form.
(leap-second-neg-delta): New procedure, derived from a similar procedure
in the latest upstream SRFI-19 reference implementation.
(priv:time-tai->time-utc!, time-tai->julian-day)
(time-monotonic->julian-day): Use 'leap-second-neg-delta'.
(local-tz-offset): Fix comment.
(leap-second?): Remove.
(tai-before-leap-second?): New procedure, derived from upstream SRFI-19.
(time-utc->date): Use 'define*' to handle the optional argument.  Remove
the leap second handling, following upstream SRFI-19.
(time-tai->date): Rewrite in terms of 'time-utc->date'.  Add special
leap second handling, following upstream SRFI-19.
(time-monotonic->date): Rewrite in terms of 'time-tai->date'.
(date->time-tai, date->time-monotonic): Add special leap second
handling, following upstream SRFI-19.
(directives): In the entry for the "~Y" escape in 'date->string', pad
the year field to 4 characters, following upstream SRFI-19.
* test-suite/tests/srfi-19.test: Add tests.

6 years agoscm_seed_to_random_state: Support wide string arguments.
Mark H Weaver [Sat, 20 Oct 2018 01:54:34 +0000 (21:54 -0400)]
scm_seed_to_random_state: Support wide string arguments.

Partially fixes <https://bugs.gnu.org/33044>.
Reported by Tom de Vries <tdevries@suse.de>.

* libguile/random.c (scm_seed_to_random_state): Use 'scm_to_utf8_string'
(or 'scm_to_latin1_string' for a narrow string, for compatibility) to
convert the string into raw bytes for use by 'scm_c_make_rstate'.  Make
sure the length in bytes fits within an 'int'.

6 years agoFix typo in strings.h.
Mark H Weaver [Sat, 20 Oct 2018 01:52:39 +0000 (21:52 -0400)]
Fix typo in strings.h.

* libguile/strings.h: In a comment, add the missing "i_" in
"scm_i_is_narrow_string".

6 years agoFix type inferencing for 'nil?' and 'null?' predicates.
Mark H Weaver [Sun, 14 Oct 2018 03:02:05 +0000 (23:02 -0400)]
Fix type inferencing for 'nil?' and 'null?' predicates.

Fixes <https://bugs.gnu.org/33036>.
Reported by <calcium@disroot.org>.

* module/language/cps/types.scm (define-simple-type-inferrer):
Apply (logand (&type val) <>) uniformly.  Previously, this was done only
in the false branch.  Rename local variable to 'type*', to allow the
macro operand 'type' to be an arbitrary expression.
(*type-inferrers*)<null?>: Add &nil to the set of possible types.
(*type-inferrers*)<nil?>: Add &false and &null to the set the possible
types.
* module/language/cps/type-fold.scm (*branch-folders*)<null?>: Add &nil
to the set of possible types.
(*branch-folders*)<nil?>: Add &false and &null to the set the possible
types.
* test-suite/tests/compiler.test: Add tests.

6 years agoUse 'scm_from_utf8_{string,symbol,keyword}' for C string literals.
Mark H Weaver [Tue, 16 Oct 2018 06:34:18 +0000 (02:34 -0400)]
Use 'scm_from_utf8_{string,symbol,keyword}' for C string literals.

Partial fix for <https://bugs.gnu.org/33044>.
Reported by Tom de Vries <tdevries@suse.de>.

Fix several instances of the mistake of using 'scm_from_locale_*' for C
strings that originally came from a C string literal.  Change several
uses of 'scm_from_latin1_*' as well, to promote the practice of writing
code that works for arbitrary C string literals.

Also add missing years to the copyright notices of changed files, based
on the git history.

* libguile/debug-malloc.c, libguile/deprecation.c, libguile/error.c,
libguile/eval.c, libguile/expand.c, libguile/extensions.c,
libguile/filesys.c, libguile/init.c, libguile/load.c,
libguile/modules.c, libguile/pairs.c, libguile/posix.c,
libguile/print.c, libguile/random.c, libguile/read.c,
libguile/regex-posix.c, libguile/snarf.h, libguile/srfi-13.c,
libguile/stacks.c, libguile/stime.c, libguile/strports.c,
libguile/values.c: Use 'scm_from_utf8_*' where appropriate.

6 years agoFix typos, indentation and error reporting in SRFI-19.
Mark H Weaver [Tue, 16 Oct 2018 08:20:47 +0000 (04:20 -0400)]
Fix typos, indentation and error reporting in SRFI-19.

* module/srfi/srfi-19.scm: Fix typos in comments, indentation, and pass
the correct 'caller' name to 'time-error' in several places.

6 years agoUpdate SRFI-19 leap second table.
Mark H Weaver [Tue, 16 Oct 2018 06:50:30 +0000 (02:50 -0400)]
Update SRFI-19 leap second table.

* module/srfi/srfi-19.scm (leap-second-table): Update to include the
leap second on 1 January 2017.

6 years agoClarify the manual's "Processes" section.
Chris Marusich [Sun, 14 Oct 2018 07:47:23 +0000 (00:47 -0700)]
Clarify the manual's "Processes" section.

* doc/ref/posix.texi (Processes): Use the phrase "integer status value"
consistently, and add a cross-reference to the section of the glibc
manual that explains what it is.

6 years agoIn 'ash' and 'round-ash', handle right shift count of LONG_MIN.
Mark H Weaver [Sun, 14 Oct 2018 09:29:52 +0000 (05:29 -0400)]
In 'ash' and 'round-ash', handle right shift count of LONG_MIN.

Fixes <https://bugs.gnu.org/21901>.
Reported by Zefram <zefram@fysh.org>.

* libguile/numbers.c: Add another top-level 'verify' to ensure that
LONG_MIN is not a fixnum.
(scm_ash, scm_round_ash): Ensure that when the shift count is LONG_MIN,
it is not handled via the normal code path, to avoid signed overflow
when the shift count is negated.
* test-suite/tests/numbers.test: Add tests.