[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/19: database: 'reset-timestamps' sets file permissions as well.
From: |
Ludovic Courtès |
Subject: |
11/19: database: 'reset-timestamps' sets file permissions as well. |
Date: |
Thu, 14 Jun 2018 05:17:09 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 49c393ccaae99dbddffcbebac73ecabeacd1bc9b
Author: Ludovic Courtès <address@hidden>
Date: Wed Jun 6 22:53:52 2018 +0200
database: 'reset-timestamps' sets file permissions as well.
* guix/store/database.scm (reset-timestamps): Add 'chmod' calls.
---
guix/store/database.scm | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/guix/store/database.scm b/guix/store/database.scm
index 094dea3..67dfb8b 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)
- branch master updated (03439df -> ea0a06c), Ludovic Courtès, 2018/06/14
- 04/19: build: Require Guile-SQLite3., Ludovic Courtès, 2018/06/14
- 16/19: install: Use 'reset-timestamps' from (guix store database)., Ludovic Courtès, 2018/06/14
- 02/19: database: Fail registration when encountering unregistered references., Ludovic Courtès, 2018/06/14
- 08/19: database: Remove extra SQL parameter in 'update-or-insert'., Ludovic Courtès, 2018/06/14
- 05/19: database: Provide a way to specify the schema location., Ludovic Courtès, 2018/06/14
- 07/19: deduplicate: Fix a couple of thinkos., Ludovic Courtès, 2018/06/14
- 18/19: store: Remove 'register-path'., Ludovic Courtès, 2018/06/14
- 17/19: database: Allow for deterministic database construction., Ludovic Courtès, 2018/06/14
- 11/19: database: 'reset-timestamps' sets file permissions as well.,
Ludovic Courtès <=
- 03/19: store-copy: 'read-reference-graph' returns a list of records., Ludovic Courtès, 2018/06/14
- 14/19: database: 'sqlite-register' takes a database, not a file name., Ludovic Courtès, 2018/06/14
- 12/19: vm: 'expression->derivation-in-linux-vm' code can now use dlopen., Ludovic Courtès, 2018/06/14
- 10/19: database: Replace existing entries in Refs., Ludovic Courtès, 2018/06/14
- 15/19: database: Add 'register-items'., Ludovic Courtès, 2018/06/14
- 06/19: database: 'register-path' creates the database directory if needed., Ludovic Courtès, 2018/06/14
- 09/19: database: Add #:reset-timestamps? to 'register-path'., Ludovic Courtès, 2018/06/14
- 01/19: database: 'with-database' can now initialize new databases., Ludovic Courtès, 2018/06/14
- 13/19: install: Use (guix store database) instead of 'guix-register'., Ludovic Courtès, 2018/06/14
- 19/19: Remove 'guix-register' and its traces., Ludovic Courtès, 2018/06/14