summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-11-16 11:03:19 +0100
committerLudovic Courtès <ludo@gnu.org>2020-11-16 11:21:42 +0100
commit977eb5d023cfdf8e336f1896480eea9cef5c04e9 (patch)
treeef52e8a6dd446e79c964afb83befc46daedd4335
parent630602831dd93e7bc9a8e64fba958300e8cb0474 (diff)
Properly deal with build directories containing '~'.
Fixes <https://bugs.gnu.org/44626>. Reported by Vagrant Cascadian <vagrant@debian.org>. * tests/build-utils.scm ("wrap-script, simple case"): Pass SCRIPT-CONTENTS to 'display' rather than 'format'. * gnu/services/base.scm (file-system->shepherd-service-name) [valid-characters, mount-point]: New variables. Filter out invalid store file name characters from the mount point of FILE-SYSTEM.
-rw-r--r--gnu/services/base.scm15
-rw-r--r--tests/build-utils.scm4
2 files changed, 15 insertions, 4 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 499e50bfd77..712b3a018f7 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -285,8 +285,19 @@ This service must be the root of the service dependency graph so that its
285(define (file-system->shepherd-service-name file-system) 285(define (file-system->shepherd-service-name file-system)
286 "Return the symbol that denotes the service mounting and unmounting 286 "Return the symbol that denotes the service mounting and unmounting
287FILE-SYSTEM." 287FILE-SYSTEM."
288 (symbol-append 'file-system- 288 (define valid-characters
289 (string->symbol (file-system-mount-point file-system)))) 289 ;; Valid store characters; see 'checkStoreName' in the daemon.
290 (string->char-set
291 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+-._?="))
292
293 (define mount-point
294 (string-map (lambda (chr)
295 (if (char-set-contains? valid-characters chr)
296 chr
297 #\-))
298 (file-system-mount-point file-system)))
299
300 (symbol-append 'file-system- (string->symbol mount-point)))
290 301
291(define (mapped-device->shepherd-service-name md) 302(define (mapped-device->shepherd-service-name md)
292 "Return the symbol that denotes the shepherd service of MD, a <mapped-device>." 303 "Return the symbol that denotes the shepherd service of MD, a <mapped-device>."
diff --git a/tests/build-utils.scm b/tests/build-utils.scm
index 47a57a984be..654b480ed9e 100644
--- a/tests/build-utils.scm
+++ b/tests/build-utils.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012, 2015, 2016, 2019 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2012, 2015, 2016, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net> 3;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
4;;; 4;;;
5;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
@@ -174,7 +174,7 @@ echo hello world"))
174 (let ((script-file-name (string-append directory "/foo"))) 174 (let ((script-file-name (string-append directory "/foo")))
175 (call-with-output-file script-file-name 175 (call-with-output-file script-file-name
176 (lambda (port) 176 (lambda (port)
177 (format port script-contents))) 177 (display script-contents port)))
178 (chmod script-file-name #o777) 178 (chmod script-file-name #o777)
179 (wrap-script script-file-name 179 (wrap-script script-file-name
180 `("GUIX_FOO" prefix ("/some/path" 180 `("GUIX_FOO" prefix ("/some/path"