aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-06-06 22:53:52 +0200
committerLudovic Courtès <ludo@gnu.org>2018-06-14 11:16:59 +0200
commit49c393ccaae99dbddffcbebac73ecabeacd1bc9b (patch)
tree93fd008188ab1eede566255f8d627489e59b3be3
parent122a6cad7d4a7520593d1dd0c16b3bb8094d7f5a (diff)
downloadguix-49c393ccaae99dbddffcbebac73ecabeacd1bc9b.tar
guix-49c393ccaae99dbddffcbebac73ecabeacd1bc9b.tar.gz
database: 'reset-timestamps' sets file permissions as well.
* guix/store/database.scm (reset-timestamps): Add 'chmod' calls.
-rw-r--r--guix/store/database.scm15
1 files changed, 5 insertions, 10 deletions
diff --git a/guix/store/database.scm b/guix/store/database.scm
index 094dea3ec8..67dfb8b0ee 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -24,7 +24,8 @@
#:use-module (guix store deduplication)
#:use-module (guix base16)
#:use-module (guix build syscalls)
- #:use-module ((guix build utils) #:select (mkdir-p))
+ #:use-module ((guix build utils)
+ #:select (mkdir-p executable-file?))
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-19)
@@ -189,11 +190,12 @@ Every store item in REFERENCES must already be registered."
;; TODO: Factorize with that in (gnu build install).
(define (reset-timestamps file)
"Reset the modification time on FILE and on all the files it contains, if
-it's a directory."
+it's a directory. While at it, canonicalize file permissions."
(let loop ((file file)
(type (stat:type (lstat file))))
(case type
((directory)
+ (chmod file #o555)
(utime file 0 0 0 0)
(let ((parent file))
(for-each (match-lambda
@@ -212,16 +214,9 @@ it's a directory."
;; symlinks.
#f)
(else
+ (chmod file (if (executable-file? file) #o555 #o444))
(utime file 0 0 0 0)))))
-;; TODO: make this canonicalize store items that are registered. This involves
-;; setting permissions and timestamps, I think. Also, run a "deduplication
-;; pass", whatever that involves. Also, handle databases not existing yet
-;; (what should the default behavior be? Figuring out how the C++ stuff
-;; currently does it sounds like a lot of grepping for global
-;; variables...). Also, return #t on success like the documentation says we
-;; should.
-
(define* (register-path path
#:key (references '()) deriver prefix
state-directory (deduplicate? #t)