GNU bug report logs - #78013
[PATCH] guix: toml: Add missing escape pattern.

Previous Next

Package: guix-patches;

Reported by: Lars-Dominik Braun <lars <at> 6xq.net>

Date: Wed, 23 Apr 2025 14:10:03 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 78013 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#78013; Package guix-patches. (Wed, 23 Apr 2025 14:10:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lars-Dominik Braun <lars <at> 6xq.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 23 Apr 2025 14:10:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lars-Dominik Braun <lars <at> 6xq.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] guix: toml: Add missing escape pattern.
Date: Wed, 23 Apr 2025 16:08:52 +0200
* guix/build/toml.scm (eval-toml-file): Add missing mappings.
* tests/toml.scm ("parse-toml: String escapes"): Test all escapes from
the specification.

Change-Id: I135f6eebd8c7903eb6ebac1120c0ef071779f4ec
---
 guix/build/toml.scm | 2 ++
 tests/toml.scm      | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/guix/build/toml.scm b/guix/build/toml.scm
index a9be0887e7..7d8b7ed834 100644
--- a/guix/build/toml.scm
+++ b/guix/build/toml.scm
@@ -402,6 +402,8 @@ (define (eval-toml-file parse-tree)
                     (('escaped "b") "\b")
                     (('escaped "t") "\t")
                     (('escaped "n") "\n")
+                    (('escaped "f") "\f")
+                    (('escaped "r") "\r")
                     (('escaped (? (lambda (x) (>= (string-length x) 4)) u))
                      (list->string (list (integer->char (string->number u 16)))))
                     ((? string? s) s))
diff --git a/tests/toml.scm b/tests/toml.scm
index 64bc667f0c..083fafa526 100644
--- a/tests/toml.scm
+++ b/tests/toml.scm
@@ -97,6 +97,10 @@ (define-module (test-toml)
   '(("str" . "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."))
   (parse-toml "str = \"I'm a string. \\\"You can quote me\\\". Name\\tJos\\u00E9\\nLocation\\tSF.\""))
 
+(test-equal "parse-toml: String escapes"
+  '(("str" . "\b\t\n\f\r\"\\"))
+  (parse-toml "str = \"\\b\\t\\n\\f\\r\\\"\\\\\""))
+
 (test-equal "parse-toml: Empty string"
   '(("str1" . "")
     ("str2" . "")

base-commit: b12d44dd5e35ac236bf3fbb5619b9c8c2f42c902
-- 
2.49.0





This bug report was last modified 2 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.