Subject: bug#67412: [PATCH 1/2] Use R7RS 'rename' syntax for exports.

From: Maxim Cournoyer <[email-masked]>
Date: Fri, 24 Nov 2023 11:39:29 -0500

From: Timothy Sample <[email-masked]>

* module/ice-9/r7rs-libraries.scm (define-library): Convert R7RS
exports to R6RS exports before passing them on to 'library'.

Fixes: https://bugs.gnu.org/67255
Reported-by: Maxim Cournoyer <[email-masked]>.
---

 module/ice-9/r7rs-libraries.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/module/ice-9/r7rs-libraries.scm b/module/ice-9/r7rs-libraries.scm
index 63a300a26..f8b6b4c59 100644
--- a/module/ice-9/r7rs-libraries.scm
+++ b/module/ice-9/r7rs-libraries.scm
@@ -1,5 +1,5 @@
 ;; R7RS library support
-;;      Copyright (C) 2020, 2021 Free Software Foundation, Inc.
+;;      Copyright (C) 2020, 2021, 2023 Free Software Foundation, Inc.
 ;;
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -97,12 +97,17 @@
            ((decl ...)
             (partition-decls #'(decl ... . decls) exports imports code))))))
 
+    (define (r7rs-export->r6rs-export export)
+      (syntax-case export (rename)
+        ((rename internal external) #'(rename (internal external)))
+        (_ export)))
+
     (syntax-case stx ()
       ((_ name decl ...)
        (call-with-values (lambda ()
                            (partition-decls #'(decl ...) '() '() '()))
          (lambda (exports imports code)
            #`(library name
-               (export . #,exports)
+               (export . #,(map r7rs-export->r6rs-export exports))
                (import . #,imports)
                . #,code)))))))

base-commit: d579848cb5d65440af5afd9c8968628665554c22
-- 
2.41.0