diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-12-09 22:16:35 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-12-15 17:32:09 +0100 |
commit | ed7d02f7c198970ce3fe94bcee47592963326446 (patch) | |
tree | 86b9e7564dc438b17940422cec8ce3163a8a92c7 /guix/serialization.scm | |
parent | 465d2cb286170933577de045e6e6dad7205bfe10 (diff) | |
download | guix-patches-ed7d02f7c198970ce3fe94bcee47592963326446.tar guix-patches-ed7d02f7c198970ce3fe94bcee47592963326446.tar.gz |
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".
Diffstat (limited to 'guix/serialization.scm')
-rw-r--r-- | guix/serialization.scm | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/guix/serialization.scm b/guix/serialization.scm index cc56134ef4..677ca60b66 100644 --- a/guix/serialization.scm +++ b/guix/serialization.scm @@ -459,23 +459,27 @@ depends on TYPE." (define (restore-file port file) "Read a file (possibly a directory structure) in Nar format from PORT. -Restore it as FILE." +Restore it as FILE with canonical permissions and timestamps." (fold-archive (lambda (file type content result) (match type ('directory (mkdir file)) ('directory-complete - #t) + (chmod file #o555) + (utime file 1 1 0 0)) ('symlink - (symlink content file)) + (symlink content file) + (utime file 1 1 0 0 AT_SYMLINK_NOFOLLOW)) ((or 'regular 'executable) (match content ((input . size) (call-with-output-file file (lambda (output) (dump input output size) - (when (eq? type 'executable) - (chmod output #o755))))))))) + (chmod output (if (eq? type 'executable) + #o555 + #o444)))) + (utime file 1 1 0 0)))))) #t port file)) |