1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00
guile/module/system/vm
Michael Käppler 80d4055e42
Fix error messages containing format strings
The builtin primitive procedure `error` takes an optional message and
a list of arguments to include into the error message.
These args are formatted with `~S` and appended to the error message, so
that an example call of

`(error "Wrong argument: " 42)`

results in the output

"Wrong argument: 42"

If format strings occur in the message itself, however, they are
escaped. Thus a call like

`(error "Wrong argument: ~a" 42)`

is rendered as

"Wrong argument: ~a 42"

Some callers did not take this behavior into account, leading to
confusing error messages.
Changing the behavior of `error` to be
both backwards-compatible and accept also format strings inside messages
is not straightforward, because it would have to handle escaped `~`
characters as well. Therefore, fix `error` call sites using format
strings to use `format` before calling out to `error`.

The following files are affected:

* module/ice-9/format.scm (format)
* module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface)
* module/oop/goops.scm (make)
* module/srfi/srfi-37.scm (Comment at the beginning of file)
* module/system/base/compile.scm (call-once)
* module/system/repl/command.scm (break, tracepoint)
* module/system/repl/common.scm (repl-default-options)
* module/system/vm/traps.scm (arg-check, trap-at-source-location)

There are a couple of further call sites that were left unchanged,
either because they are using their own `error` procedure:

* module/ice-9/read.scm
* module/ice-9/command-line.scm

or are not referenced from other modules:

* module/system/base/lalr.upstream.scm:
* module/sxml/upstream/assert.scm:
* module/sxml/sxml-match.ss:

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-05-06 11:51:53 +02:00
..
assembler.scm Add logand/immediate, ulogand/immediate primcalls 2023-11-20 13:43:47 +01:00
coverage.scm Add missing #:modules argument for coverage-data->lcov. 2022-06-16 10:01:06 +02:00
debug.scm Fix frame-call-representation for callees without closures 2019-11-27 15:04:55 +01:00
disassembler.scm Better compilation of calls to raise-exception 2023-08-28 12:11:19 +02:00
dwarf.scm Remove unnecessary module imports. 2023-02-24 16:49:00 +01:00
elf.scm Remove unnecessary module imports. 2023-02-24 16:49:00 +01:00
frame.scm Remove unnecessary module imports. 2023-02-24 16:49:00 +01:00
inspect.scm Remove unnecessary module imports. 2023-02-24 16:49:00 +01:00
linker.scm linker: Create a sparse file only when writing to a file port. 2024-04-16 00:34:01 +02:00
loader.scm Rename objcodes?.{scm,c,h} to loader.{scm,c,h} 2013-11-19 21:45:07 +01:00
program.scm Remove unnecessary module imports. 2023-02-24 16:49:00 +01:00
trace.scm Remove unnecessary module imports. 2023-02-24 16:49:00 +01:00
trap-state.scm Remove unnecessary module imports. 2023-02-24 16:49:00 +01:00
traps.scm Fix error messages containing format strings 2024-05-06 11:51:53 +02:00
vm.scm VM manages hook sets itself 2018-09-14 08:52:24 +02:00