unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#48089: Guile 3.0.6 returns zero-indexed locations for ‘read-error’
@ 2021-04-28 22:33 Ludovic Courtès
  2021-04-29  9:33 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2021-04-28 22:33 UTC (permalink / raw)
  To: 48089

Hi,

Guile 3.0.6 returns zero-indexed (instead of one-indexed) source code
locations for ‘read-error’.  Here’s a 3.0.6/3.0.5 comparison:

--8<---------------cut here---------------start------------->8---
$ /gnu/store/r2nr74rwhpqg16y1lyi6l0jn3lwx4yyz-guile-3.0.6/bin/guile  <(echo '(')
ice-9/read.scm:126:4: In procedure lp:
/dev/fd/63:1:0: unexpected end of input while searching for: )
$ guile  <(echo '(')
ERROR: In procedure primitive-load:
In procedure scm_i_lreadparen: /dev/fd/63:2:1: end of file
--8<---------------cut here---------------end--------------->8---

Ludo’.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#48089: Guile 3.0.6 returns zero-indexed locations for ‘read-error’
  2021-04-28 22:33 bug#48089: Guile 3.0.6 returns zero-indexed locations for ‘read-error’ Ludovic Courtès
@ 2021-04-29  9:33 ` Ludovic Courtès
  2021-04-29 20:04   ` Andy Wingo
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2021-04-29  9:33 UTC (permalink / raw)
  To: 48089

[-- Attachment #1: Type: text/plain, Size: 559 bytes --]

Ludovic Courtès <ludo@gnu.org> skribis:

> Guile 3.0.6 returns zero-indexed (instead of one-indexed) source code
> locations for ‘read-error’.  Here’s a 3.0.6/3.0.5 comparison:
>
> $ /gnu/store/r2nr74rwhpqg16y1lyi6l0jn3lwx4yyz-guile-3.0.6/bin/guile  <(echo '(')
> ice-9/read.scm:126:4: In procedure lp:
> /dev/fd/63:1:0: unexpected end of input while searching for: )
> $ guile  <(echo '(')
> ERROR: In procedure primitive-load:
> In procedure scm_i_lreadparen: /dev/fd/63:2:1: end of file

Here’s a test case waiting to succeed!  :-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 835 bytes --]

diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index fad531b39..231e69553 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -212,6 +212,18 @@
 
 \f
 (with-test-prefix "mismatching parentheses"
+  (pass-if-equal "read-error location"
+      '("foo.scm:3:1: unexpected end of input while searching for: ~A" #\))
+    (catch 'read-error
+      (lambda ()
+        ;; The missing closing paren error should be located on line 3,
+        ;; column 1 (one-indexed).
+        (call-with-input-string "\n    (hi there!\n"
+          (lambda (port)
+            (set-port-filename! port "foo.scm")
+            (read port))))
+      (lambda (key proc message args . _)
+        (cons message args))))
   (pass-if-exception "opening parenthesis"
     exception:eof
     (read-string "("))

[-- Attachment #3: Type: text/plain, Size: 12 bytes --]


Ludo’.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#48089: Guile 3.0.6 returns zero-indexed locations for ‘read-error’
  2021-04-29  9:33 ` Ludovic Courtès
@ 2021-04-29 20:04   ` Andy Wingo
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2021-04-29 20:04 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 48089-done

Done :)

On Thu 29 Apr 2021 11:33, Ludovic Courtès <ludo@gnu.org> writes:

> Ludovic Courtès <ludo@gnu.org> skribis:
>
>> Guile 3.0.6 returns zero-indexed (instead of one-indexed) source code
>> locations for ‘read-error’.  Here’s a 3.0.6/3.0.5 comparison:
>>
>> $ /gnu/store/r2nr74rwhpqg16y1lyi6l0jn3lwx4yyz-guile-3.0.6/bin/guile  <(echo '(')
>> ice-9/read.scm:126:4: In procedure lp:
>> /dev/fd/63:1:0: unexpected end of input while searching for: )
>> $ guile  <(echo '(')
>> ERROR: In procedure primitive-load:
>> In procedure scm_i_lreadparen: /dev/fd/63:2:1: end of file
>
> Here’s a test case waiting to succeed!  :-)
>
> diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
> index fad531b39..231e69553 100644
> --- a/test-suite/tests/reader.test
> +++ b/test-suite/tests/reader.test
> @@ -212,6 +212,18 @@
>  
>  \f
>  (with-test-prefix "mismatching parentheses"
> +  (pass-if-equal "read-error location"
> +      '("foo.scm:3:1: unexpected end of input while searching for: ~A" #\))
> +    (catch 'read-error
> +      (lambda ()
> +        ;; The missing closing paren error should be located on line 3,
> +        ;; column 1 (one-indexed).
> +        (call-with-input-string "\n    (hi there!\n"
> +          (lambda (port)
> +            (set-port-filename! port "foo.scm")
> +            (read port))))
> +      (lambda (key proc message args . _)
> +        (cons message args))))
>    (pass-if-exception "opening parenthesis"
>      exception:eof
>      (read-string "("))
>
>
> Ludo’.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-29 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 22:33 bug#48089: Guile 3.0.6 returns zero-indexed locations for ‘read-error’ Ludovic Courtès
2021-04-29  9:33 ` Ludovic Courtès
2021-04-29 20:04   ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).