1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-28 03:51:53 +02:00

serialization: 'restore-file' sets canonical timestamp and permissions.

* guix/serialization.scm (restore-file): Set the permissions and mtime
of FILE.
* guix/nar.scm (finalize-store-file): Pass #:reset-timestamps? #f to
'register-items'.
* tests/nar.scm (rm-rf): Add 'chmod' calls to ensure files are writable.
("write-file + restore-file with symlinks"): Ensure every file in OUTPUT
passes 'canonical-file?'.
* tests/guix-archive.sh: Run "chmod -R +w" before "rm -rf".
This commit is contained in:
Ludovic Courtès
2020-12-09 22:16:35 +01:00
parent 465d2cb286
commit ed7d02f7c1
4 changed files with 26 additions and 12 deletions
+10 -2
View File
@@ -136,8 +136,11 @@
(define (rm-rf dir)
(file-system-fold (const #t) ; enter?
(lambda (file stat result) ; leaf
(unless (eq? 'symlink (stat:type stat))
(chmod file #o644))
(delete-file file))
(const #t) ; down
(lambda (dir stat result) ; down
(chmod dir #o755))
(lambda (dir stat result) ; up
(rmdir dir))
(const #t) ; skip
@@ -363,7 +366,12 @@
(cut write-file input <>))
(call-with-input-file nar
(cut restore-file <> output))
(file-tree-equal? input output))
(and (file-tree-equal? input output)
(every (lambda (file)
(canonical-file?
(string-append output "/" file)))
'("root" "root/reg" "root/exe"))))
(lambda ()
(false-if-exception (delete-file nar))
(false-if-exception (rm-rf output)))))))