* bug#49623: Guile 3.0.7 can't read #{{}}#
@ 2021-07-18 16:41 Maxime Devos
2021-07-18 18:16 ` bug#49623: [PATCH] Parse #{{}}# properly Maxime Devos
0 siblings, 1 reply; 5+ messages in thread
From: Maxime Devos @ 2021-07-18 16:41 UTC (permalink / raw)
To: 49623
[-- Attachment #1: Type: text/plain, Size: 586 bytes --]
Hi,
A scheme library I'm working on now fails to compile
after switching from 3.0.2 to Guile 3.0.7. The issue
is that Guile can't read #{{}}# anymore.
In guile 3.0.7:
scheme@(guile-user)> '#{{}}# }#
$1 = #{\x7b;\x7d;# }# ; the }# should result in a syntax error
scheme@(guile-user)> '#{{}}# ; this should work
...
; ^ guile is waiting for input
In guile 3.0.2:
scheme@(guile-user)> '#{{}}#
$1 = #{\x7b;\x7d;}# ; ok!
(Yes, I really name my variables like that sometimes.)
Note that #{{}a}# can be read just fine by both guile versions.
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#49623: [PATCH] Parse #{{}}# properly.
2021-07-18 16:41 bug#49623: Guile 3.0.7 can't read #{{}}# Maxime Devos
@ 2021-07-18 18:16 ` Maxime Devos
[not found] ` <188d4583d3c9a921e7bdc8556befc4c320b99dd6.camel@telenet.be>
0 siblings, 1 reply; 5+ messages in thread
From: Maxime Devos @ 2021-07-18 18:16 UTC (permalink / raw)
To: guile-patches; +Cc: 49623
[-- Attachment #1.1: Type: text/plain, Size: 239 bytes --]
Hi guilers,
This fixes bug #49623. I also added two additional test cases.
I'm rebuilding Guile right now and will re-run the entire test suite,
and I'll build the affected guile library with the fixed guile.
Greetings,
Maxime.
[-- Attachment #1.2: 0001-ice-9-read-Parse-properly.patch --]
[-- Type: text/x-patch, Size: 1858 bytes --]
From 9fb7cff1a2544aae3827db1a781be6e5c367d8c0 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@telenet.be>
Date: Sun, 18 Jul 2021 19:59:32 +0200
Subject: [PATCH] ice-9/read: Parse #{}}# properly.
This is a regression since Guile 3.0.2 and breaks compilation
of a Guile library.
* module/ice-9/read.scm
(%read)[read-parenthesized]: When 'saw-brace?' is #t, do not
reset 'saw-brace?' to #f if the current character is #\}.
* test-suite/tests/reader.test
("#{}#): Add two test cases.
---
module/ice-9/read.scm | 5 ++++-
test-suite/tests/reader.test | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/module/ice-9/read.scm b/module/ice-9/read.scm
index 72811fdb8..3fcc6ae50 100644
--- a/module/ice-9/read.scm
+++ b/module/ice-9/read.scm
@@ -570,7 +570,10 @@
(saw-brace?
(if (eqv? ch #\#)
'()
- (cons #\} (lp #f))))
+ ;; (eqv? ch #\}) is required instead of #f to allow for
+ ;; the trailing # to be preceded by two }, e.g.
+ ;; #{}}# or #{{a}}#. See <https://bug.gnu.org/XXX>.
+ (cons #\} (lp (eqv? ch #\})))))
((eqv? ch #\})
(lp #t))
((eqv? ch #\\)
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index ef11a4abd..134cb5ec3 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -508,6 +508,9 @@
(with-test-prefix "#{}#"
(pass-if (equal? (read-string "#{}#") '#{}#))
+ ;; ??? bugs.gnu.org
+ (pass-if (equal? (read-string "#{{}}#") (string->symbol "{}")))
+ (pass-if (equal? (read-string "#{{}b}#") (string->symbol "{}b")))
(pass-if (not (equal? (read-string "(a #{.}# b)") '(a . b))))
(pass-if (equal? (read-string "#{a}#") 'a))
(pass-if (equal? (read-string "#{a b}#") '#{a b}#))
--
2.32.0
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#49623: Fwd: [PATCH] Parse #{{}}# properly.
[not found] ` <188d4583d3c9a921e7bdc8556befc4c320b99dd6.camel@telenet.be>
@ 2021-07-18 19:47 ` Maxime Devos
[not found] ` <2fed32729a645814cc8912a5d767b209c8075ed6.camel@telenet.be>
1 sibling, 0 replies; 5+ messages in thread
From: Maxime Devos @ 2021-07-18 19:47 UTC (permalink / raw)
To: guile-devel; +Cc: 49623
[-- Attachment #1: Type: text/plain, Size: 121 bytes --]
It turns out that the test fails when the patch
is applies to guile@3.0.7. I'll rebase and try
to figure things out.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#49623: [PATCH v2] Parse #{{}}# properly.
[not found] ` <2fed32729a645814cc8912a5d767b209c8075ed6.camel@telenet.be>
@ 2021-07-20 10:54 ` Maxime Devos
[not found] ` <71e366c5e151d73c9b9a33345833f379d4c6d4f5.camel@telenet.be>
1 sibling, 0 replies; 5+ messages in thread
From: Maxime Devos @ 2021-07-20 10:54 UTC (permalink / raw)
To: guile-devel; +Cc: 49623
[-- Attachment #1.1: Type: text/plain, Size: 298 bytes --]
Maxime Devos schreef op zo 18-07-2021 om 21:47 [+0200]:
> It turns out that the test fails when the patch
> is applies to guile@3.0.7. I'll rebase and try
> to figure things out.
With the revised patch, tests succeed and the Guile
library now compiles successfully.
Greetings,
Maxime.
[-- Attachment #1.2: 0001-ice-9-read-Parse-properly.patch --]
[-- Type: text/x-patch, Size: 2127 bytes --]
From 40b0b29c05d521cd8901988fa2bc71547f917f48 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@telenet.be>
Date: Sun, 18 Jul 2021 19:59:32 +0200
Subject: [PATCH] ice-9/read: Parse #{}}# properly.
This is a regression since Guile 3.0.2 and breaks compilation
of a Guile library.
* module/ice-9/read.scm
(%read)[read-parenthesized]: When SAW-BRACE? is #t but CH isn't
#\#, don't eat CH.
* test-suite/tests/reader.test
("#{}#): Add four test cases.
---
module/ice-9/read.scm | 7 +++++--
test-suite/tests/reader.test | 5 +++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/module/ice-9/read.scm b/module/ice-9/read.scm
index ac407739f..283933064 100644
--- a/module/ice-9/read.scm
+++ b/module/ice-9/read.scm
@@ -556,12 +556,15 @@
(string->symbol
(list->string
(let lp ((saw-brace? #f))
- (let ((ch (next-not-eof)))
+ (let lp/inner ((ch (next-not-eof))
+ (saw-brace? saw-brace?))
(cond
(saw-brace?
(if (eqv? ch #\#)
'()
- (cons #\} (lp #f))))
+ ;; Don't eat CH, see
+ ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49623>.
+ (cons #\} (lp/inner ch #f))))
((eqv? ch #\})
(lp #t))
((eqv? ch #\\)
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index 1481a0a5d..ad7c6d575 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -536,6 +536,11 @@
(with-test-prefix "#{}#"
(pass-if (equal? (read-string "#{}#") '#{}#))
+ ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49623>
+ (pass-if (equal? (read-string "#{}}#") (string->symbol "}")))
+ (pass-if (equal? (read-string "#{}}}#") (string->symbol "}}")))
+ (pass-if (equal? (read-string "#{{}}#") (string->symbol "{}")))
+ (pass-if (equal? (read-string "#{{}b}#") (string->symbol "{}b")))
(pass-if (not (equal? (read-string "(a #{.}# b)") '(a . b))))
(pass-if (equal? (read-string "#{a}#") 'a))
(pass-if (equal? (read-string "#{a b}#") '#{a b}#))
--
2.32.0
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#49623: [PATCH v2] Parse #{{}}# properly.
[not found] ` <71e366c5e151d73c9b9a33345833f379d4c6d4f5.camel@telenet.be>
@ 2021-08-02 16:37 ` lloda
0 siblings, 0 replies; 5+ messages in thread
From: lloda @ 2021-08-02 16:37 UTC (permalink / raw)
To: Maxime Devos; +Cc: 49623-done, guile-devel
[-- Attachment #1: Type: text/plain, Size: 448 bytes --]
Applied in c78c130b1ddef6d6c290533f74ce1fbd51a4b19d. Thank you!
> On 20 Jul 2021, at 12:54, Maxime Devos <maximedevos@telenet.be> wrote:
>
> Maxime Devos schreef op zo 18-07-2021 om 21:47 [+0200]:
>> It turns out that the test fails when the patch
>> is applies to guile@3.0.7. I'll rebase and try
>> to figure things out.
>
> With the revised patch, tests succeed and the Guile
> library now compiles successfully.
>
> Greetings,
> Maxime.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ice-9-read-Parse-properly.patch --]
[-- Type: text/x-patch; x-unix-mode=0644; name="0001-ice-9-read-Parse-properly.patch", Size: 2186 bytes --]
From 40b0b29c05d521cd8901988fa2bc71547f917f48 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@telenet.be>
Date: Sun, 18 Jul 2021 19:59:32 +0200
Subject: [PATCH] ice-9/read: Parse #{}}# properly.
This is a regression since Guile 3.0.2 and breaks compilation
of a Guile library.
* module/ice-9/read.scm
(%read)[read-parenthesized]: When SAW-BRACE? is #t but CH isn't
#\#, don't eat CH.
* test-suite/tests/reader.test
("#{}#): Add four test cases.
---
module/ice-9/read.scm | 7 +++++--
test-suite/tests/reader.test | 5 +++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/module/ice-9/read.scm b/module/ice-9/read.scm
index ac407739f..283933064 100644
--- a/module/ice-9/read.scm
+++ b/module/ice-9/read.scm
@@ -556,12 +556,15 @@
(string->symbol
(list->string
(let lp ((saw-brace? #f))
- (let ((ch (next-not-eof)))
+ (let lp/inner ((ch (next-not-eof))
+ (saw-brace? saw-brace?))
(cond
(saw-brace?
(if (eqv? ch #\#)
'()
- (cons #\} (lp #f))))
+ ;; Don't eat CH, see
+ ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49623>.
+ (cons #\} (lp/inner ch #f))))
((eqv? ch #\})
(lp #t))
((eqv? ch #\\)
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index 1481a0a5d..ad7c6d575 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -536,6 +536,11 @@
(with-test-prefix "#{}#"
(pass-if (equal? (read-string "#{}#") '#{}#))
+ ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49623>
+ (pass-if (equal? (read-string "#{}}#") (string->symbol "}")))
+ (pass-if (equal? (read-string "#{}}}#") (string->symbol "}}")))
+ (pass-if (equal? (read-string "#{{}}#") (string->symbol "{}")))
+ (pass-if (equal? (read-string "#{{}b}#") (string->symbol "{}b")))
(pass-if (not (equal? (read-string "(a #{.}# b)") '(a . b))))
(pass-if (equal? (read-string "#{a}#") 'a))
(pass-if (equal? (read-string "#{a b}#") '#{a b}#))
--
2.32.0
[-- Attachment #3: Type: text/plain, Size: 1 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-02 16:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-18 16:41 bug#49623: Guile 3.0.7 can't read #{{}}# Maxime Devos
2021-07-18 18:16 ` bug#49623: [PATCH] Parse #{{}}# properly Maxime Devos
[not found] ` <188d4583d3c9a921e7bdc8556befc4c320b99dd6.camel@telenet.be>
2021-07-18 19:47 ` bug#49623: Fwd: " Maxime Devos
[not found] ` <2fed32729a645814cc8912a5d767b209c8075ed6.camel@telenet.be>
2021-07-20 10:54 ` bug#49623: [PATCH v2] " Maxime Devos
[not found] ` <71e366c5e151d73c9b9a33345833f379d4c6d4f5.camel@telenet.be>
2021-08-02 16:37 ` lloda
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).