From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRDoW-0008AU-Lc for guix-patches@gnu.org; Fri, 08 Jun 2018 05:36:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRDoV-0006hm-BJ for guix-patches@gnu.org; Fri, 08 Jun 2018 05:36:08 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:59121) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRDoV-0006gX-4z for guix-patches@gnu.org; Fri, 08 Jun 2018 05:36:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fRDoU-0000d0-Qu for guix-patches@gnu.org; Fri, 08 Jun 2018 05:36:06 -0400 Subject: [bug#31755] [PATCH 11/19] database: 'reset-timestamps' sets file permissions as well. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 8 Jun 2018 11:34:43 +0200 Message-Id: <20180608093451.27760-11-ludo@gnu.org> In-Reply-To: <20180608093451.27760-1-ludo@gnu.org> References: <20180608093451.27760-1-ludo@gnu.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 31755@debbugs.gnu.org * 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 094dea3ec..67dfb8b0e 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) -- 2.17.1