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.
This commit is contained in:
Mathieu Othacehe 2022-09-24 12:42:21 +02:00
parent e1ce100915
commit fe4663ae24
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
1 changed files with 4 additions and 0 deletions

View File

@ -280,6 +280,10 @@ instrumented for further testing."
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 "\