[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/34: bournish: Prevent inlining of run-time support procedures.
From: |
guix-commits |
Subject: |
01/34: bournish: Prevent inlining of run-time support procedures. |
Date: |
Thu, 2 Apr 2020 10:07:25 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 3b4d7cdccce97dbffee538812c86bc03a6ae35d9
Author: Ludovic Courtès <address@hidden>
AuthorDate: Thu Apr 2 14:17:36 2020 +0200
bournish: Prevent inlining of run-time support procedures.
On Guile 3, those procedures could be inlined, leading to
unbound-variable errors:
scheme@(guile-user)> ,bournish
Welcome to Bournish, a minimal Bourne-like shell!
To switch back, type `,L scheme'.
bournish@(guile-user)> ls
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Unbound variable: ls-command-implementation
Reported by Ricardo Wurmus.
* guix/build/bournish.scm (define-command-runtime): New macro.
(ls-command-implementation, wc-command-implementation)
(wc-l-command-implementation, wc-c-command-implementation): Use it
instead of 'define'.
---
guix/build/bournish.scm | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/guix/build/bournish.scm b/guix/build/bournish.scm
index 247a687..31fc493 100644
--- a/guix/build/bournish.scm
+++ b/guix/build/bournish.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016, 2017 Ludovic Courtès <address@hidden>
+;;; Copyright © 2016, 2017, 2020 Ludovic Courtès <address@hidden>
;;; Copyright © 2016 Efraim Flashner <address@hidden>
;;; Copyright © 2017 Ricardo Wurmus <address@hidden>
;;;
@@ -83,7 +83,21 @@ TERMINAL-WIDTH. Use COLUMN-GAP spaces between two
subsequent columns."
(newline)
(loop (map 1+ indexes)))))
-(define ls-command-implementation
+(define-syntax define-command-runtime
+ (syntax-rules ()
+ "Define run-time support of a Bournish command. This macro ensures that
+the implementation is not subject to inlining, which would prevent compiled
+code from referring to it via '@@'."
+ ((_ (command . args) body ...)
+ (define-command-runtime command (lambda args body ...)))
+ ((_ command exp)
+ (begin
+ (define command exp)
+
+ ;; Prevent inlining of COMMAND.
+ (set! command command)))))
+
+(define-command-runtime ls-command-implementation
;; Run-time support procedure.
(case-lambda
(()
@@ -173,13 +187,13 @@ TERMINAL-WIDTH. Use COLUMN-GAP spaces between two
subsequent columns."
(call-with-input-file file lines+chars)))
(format #t "~a ~a~%" chars file)))
-(define (wc-command-implementation . files)
+(define-command-runtime (wc-command-implementation . files)
(for-each wc-print (filter file-exists?* files)))
-(define (wc-l-command-implementation . files)
+(define-command-runtime (wc-l-command-implementation . files)
(for-each wc-l-print (filter file-exists?* files)))
-(define (wc-c-command-implementation . files)
+(define-command-runtime (wc-c-command-implementation . files)
(for-each wc-c-print (filter file-exists?* files)))
(define (wc-command . args)
- 07/34: gnu: mate-settings-daemon: Update to 1.24.0., (continued)
- 07/34: gnu: mate-settings-daemon: Update to 1.24.0., guix-commits, 2020/04/02
- 11/34: gnu: mate-applets: Update to 1.24.0., guix-commits, 2020/04/02
- 08/34: gnu: libmatemixer: Update to 1.24.0., guix-commits, 2020/04/02
- 12/34: gnu: mate-media: Update to 1.24.0., guix-commits, 2020/04/02
- 16/34: gnu: caja-extensions: Update to 1.24.0., guix-commits, 2020/04/02
- 24/34: gnu: eom: Update to 1.24.0., guix-commits, 2020/04/02
- 26/34: gnu: pluma: Update to 1.24.0., guix-commits, 2020/04/02
- 13/34: gnu: mate-panel: Update to 1.24.0., guix-commits, 2020/04/02
- 14/34: gnu: caja: Update to 1.24.0., guix-commits, 2020/04/02
- 15/34: gnu: marco: Update to 1.24.0., guix-commits, 2020/04/02
- 01/34: bournish: Prevent inlining of run-time support procedures.,
guix-commits <=
- 10/34: gnu: mate-menus: Update to 1.24.0., guix-commits, 2020/04/02
- 17/34: gnu: mate-control-center: Update to 1.24.0., guix-commits, 2020/04/02
- 18/34: gnu: mate-user-guide: Update to 1.24.0., guix-commits, 2020/04/02
- 19/34: gnu: mate-calc: Update to 1.24.0., guix-commits, 2020/04/02
- 20/34: gnu: mate-backgrounds: Update to 1.24.1., guix-commits, 2020/04/02
- 22/34: gnu: mate-screensaver: Update to 1.24.0., guix-commits, 2020/04/02
- 25/34: gnu: engrampa: Update to 1.24.0., guix-commits, 2020/04/02
- 27/34: gnu: mate-system-monitor: Update to 1.24.0., guix-commits, 2020/04/02
- 32/34: gnu: mate-control-center: Fix file name in polkit rule., guix-commits, 2020/04/02
- 28/34: gnu: mate-polkit: Update to 1.24.0., guix-commits, 2020/04/02