From fe4663ae2476cb527d4f1f49ff8fa077d43f7251 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sat, 24 Sep 2022 12:42:21 +0200 Subject: installer: Fix configuration edition during testing. When the configuration is edited, it looks like there are some leftover fragments from the input configuration: Example content of config.scm after edition: #:imported-modules '((gnu services herd) (guix build utils) (guix combinators))) unted". The unique ;; file system identifiers there ("UUIDs") can be obtained ;; by running 'blkid' in a terminal. ... This is strange because call-with-output-file uses the O_TRUNC flag which resets the file size to zero. Remove the configuration file before writing it as a work-around. * gnu/installer/tests.scm (edit-configuration-file): Remove the configuration file before re-writing it. --- gnu/installer/tests.scm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gnu/installer') diff --git a/gnu/installer/tests.scm b/gnu/installer/tests.scm index 3c049a1c85..82c3d3ee88 100644 --- a/gnu/installer/tests.scm +++ b/gnu/installer/tests.scm @@ -280,6 +280,10 @@ (define (edit exp) exp))) (let ((content (call-with-input-file file read-expressions))) + ;; XXX: Remove the file before re-writing it, to be sure there are no + ;; leftovers. We shouldn't have to to that as CALL-WITH-OUTPUT-FILE uses + ;; the O_TRUNC flag by default. + (delete-file file) (call-with-output-file file (lambda (port) (format port "\ -- cgit v1.2.3