bug#41956: [PATCH] ice-9: exceptions: Properly format the error message.
Maxim Cournoyer writes: > Hello, > > I had this problem in Guix where 'guix deploy my-config.scm' would > unhelpfully report an error like: > > guix deploy: error: failed to deploy my-host: ~A: ~S > > Digging a bit, I could reproduce at the REPL with: > > (guard (c ((message-condition? c) >(format #t "error: ~a~%" (condition-message c > ;; This is what (canonicalize-path "/do/not/exist) ends up doing: > (throw 'system-error "canonicalize-path" "~A" '("No such file or > directory"))) > > --> error: ~A [...] Unfortunately the previous patch breaks the tests, with errors like: ERROR: bytevectors.test: Datum Syntax: incorrect prefix - arguments: ((wrong-type-arg "apply" "Apply to non-list: ~S" (#\i) (#\i))) I'm out of ideas for now, I last tried: --8<---cut here---start->8--- modified module/ice-9/exceptions.scm @@ -189,7 +189,10 @@ ((subr msg margs . _) (make-exception (make-exception-with-origin subr) -(make-exception-with-message msg) +(let ((msg (if (null? margs) + msg + (apply simple-format #f msg margs +(make-exception-with-message msg)) (make-exception-with-irritants margs))) (_ (make-exception-with-irritants args))) args)) --8<---cut here---end--->8--- To the same effect. Maxim
bug#41956: [PATCH] ice-9: exceptions: Properly format the error message.
Hello, I had this problem in Guix where 'guix deploy my-config.scm' would unhelpfully report an error like: guix deploy: error: failed to deploy my-host: ~A: ~S Digging a bit, I could reproduce at the REPL with: --8<---cut here---start->8--- (guard (c ((message-condition? c) (format #t "error: ~a~%" (condition-message c ;; This is what (canonicalize-path "/do/not/exist) ends up doing: (throw 'system-error "canonicalize-path" "~A" '("No such file or directory"))) --> error: ~A --8<---cut here---end--->8--- It seems our native -> srfi-34 style exception converter should populate the message field with a formatted message, given that's what happens to present errors as explained in libguile/error.c: When an error is reported,\n "these are replaced by formatting the corresponding members of\n" "@var{args}: @code{~A} (was @code{%s} in older versions of\n" "Guile) formats using @code{display} and @code{~S} I'm not sure about the second ~S that appeared in the Guix output; possibly the exception got re-thrown and suffered from a slightly different conversion problem? Anyway, the simple patch attached should fix the "~A" exception message. Thank you, Maxim >From adaa2f66fec7684e9e65491158afc5923613e3da Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Fri, 19 Jun 2020 14:30:05 -0400 Subject: [PATCH] ice-9: exceptions: Properly format the error message. Before this change, native exceptions such as system errors caught with srfi-34's `guard' would be converted to an exception with its message unhelpfully set to "~A". Thus, apply the message arguments to the message format to derive a human readable exception message. * module/ice-9/exceptions.scm (guile-common-exceptions): Format the message string using its arguments. --- module/ice-9/exceptions.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/ice-9/exceptions.scm b/module/ice-9/exceptions.scm index 143e7aa3e..c990790e9 100644 --- a/module/ice-9/exceptions.scm +++ b/module/ice-9/exceptions.scm @@ -189,7 +189,7 @@ ((subr msg margs . _) (make-exception (make-exception-with-origin subr) -(make-exception-with-message msg) +(make-exception-with-message (apply format #f msg margs)) (make-exception-with-irritants margs))) (_ (make-exception-with-irritants args))) args)) -- 2.26.2
bug#40737: Segfault in arm gcc7, thumb2 builroot, with arm patch
Here is the start of a case to go in tests/movi.c: #include "test.h" // Should really test all of the cases seen in // arm-cpu.c: encode_thumb_immediate() /* abcdefgh */ /* abcdefgh abcdefgh */ /* abcdefgh abcdefgh */ /* abcdefgh abcdefgh abcdefgh abcdefgh */ /* 1bcdefgh
bug#40737: Segfault in arm gcc7, thumb2 builroot, with arm patch
Patch attached. -- Andrew. diff --git a/libguile/lightening/lightening/arm-cpu.c b/libguile/lightening/lightening/arm-cpu.c index 4445266af..2b4eecc29 100644 --- a/libguile/lightening/lightening/arm-cpu.c +++ b/libguile/lightening/lightening/arm-cpu.c @@ -230,7 +230,7 @@ encode_thumb_immediate(unsigned int v) return ((v & 0xff) | (1 << 12)); /* abcdefgh abcdefgh */ if (((v & 0x) >> 16) == (v & 0x) && (v & 0xff) == 0) -return ((v & 0x00ff) | (2 << 12)); +return (((v & 0xff00) >> 8) | (2 << 12)); /* abcdefgh abcdefgh abcdefgh abcdefgh */ if ( (v &0xff)== ((v & 0xff00) >> 8) && ((v & 0xff00) >> 8) == ((v & 0xff) >> 16) &&