* module/system/base/target.scm (cpu-endianness): Add case for "riscv" variants.
Signed-off-by: Shea Levy <shea@shealevy.com>
Signed-off-by: Mark H Weaver <mhw@netris.org>
* module/rnrs/io/ports.scm (open-string-output-port): Calling the
get-string proc should flush the buffer and reset the file position.
* test-suite/tests/r6rs-ports.test ("8.2.10 Output ports"): Add tests.
Thanks to Freja Nordsiek for the report.
(cherry picked from commit e13cd5c77c)
* libguile/vm-i-system.c (bind-kwargs):
* libguile/vm.c (vm_error_kwargs_missing_value):
* libguile/eval.c (error_missing_value)
(prepare_boot_closure_env_for_apply): Adapt to mirror VM behavior.
* libguile/keywords.c (scm_c_bind_keyword_arguments): Likewise.
* module/ice-9/eval.scm (primitive-eval): Update to error on (foo #:kw)
with a "Keyword argument has no value" instead of the horrible "odd
argument list length". Also adapts to the expected args format for
the keyword-argument-error exception printer in all cases. Matches
1.8 optargs behavior also.
* test-suite/standalone/test-scm-c-bind-keyword-arguments.c (test_missing_value):
(missing_value_error_handler): Update test.
* test-suite/tests/optargs.test: Add tests.
This feature was removed by 4aead68cdb.
* module/ice-9/i18n.scm (number-decimal-string): Rewrite the case where
DIGIT-COUNT is not an integer.
(number->locale-string): Always pass FRACTION-DIGITS to
'number-decimal-string'.
* test-suite/tests/format.test ("~h localized number")["1234.5"]
["padding", "padchar"]: Remove decimal specifier.
* test-suite/tests/i18n.test ("number->locale-string")
["fraction",
* test-suite/tests/i18n.test ("format ~h")["12 345,678"]: Remove decimal
specifier. Remove one decimal.
* doc/ref/api-i18n.texi (Number Input and Output): Update
'number->locale-string' doc to mention the number of decimals.
Fixes <http://bugs.gnu.org/24990>.
Reported by Martin Michel <dev@famic.de>.
* module/ice-9/i18n.scm (integer->string, number-decimal-string): New
procedures.
(monetary-amount->locale-string): Use them instead of 'number->string'
followed by 'string-split'.
(number->locale-string): Likewise.
* test-suite/tests/i18n.test ("number->locale-string")["fraction"]: Add
second argument to 'number->locale-string'.
["fraction, 1 digit"]: Round up.
["fraction, 10 digits", "trailing zeros", "negative integer"]: New
tests.
* test-suite/tests/i18n.test ("format ~h"): Pass the number of decimals
for ~h.
("monetary-amount->locale-string")["French"]: Always expect two decimals
after the comma.
["one cent", "very little money"]: New tests.
* test-suite/tests/format.test ("~h localized number")["1234.5"]:
Specify the number of decimals explicitly.
["padding"]: Expect zero decimals.
["padchar"]: Ask for one decimal.
["decimals", "locale"]: Adjust rounding.
* module/system/base/target.scm (cpu-endianness, triplet-pointer-size):
Add case for "sh3".
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Fixes <http://bugs.gnu.org/20272>.
* module/ice-9/boot-9.scm (module-generate-unique-id!)
(module-gensym): New procedures.
(module): Add 'next-unique-id' field.
(the-root-module): Inherit 'next-unique-id' value from early stub.
(make-module, make-autoload-interface): Adjust calls to
module-constructor.
* module/ice-9/psyntax.scm (gen-label, new-mark): Generate unique
identifiers from the module name and the per-module unique-id.
(build-lexical-var, generate-temporaries): Use
'module-gensym' instead of 'gensym'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/language/tree-il/fix-letrec.scm (fix-letrec!): Use
'module-gensym' instead of 'gensym'.
* module/system/base/syntax.scm (define-record): Likewise.
(transform-record): Likewise.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Reported by Christopher Allan Webber <cwebber@dustycloud.org>
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit adds protection to Guile's REPL servers against HTTP
inter-protocol exploitation attacks, a scenario whereby an attacker can,
via an HTML page, cause a web browser to send data to TCP servers
listening on a loopback interface or private network. See
<https://en.wikipedia.org/wiki/Inter-protocol_exploitation> and
<https://www.jochentopf.com/hfpa/hfpa.pdf>, The HTML Form Protocol
Attack (2001) by Tochen Topf <jochen@remote.org>.
Here we add a procedure to 'before-read-hook' that looks for a possible
HTTP request-line in the first line of input from the client socket. If
present, the socket is drained and closed, and a loud warning is written
to stderr (POSIX file descriptor 2).
* module/system/repl/server.scm: Add 'maybe-check-for-http-request'
to 'before-read-hook' when this module is loaded.
(with-temporary-port-encoding, with-saved-port-line+column)
(drain-input-and-close, permissive-http-request-line?)
(check-for-http-request, guard-against-http-request)
(maybe-check-for-http-request): New procedures.
(serve-client): Use 'guard-against-http-request'.
* module/system/repl/coop-server.scm (start-repl-client): Use
'guard-against-http-request'.
* doc/ref/guile-invoke.texi (Command-line Options): In the description
of the --listen option, make the security warning more prominent.
Mention the new protection added here. Recommend using UNIX domain
sockets for REPL servers. "a path to" => "the file name of".
* m4/mkstemp.m4: Remove.
* lib/mkstemp.c: Remove.
* lib/mkostemp.c: New file.
* m4/mkostemp.m4: New file.
* lib/Makefile.am:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4: Remove mkstemp module, replace with mkostemp.
* libguile/fports.h:
* libguile/fports.c (scm_i_mode_to_open_flags): Factor out helper to
parse mode string to open flags.
(scm_open_file_with_encoding): Use the new helper.
* libguile/filesys.c:
(scm_i_mkstemp): Adapt to take optional second argument, being a mode
string. Use mkostemp.
(scm_mkstemp): Backwards compatible shim that calls scm_i_mkstemp.
* doc/ref/posix.texi:
* NEWS: Update.
* module/system/base/compile.scm (call-with-output-file/atomic): Pass
"wb" as mode, to cause O_BINARY to be added on MinGW.
* module/language/tree-il/peval.scm (<operand>): Rename "alias-value"
field to "alias", which is now an operand and not an expression.
This allows the operand to capture its environment; before, the
alias was being visited in its use environment instead of its
definition environment.
(peval): Adapt to operand change.
* test-suite/tests/peval.test ("partial evaluation"): New test.
* module/ice-9/boot-9.scm (map, for-each): Move definition up before
loading r4rs.go. Before, when r4rs.go was being loaded, there was a
window in which "catch" defined in Scheme used with-fluids before
"map" was defined, but if "with-fluids" in eval.scm uses "map". That
would lead to the inability to catch errors (stack overflow) if
`catch' was used in that window -- which it now is, due to the "skip
invalid .go files" patch.
* module/ice-9/boot-9.scm (current-warning-port):
* libguile/init.c (scm_init_standard_ports):
* libguile/ports.c (cur_warnport_fluid, scm_current_warning_port)
(scm_set_current_warning_port, scm_init_ports): Define the warning
port in the same way as the error/output/input ports, with a fluid
that doesn't require calling out to Scheme.
* meta/build-env.in: New file which sets up an environment that does not
inherit GUILE_LOAD_PATH / GUILE_LOAD_COMPILED_PATH (unless
cross-compiling).
* doc/ref/Makefile.am (autoconf-macros.texi):
* libguile/Makefile.am (snarf2checkedtexi):
* module/Makefile.am (ice-9/psyntax-pp.go):
* test-suite/standalone/Makefile.am (GUILE_INSTALL_LOCALE):
* am/guilec (.scm.go): Use build-env.
* configure.ac: Create build-env.
* libguile/load.c (load_thunk_from_path, try_load_thunk_from_file):
New functions.
(search_path): Simplify.
(scm_primitive_load_path, scm_init_eval_in_scheme): Use the new
functions to load compiled files.
* module/ice-9/boot-9.scm (load-in-vicinity): Skip invalid .go files.
Inspired by a patch from Jan Nieuwenhuizen <janneke@gnu.org>.
* module/texinfo/html.scm (itemize, acronym, tag-replacements, rules):
Fix HTML serialization of @itemize and @acronym. Fixes#21772.
* test-suite/tests/texinfo.html.test: New file.
* test-suite/Makefile.am: Add new file.
* module/language/tree-il/effects.scm (make-effects-analyzer):
Fix analysis for list, cons, make-prompt-tage, and vector; &allocation
is a `cause' effect. Fixes#21899.
* test-suite/tests/cse.test ("cse"): Add test case.
* module/system/base/compile.scm (call-with-output-file/atomic): Use the
permissions of the source file, if available, as the permissions of
the compiled file. Fixes#18477.
* module/language/tree-il/peval.scm (peval): Always evaluate the body in
values context, as a captured continuation could continue to a
continuation of any arity. However the handler, if it returns, does
return to the prompt's continuation. Fixes#14347. Thanks to Jussi
Piitulainen for the report.
* test-suite/tests/control.test ("shift and reset"): Add a test.
Fixes <http://bugs.gnu.org/23421>.
Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>.
* module/web/http.scm (parse-rfc-822-date): Add two clauses for hours
with a leading space.
* test-suite/tests/web-http.test ("general headers"): Add two tests.
For a long time the API failed to reach consensus among maintainers.
See <https://lists.gnu.org/archive/html/guile-devel/2015-11/msg00005.html>
and <https://lists.gnu.org/archive/html/guile-devel/2014-04/msg00069.html>.
This revert intends to break the deadlock and help further discussion to
take place with less pressure.
* libguile/foreign-object.c, libguile/foreign-object.h: Remove.
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES)
(modinclude_HEADERS): Adjust accordingly.
* libguile/init.c (scm_i_init_guile): Remove call to
'scm_register_foreign_object'.
* libguile.h: Remove inclusion of "libguile/foreign-object.h".
* module/system/foreign-object.scm: Remove.
* module/Makefile.am (SYSTEM_SOURCES): Adjust accordingly.
* test-suite/standalone/test-foreign-object-c.c,
test-suite/standalone/test-foreign-object-scm: Remove.
* test-suite/standalone/Makefile.am (check_SCRIPTS, check_PROGRAMS)
(TESTS): Adjust accordingly.
(test_foreign_object_c_SOURCES, test_foreign_object_c_CFLAGS)
(test_foreign_object_c_LDADD): Remove.
* doc/ref/libguile-foreign-objects.texi: Remove.
* doc/ref/api-foreign-objects.texi: Remove.
* doc/ref/libguile-smobs.texi: New file.
* doc/ref/Makefile.am (guile_TEXINFOS): Adjust accordingly.
* doc/ref/api-control.texi, doc/ref/api-smobs.texi,
doc/ref/api-utility.texi, doc/ref/guile.texi,
doc/ref/libguile-concepts.texi, doc/ref/libguile-program.texi:
Revert d9a4a1cd and 6e4630e0.
* module/web/http.scm (parse-entity-tag): Be less strict, accepting
unquoted strings as well.
* test-suite/tests/web-http.test ("response headers"): Add a test for
etag parsing.
* doc/ref/guile.texi: Add 2016 to user-visible copyright notice.
* module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to
2016.
* module/system/repl/common.scm (*version*): Add 2016 to the range of
copyright years.
Fixes <http://bugs.gnu.org/22273>.
Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>.
* module/web/http.scm (read-header-line): New procedure.
(read-response-line): Use it instead of 'read-line*'.
* test-suite/tests/web-http.test ("read-response-line"): Add test.
* module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to
2015.
* module/system/repl/common.scm (*version*): Add 2015 to the range of
copyright years.
Adds an implementation of SRFI 25 on top of Guile's native arrays. The
implementation does not introduce a disjoint type; Guile arrays and
SRFI-25 arrays can be used interchangably, though with different, partly
conflicting APIs.
* NEWS: Add preliminary, incomplete section on 2.0.12, noting the
addition of SRFI-25.
* doc/ref/srfi-modules.texi (SRFI-25): New node.
* module/srfi/srfi-25.scm: New file.
* test-suite/tests/srfi-25.test: New file.
* module/Makefile.am:
* test-suite/Makefile.am: Add new files.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* module/web/response.scm (make-delimited-input-port)[close]: Replace
erroneous self-recursive call with a call to 'close-port'.
* test-suite/tests/web-response.test ("example-1")["response-body-port +
close"]: New test.
Reported by Panicz Maciej Godek <godek.maciek@gmail.com> in
<http://lists.gnu.org/archive/html/guile-user/2015-09/msg00017.html>.
* module/ice-9/psyntax.scm (match-each+): Fix the case where a non-pair
syntax object is encountered in a dotted tail.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/system/base/types.scm (cell->object): Use 'get-bytevector-n'
instead of 'get-bytevector-all', so that the zero-length case does not
return EOF.
The now obsolete RFC2616 section 14.30 required that the Location
header be an absoluteURI, but RFC7231 section 7.1.2 allows it to
contain any URI-reference.
* module/web/http.scm: Use 'declare-relative-uri-header!' to declare
the "Location" header.