From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:40:42 2022 Received: (at submit) by debbugs.gnu.org; 27 Feb 2022 13:40:42 +0000 Received: from localhost ([127.0.0.1]:57096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOJmz-0004Q9-WB for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:40:42 -0500 Received: from lists.gnu.org ([209.51.188.17]:51654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOJmj-0004Pg-Tu for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:40:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOJmj-0001RD-6X for guix-patches@gnu.org; Sun, 27 Feb 2022 08:40:25 -0500 Received: from [2001:470:142:3::e] (port=50120 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOJmi-0007WG-UV; Sun, 27 Feb 2022 08:40:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=Zr72DFM1jTnl6CB3px1IyjUtYfkp0957xa/Hz5Pjf1s=; b=VYS9WRL0mD5a2h DI2z3j1EfcVgLEoAfFuJmvuJXBCpZtcqvkhMsCkRCMvTlrBWPZp8oICmZmUXL3DfS/pewraVsHcpL DAC1S5bHPMx9/M0Zg/OFD1AkKvZDPhi7mXF1NZIE8MVqUerpdPfKi4I0IS6URnRszLOW8TrhWB5fW KWhR6orOcSd0iVMm03kbsVlLtpBPsEyy2pgOqAigMBE5PYUHD7J7lFBbHbEsDvTFf3Ug5RYCowvqP a64AM0v/6ViaT7+kyIrXJySea4ZWIyyjlBCPdqnay5i7nMqJzubZYxPRtwru8pZMqMk9CuWtY/A6/ XL+l0tOkey6gwByWT69g==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55802 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOJmg-00068n-Q8; Sun, 27 Feb 2022 08:40:23 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 00/12] Home: Clarify and better test symlink-manager.scm Date: Sun, 27 Feb 2022 14:40:06 +0100 Message-Id: <20220227134006.9860-1-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 X-Debbugs-Cc: Andrew Tropin , Oleg Pykhalov , Xinglu Chen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello Guix! This patch set aims to increase test coverage for ‘guix home reconfigure’, to make symlink-manager.scm IMO easier to follow, and to have it more closely follow the project’s conventions. Functionality is unchanged. Thoughts? Thanks, Ludo’. Ludovic Courtès (12): home: symlink-manager: Clarify module imports. home: symlink-manager: Move helper procedures as top-level defines. home: symlink-manager: Use 'for-each' when used for effects. home: symlink-manager: Use 'file-is-directory?'. home: symlink-manager: Remove 'empty-directory?' and avoid TOCTTOU race. home: symlink-manager: Avoid extra 'lstat' call. tests: Make sure 'guix home reconfigure' backs up files. tests: Simplify use of 'local-file' in 'tests/guix-home.sh'. tests: Check 'guix home reconfigure' for a second generation. home: symlink-manager: 'cleanup-symlinks' uses 'file-system-fold'. home: symlink-manager: 'create-symlinks' uses 'file-system-fold'. home: symlink-manager: Rename "path" to "file" where appropriate. gnu/home/services/symlink-manager.scm | 355 ++++++++++++-------------- tests/guix-home.sh | 44 +++- 2 files changed, 198 insertions(+), 201 deletions(-) base-commit: 33ce3f1c866231a3015411fdce18a3e72649e2f6 -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:00 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:00 +0000 Received: from localhost ([127.0.0.1]:57135 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOJzr-0004pQ-Hf for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44794) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOJzp-0004pC-T6 for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:53:58 -0500 Received: from [2001:470:142:3::e] (port=50224 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOJzk-0001Ym-2u; Sun, 27 Feb 2022 08:53:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=2HF3K/6I+bXGXWTvLEmzWBUTGzBHJ7SqpBylqp0wJOA=; b=oSEMhrN/kH4Wsr koScHq/+dGESw4aPfbiQd3gIrPbF63nZkC2SWQAXyC5z+EUbLtaSkpTsLXKCtCxapSEOgSbVsOsYD 2eNWSA+/47Jz2eHFYRumhv4SAh2zk+6dt2fKiGZbjrnEa0xfncJljMOMGzpQusJX2ChTW4ek2SeYp zCLP69SVrsUM64N26ClvbcGGPH+fJ56xEqV+pqfJr1VslmqhM1xbjToGEDNq6SAN1WSzQHRXGvblv XnYMu6dY7jTInnotaNo6MxI3BrcyT3KDzrAs7WNvwJAQIdzRAbCJOUba/3CwoMj2Moq3C6qe9GP8n kbuKoMRceIj6zS4z2asw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOJzi-0007Pg-7u; Sun, 27 Feb 2022 08:53:51 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 01/12] home: symlink-manager: Clarify module imports. Date: Sun, 27 Feb 2022 14:53:31 +0100 Message-Id: <20220227135342.10296-1-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/home/services/symlink-manager.scm (update-symlinks-script): Wrap body in 'with-imported-modules'. Move (guix build utils) import to the top. Move #$%initialize-gettext after definitions. --- gnu/home/services/symlink-manager.scm | 336 +++++++++++++------------- 1 file changed, 170 insertions(+), 166 deletions(-) diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index 314da3ba3e..c60cdcffb7 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -20,7 +20,7 @@ (define-module (gnu home services symlink-manager) #:use-module (gnu home services) #:use-module (guix gexp) - + #:use-module (guix modules) #:export (home-symlink-manager-service-type)) ;;; Comment: @@ -37,15 +37,19 @@ (define-module (gnu home services symlink-manager) (define (update-symlinks-script) (program-file "update-symlinks" - #~(begin - (use-modules (ice-9 ftw) - (ice-9 curried-definitions) - (ice-9 match) - (srfi srfi-1) - (guix i18n)) - #$%initialize-gettext - (define ((simplify-file-tree parent) file) - "Convert the result produced by `file-system-tree' to less + (with-imported-modules (source-module-closure + '((guix build utils) + (guix i18n))) + #~(begin + (use-modules (ice-9 ftw) + (ice-9 curried-definitions) + (ice-9 match) + (srfi srfi-1) + (guix i18n) + (guix build utils)) + + (define ((simplify-file-tree parent) file) + "Convert the result produced by `file-system-tree' to less verbose and more suitable for further processing format. Extract dir/file info from stat and compose a relative path to the @@ -60,178 +64,178 @@ (define ((simplify-file-tree parent) file) ((dir . \"config/isync\") (file . \"config/isync/mbsyncrc\")))) " - (match file - ((name stat) `(file . ,(string-append parent name))) - ((name stat children ...) - (cons `(dir . ,(string-append parent name)) - (map (simplify-file-tree - (if (equal? name ".") - "" - (string-append parent name "/"))) - children))))) + (match file + ((name stat) `(file . ,(string-append parent name))) + ((name stat children ...) + (cons `(dir . ,(string-append parent name)) + (map (simplify-file-tree + (if (equal? name ".") + "" + (string-append parent name "/"))) + children))))) - (define ((file-tree-traverse preordering) node) - "Traverses the file tree in different orders, depending on PREORDERING. + (define ((file-tree-traverse preordering) node) + "Traverses the file tree in different orders, depending on PREORDERING. if PREORDERING is @code{#t} resulting list will contain directories before files located in those directories, otherwise directory will appear only after all nested items already listed." - (let ((prepend (lambda (a b) (append b a)))) - (match node - (('file . path) (list node)) - ((('dir . path) . rest) - ((if preordering append prepend) - (list (cons 'dir path)) - (append-map (file-tree-traverse preordering) rest)))))) - - (use-modules (guix build utils)) - - (let* ((config-home (or (getenv "XDG_CONFIG_HOME") - (string-append (getenv "HOME") "/.config"))) - - (he-path (string-append (getenv "HOME") "/.guix-home")) - (new-he-path (string-append he-path ".new")) - (new-home (getenv "GUIX_NEW_HOME")) - (old-home (getenv "GUIX_OLD_HOME")) - - (new-files-path (string-append new-home "/files")) - ;; Trailing dot is required, because files itself is symlink and - ;; to make file-system-tree works it should be a directory. - (new-files-dir-path (string-append new-files-path "/.")) - - (home-path (getenv "HOME")) - (backup-dir (string-append home-path "/" - (number->string (current-time)) - "-guix-home-legacy-configs-backup")) - - (old-tree (if old-home - ((simplify-file-tree "") - (file-system-tree - (string-append old-home "/files/."))) - #f)) - (new-tree ((simplify-file-tree "") - (file-system-tree new-files-dir-path))) - - (get-source-path - (lambda (path) - (readlink (string-append new-files-path "/" path)))) - - (get-target-path - (lambda (path) - (string-append home-path "/." path))) - - (get-backup-path - (lambda (path) - (string-append backup-dir "/." path))) - - (directory? - (lambda (path) - (equal? (stat:type (stat path)) 'directory))) - - (empty-directory? - (lambda (dir) - (equal? (scandir dir) '("." "..")))) - - (symlink-to-store? - (lambda (path) - (and - (equal? (stat:type (lstat path)) 'symlink) - (store-file-name? (readlink path))))) - - (backup-file - (lambda (path) - (mkdir-p backup-dir) - (format #t (G_ "Backing up ~a...") (get-target-path path)) - (mkdir-p (dirname (get-backup-path path))) - (rename-file (get-target-path path) (get-backup-path path)) - (display (G_ " done\n")))) - - (cleanup-symlinks - (lambda () - (let ((to-delete ((file-tree-traverse #f) old-tree))) - (display - (G_ - "Cleaning up symlinks from previous home-environment.\n\n")) - (map - (match-lambda - (('dir . ".") - (display (G_ "Cleanup finished.\n\n"))) - - (('dir . path) - (if (and - (file-exists? (get-target-path path)) - (directory? (get-target-path path)) - (empty-directory? (get-target-path path))) - (begin - (format #t (G_ "Removing ~a...") - (get-target-path path)) - (rmdir (get-target-path path)) - (display (G_ " done\n"))) - (format - #t - (G_ "Skipping ~a (not an empty directory)... done\n") - (get-target-path path)))) - - (('file . path) - (when (file-exists? (get-target-path path)) - ;; DO NOT remove the file if it is no longer - ;; a symlink to the store, it will be backed - ;; up later during create-symlinks phase. - (if (symlink-to-store? (get-target-path path)) + (let ((prepend (lambda (a b) (append b a)))) + (match node + (('file . path) (list node)) + ((('dir . path) . rest) + ((if preordering append prepend) + (list (cons 'dir path)) + (append-map (file-tree-traverse preordering) rest)))))) + + #$%initialize-gettext + + (let* ((config-home (or (getenv "XDG_CONFIG_HOME") + (string-append (getenv "HOME") "/.config"))) + + (he-path (string-append (getenv "HOME") "/.guix-home")) + (new-he-path (string-append he-path ".new")) + (new-home (getenv "GUIX_NEW_HOME")) + (old-home (getenv "GUIX_OLD_HOME")) + + (new-files-path (string-append new-home "/files")) + ;; Trailing dot is required, because files itself is symlink and + ;; to make file-system-tree works it should be a directory. + (new-files-dir-path (string-append new-files-path "/.")) + + (home-path (getenv "HOME")) + (backup-dir (string-append home-path "/" + (number->string (current-time)) + "-guix-home-legacy-configs-backup")) + + (old-tree (if old-home + ((simplify-file-tree "") + (file-system-tree + (string-append old-home "/files/."))) + #f)) + (new-tree ((simplify-file-tree "") + (file-system-tree new-files-dir-path))) + + (get-source-path + (lambda (path) + (readlink (string-append new-files-path "/" path)))) + + (get-target-path + (lambda (path) + (string-append home-path "/." path))) + + (get-backup-path + (lambda (path) + (string-append backup-dir "/." path))) + + (directory? + (lambda (path) + (equal? (stat:type (stat path)) 'directory))) + + (empty-directory? + (lambda (dir) + (equal? (scandir dir) '("." "..")))) + + (symlink-to-store? + (lambda (path) + (and + (equal? (stat:type (lstat path)) 'symlink) + (store-file-name? (readlink path))))) + + (backup-file + (lambda (path) + (mkdir-p backup-dir) + (format #t (G_ "Backing up ~a...") (get-target-path path)) + (mkdir-p (dirname (get-backup-path path))) + (rename-file (get-target-path path) (get-backup-path path)) + (display (G_ " done\n")))) + + (cleanup-symlinks + (lambda () + (let ((to-delete ((file-tree-traverse #f) old-tree))) + (display + (G_ + "Cleaning up symlinks from previous home-environment.\n\n")) + (map + (match-lambda + (('dir . ".") + (display (G_ "Cleanup finished.\n\n"))) + + (('dir . path) + (if (and + (file-exists? (get-target-path path)) + (directory? (get-target-path path)) + (empty-directory? (get-target-path path))) (begin - (format #t (G_ "Removing ~a...") (get-target-path path)) - (delete-file (get-target-path path)) + (format #t (G_ "Removing ~a...") + (get-target-path path)) + (rmdir (get-target-path path)) (display (G_ " done\n"))) (format #t - (G_ "Skipping ~a (not a symlink to store)... done\n") - (get-target-path path)))))) - to-delete)))) + (G_ "Skipping ~a (not an empty directory)... done\n") + (get-target-path path)))) - (create-symlinks - (lambda () - (let ((to-create ((file-tree-traverse #t) new-tree))) - (map - (match-lambda - (('dir . ".") - (display - (G_ "New symlinks to home-environment will be created soon.\n")) - (format - #t (G_ "All conflicting files will go to ~a.\n\n") backup-dir)) + (('file . path) + (when (file-exists? (get-target-path path)) + ;; DO NOT remove the file if it is no longer + ;; a symlink to the store, it will be backed + ;; up later during create-symlinks phase. + (if (symlink-to-store? (get-target-path path)) + (begin + (format #t (G_ "Removing ~a...") (get-target-path path)) + (delete-file (get-target-path path)) + (display (G_ " done\n"))) + (format + #t + (G_ "Skipping ~a (not a symlink to store)... done\n") + (get-target-path path)))))) + to-delete)))) - (('dir . path) - (let ((target-path (get-target-path path))) - (when (and (file-exists? target-path) - (not (directory? target-path))) + (create-symlinks + (lambda () + (let ((to-create ((file-tree-traverse #t) new-tree))) + (map + (match-lambda + (('dir . ".") + (display + (G_ "New symlinks to home-environment will be created soon.\n")) + (format + #t (G_ "All conflicting files will go to ~a.\n\n") backup-dir)) + + (('dir . path) + (let ((target-path (get-target-path path))) + (when (and (file-exists? target-path) + (not (directory? target-path))) + (backup-file path)) + + (if (file-exists? target-path) + (format + #t (G_ "Skipping ~a (directory already exists)... done\n") + target-path) + (begin + (format #t (G_ "Creating ~a...") target-path) + (mkdir target-path) + (display (G_ " done\n")))))) + + (('file . path) + (when (file-exists? (get-target-path path)) (backup-file path)) + (format #t (G_ "Symlinking ~a -> ~a...") + (get-target-path path) (get-source-path path)) + (symlink (get-source-path path) (get-target-path path)) + (display (G_ " done\n")))) + to-create))))) - (if (file-exists? target-path) - (format - #t (G_ "Skipping ~a (directory already exists)... done\n") - target-path) - (begin - (format #t (G_ "Creating ~a...") target-path) - (mkdir target-path) - (display (G_ " done\n")))))) + (when old-tree + (cleanup-symlinks)) - (('file . path) - (when (file-exists? (get-target-path path)) - (backup-file path)) - (format #t (G_ "Symlinking ~a -> ~a...") - (get-target-path path) (get-source-path path)) - (symlink (get-source-path path) (get-target-path path)) - (display (G_ " done\n")))) - to-create))))) + (create-symlinks) - (when old-tree - (cleanup-symlinks)) + (symlink new-home new-he-path) + (rename-file new-he-path he-path) - (create-symlinks) - - (symlink new-home new-he-path) - (rename-file new-he-path he-path) - - (display (G_" done\nFinished updating symlinks.\n\n")))))) + (display (G_" done\nFinished updating symlinks.\n\n"))))))) (define (update-symlinks-gexp _) -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:15 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:15 +0000 Received: from localhost ([127.0.0.1]:57140 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK07-0004qU-9A for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK05-0004q5-To for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:14 -0500 Received: from [2001:470:142:3::e] (port=50226 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOJzl-0001Z1-HT; Sun, 27 Feb 2022 08:53:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=KQEDUU7UIdoXDnp047WQ1OJGZXh84fnerJi/kb71ExM=; b=fLeQyDSHCumGKAcnnDzK k2G1Br0C7dzR9EssLhLUK8NxFC2cc/2Eku3Vj9ZPbKEIUV0OKXgM+oYsUeGCJZEKxC3TmtDz06ycC YD+RO15NT8BNIhXLMXHGYzg7D63/fJx4k2mPdsp6ZfbQ8UQgRwJ+dxKjm0NXbawwoX4v9CFgAentZ 8UFDF1NUgA6/fW46QnHVx09aqVd/nf/rJpblVjh3I2JuIuR81SSrwC2tfoEH1YDzj42+yjsh4kNZ9 j0KoV/0KbWBd6DFXoN08Y2RdWX3+bcCix6YZoMVaptue8kiFtYS/Prkm6HpoEBqFOjMpr1mzIm6uf tcZL5X5Pka1tDQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOJzk-0007Pg-8C; Sun, 27 Feb 2022 08:53:53 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 02/12] home: symlink-manager: Move helper procedures as top-level defines. Date: Sun, 27 Feb 2022 14:53:32 +0100 Message-Id: <20220227135342.10296-2-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/home/services/symlink-manager.scm (update-symlinks-script): Remove 'config-home', which is unused. Move 'home-path', 'backup-dir', 'get-target-path', 'get-backup-path', 'directory?', 'empty-directory?', 'symlink-to-store?', and 'backup-file' to the top level. Move 'create-symlinks' and 'cleanup-symlinks' to the top level as well, and add parameters. Adjust callers. --- gnu/home/services/symlink-manager.scm | 240 +++++++++++++------------- 1 file changed, 116 insertions(+), 124 deletions(-) diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index c60cdcffb7..25470209d1 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -88,12 +88,121 @@ (define ((file-tree-traverse preordering) node) (list (cons 'dir path)) (append-map (file-tree-traverse preordering) rest)))))) + (define home-path + (getenv "HOME")) + + (define backup-dir + (string-append home-path "/" (number->string (current-time)) + "-guix-home-legacy-configs-backup")) + + (define (get-target-path path) + (string-append home-path "/." path)) + + (define (get-backup-path path) + (string-append backup-dir "/." path)) + + (define (directory? path) + (equal? (stat:type (stat path)) 'directory)) + + (define (empty-directory? dir) + (equal? (scandir dir) '("." ".."))) + + (define (symlink-to-store? path) + (and (equal? (stat:type (lstat path)) 'symlink) + (store-file-name? (readlink path)))) + + (define (backup-file path) + (mkdir-p backup-dir) + (format #t (G_ "Backing up ~a...") (get-target-path path)) + (mkdir-p (dirname (get-backup-path path))) + (rename-file (get-target-path path) (get-backup-path path)) + (display (G_ " done\n"))) + + (define (cleanup-symlinks old-tree) + ;; Delete from directory OLD-TREE symlinks that correspond to a + ;; previous generation. + (let ((to-delete ((file-tree-traverse #f) old-tree))) + (display + (G_ + "Cleaning up symlinks from previous home-environment.\n\n")) + (map + (match-lambda + (('dir . ".") + (display (G_ "Cleanup finished.\n\n"))) + + (('dir . path) + (if (and + (file-exists? (get-target-path path)) + (directory? (get-target-path path)) + (empty-directory? (get-target-path path))) + (begin + (format #t (G_ "Removing ~a...") + (get-target-path path)) + (rmdir (get-target-path path)) + (display (G_ " done\n"))) + (format + #t + (G_ "Skipping ~a (not an empty directory)... done\n") + (get-target-path path)))) + + (('file . path) + (when (file-exists? (get-target-path path)) + ;; DO NOT remove the file if it is no longer a symlink to + ;; the store, it will be backed up later during + ;; create-symlinks phase. + (if (symlink-to-store? (get-target-path path)) + (begin + (format #t (G_ "Removing ~a...") (get-target-path path)) + (delete-file (get-target-path path)) + (display (G_ " done\n"))) + (format + #t + (G_ "Skipping ~a (not a symlink to store)... done\n") + (get-target-path path)))))) + to-delete))) + + (define (create-symlinks new-tree new-files-path) + ;; Create in directory NEW-TREE symlinks to the files under + ;; NEW-FILES-PATH, creating backups as needed. + (define (get-source-path path) + (readlink (string-append new-files-path "/" path))) + + (let ((to-create ((file-tree-traverse #t) new-tree))) + (map + (match-lambda + (('dir . ".") + (display + (G_ "New symlinks to home-environment will be created soon.\n")) + (format + #t (G_ "All conflicting files will go to ~a.\n\n") backup-dir)) + + (('dir . path) + (let ((target-path (get-target-path path))) + (when (and (file-exists? target-path) + (not (directory? target-path))) + (backup-file path)) + + (if (file-exists? target-path) + (format + #t (G_ "Skipping ~a (directory already exists)... done\n") + target-path) + (begin + (format #t (G_ "Creating ~a...") target-path) + (mkdir target-path) + (display (G_ " done\n")))))) + + (('file . path) + (when (file-exists? (get-target-path path)) + (backup-file path)) + (format #t (G_ "Symlinking ~a -> ~a...") + (get-target-path path) (get-source-path path)) + (symlink (get-source-path path) (get-target-path path)) + (display (G_ " done\n")))) + to-create))) + #$%initialize-gettext - (let* ((config-home (or (getenv "XDG_CONFIG_HOME") - (string-append (getenv "HOME") "/.config"))) - - (he-path (string-append (getenv "HOME") "/.guix-home")) + (let* ((he-path (string-append (getenv "HOME") "/.guix-home")) (new-he-path (string-append he-path ".new")) (new-home (getenv "GUIX_NEW_HOME")) (old-home (getenv "GUIX_OLD_HOME")) @@ -103,141 +212,24 @@ (define ((file-tree-traverse preordering) node) ;; to make file-system-tree works it should be a directory. (new-files-dir-path (string-append new-files-path "/.")) - (home-path (getenv "HOME")) - (backup-dir (string-append home-path "/" - (number->string (current-time)) - "-guix-home-legacy-configs-backup")) - (old-tree (if old-home ((simplify-file-tree "") (file-system-tree (string-append old-home "/files/."))) #f)) (new-tree ((simplify-file-tree "") - (file-system-tree new-files-dir-path))) - - (get-source-path - (lambda (path) - (readlink (string-append new-files-path "/" path)))) - - (get-target-path - (lambda (path) - (string-append home-path "/." path))) - - (get-backup-path - (lambda (path) - (string-append backup-dir "/." path))) - - (directory? - (lambda (path) - (equal? (stat:type (stat path)) 'directory))) - - (empty-directory? - (lambda (dir) - (equal? (scandir dir) '("." "..")))) - - (symlink-to-store? - (lambda (path) - (and - (equal? (stat:type (lstat path)) 'symlink) - (store-file-name? (readlink path))))) - - (backup-file - (lambda (path) - (mkdir-p backup-dir) - (format #t (G_ "Backing up ~a...") (get-target-path path)) - (mkdir-p (dirname (get-backup-path path))) - (rename-file (get-target-path path) (get-backup-path path)) - (display (G_ " done\n")))) - - (cleanup-symlinks - (lambda () - (let ((to-delete ((file-tree-traverse #f) old-tree))) - (display - (G_ - "Cleaning up symlinks from previous home-environment.\n\n")) - (map - (match-lambda - (('dir . ".") - (display (G_ "Cleanup finished.\n\n"))) - - (('dir . path) - (if (and - (file-exists? (get-target-path path)) - (directory? (get-target-path path)) - (empty-directory? (get-target-path path))) - (begin - (format #t (G_ "Removing ~a...") - (get-target-path path)) - (rmdir (get-target-path path)) - (display (G_ " done\n"))) - (format - #t - (G_ "Skipping ~a (not an empty directory)... done\n") - (get-target-path path)))) - - (('file . path) - (when (file-exists? (get-target-path path)) - ;; DO NOT remove the file if it is no longer - ;; a symlink to the store, it will be backed - ;; up later during create-symlinks phase. - (if (symlink-to-store? (get-target-path path)) - (begin - (format #t (G_ "Removing ~a...") (get-target-path path)) - (delete-file (get-target-path path)) - (display (G_ " done\n"))) - (format - #t - (G_ "Skipping ~a (not a symlink to store)... done\n") - (get-target-path path)))))) - to-delete)))) - - (create-symlinks - (lambda () - (let ((to-create ((file-tree-traverse #t) new-tree))) - (map - (match-lambda - (('dir . ".") - (display - (G_ "New symlinks to home-environment will be created soon.\n")) - (format - #t (G_ "All conflicting files will go to ~a.\n\n") backup-dir)) - - (('dir . path) - (let ((target-path (get-target-path path))) - (when (and (file-exists? target-path) - (not (directory? target-path))) - (backup-file path)) - - (if (file-exists? target-path) - (format - #t (G_ "Skipping ~a (directory already exists)... done\n") - target-path) - (begin - (format #t (G_ "Creating ~a...") target-path) - (mkdir target-path) - (display (G_ " done\n")))))) - - (('file . path) - (when (file-exists? (get-target-path path)) - (backup-file path)) - (format #t (G_ "Symlinking ~a -> ~a...") - (get-target-path path) (get-source-path path)) - (symlink (get-source-path path) (get-target-path path)) - (display (G_ " done\n")))) - to-create))))) + (file-system-tree new-files-dir-path)))) (when old-tree - (cleanup-symlinks)) + (cleanup-symlinks old-tree)) - (create-symlinks) + (create-symlinks new-tree new-files-path) (symlink new-home new-he-path) (rename-file new-he-path he-path) (display (G_" done\nFinished updating symlinks.\n\n"))))))) - (define (update-symlinks-gexp _) #~(primitive-load #$(update-symlinks-script))) -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:21 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:21 +0000 Received: from localhost ([127.0.0.1]:57162 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0C-0004rD-SC for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0A-0004qE-PF for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:18 -0500 Received: from [2001:470:142:3::e] (port=50238 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOJzw-0001ZW-2y; Sun, 27 Feb 2022 08:54:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=Rs5aZkYJUNIiV3ppRvDlBrBglFTvqsHEr5Zil1ftbuM=; b=F+vA0bYgHtV7o0a0xwv1 CPJW8ljG3nFLzT+3nPV6sBzkyUmUqRYiupeyUUjrWNxfJKPsEh+kRmTCTCE5QHIh8zscxsaYYdkRo zZxAciFgKkQjbigWuPmw9fpz5rfR5dKkS5x2wZVgPiZMQmrJKnmoFhgLGlJGaSjd5hFygv2YFHmPz niek1toWqNNJZ7FVpxQcHOZhFhrw2Ytq2KwYuau/RnbyVDaWsE9x/S6wYyYFkt3ZiFIkzjM4sTmNK uf1RhOkFpMZikrHmmpXVfA/ZdKq+6xVMl4MEOZzRNS3NOPGhlN3y8Km24FiSUadbKexJ7V9vrj/vk d19d1p5m4VX/zw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOJzv-0007Pg-H2; Sun, 27 Feb 2022 08:54:03 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 06/12] home: symlink-manager: Avoid extra 'lstat' call. Date: Sun, 27 Feb 2022 14:53:36 +0100 Message-Id: <20220227135342.10296-6-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/home/services/symlink-manager.scm (update-symlinks-script)[symlink-to-store?]: Avoid extra 'lstat' call. --- gnu/home/services/symlink-manager.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index 6b3a9de3d1..ba42424e8e 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -103,8 +103,13 @@ (define (get-backup-path path) (string-append backup-dir "/." path)) (define (symlink-to-store? path) - (and (equal? (stat:type (lstat path)) 'symlink) - (store-file-name? (readlink path)))) + (catch 'system-error + (lambda () + (store-file-name? (readlink path))) + (lambda args + (if (= EINVAL (system-error-errno args)) + #f + (apply throw args))))) (define (backup-file path) (mkdir-p backup-dir) -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:21 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:21 +0000 Received: from localhost ([127.0.0.1]:57164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0D-0004rM-9D for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0A-0004qD-P7 for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:19 -0500 Received: from [2001:470:142:3::e] (port=50230 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOJzs-0001ZO-Mz; Sun, 27 Feb 2022 08:54:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=U5rrdB/LXzeaieHngRUm1eGOrN7+p1FXRIewoLUvCqg=; b=TZe/Gv677TR9A8L2KyCo Lo3yiH+DWNWb6edW/yVq1GXuuZGeXfvrpjo/QNfjrg+RSqLO/GmLRoiK+haYNzwsfkYe5/3ZyDwoU P2/s08TkDku5I3esHk/Q9OQ537O3O+z8Zyq87fSMI6+bLUcx5Zy3024/diS1ZLFBX/uuD9XjQSRUZ RD12kS+xlJW4MyLx7naFkmFKq+vqy84Jp5ecPfUzwayh3sjr6cabisOZvB8Kw6dkymMy71Bc4h+zO tdBlY+OOFl82zZtiJaiiNffqoQkj1IK08c/efG5FHkXR1ecnczdzbMPODuLONj5azrDE9Khld8q3o RNLoGj2Iz6x97w==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOJzl-0007Pg-NN; Sun, 27 Feb 2022 08:53:57 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 03/12] home: symlink-manager: Use 'for-each' when used for effects. Date: Sun, 27 Feb 2022 14:53:33 +0100 Message-Id: <20220227135342.10296-3-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/home/services/symlink-manager.scm (update-symlinks-script)[cleanup-symlinks] [create-symlinks]: Use 'for-each' instead of 'map'. --- gnu/home/services/symlink-manager.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index 25470209d1..a6344c808f 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -125,7 +125,7 @@ (define (cleanup-symlinks old-tree) (display (G_ "Cleaning up symlinks from previous home-environment.\n\n")) - (map + (for-each (match-lambda (('dir . ".") (display (G_ "Cleanup finished.\n\n"))) @@ -168,7 +168,7 @@ (define (get-source-path path) (readlink (string-append new-files-path "/" path))) (let ((to-create ((file-tree-traverse #t) new-tree))) - (map + (for-each (match-lambda (('dir . ".") (display -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:28 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:28 +0000 Received: from localhost ([127.0.0.1]:57166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0J-0004rv-LS for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0A-0004qF-Pl for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:20 -0500 Received: from [2001:470:142:3::e] (port=50236 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOJzv-0001ZV-Br; Sun, 27 Feb 2022 08:54:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=912F7cZQA0XDyDLS2BIPLh5lsHJs3DYf4xpW2EWNTMk=; b=a+HhsUrXz6P95nIxNFkq cDMy0qyHEYqYTzzPC/usN4FAx6WQA/OjquVUkXtytrhBr8/7gb+rnua6oKVBhBNA3QGwqiiZiea3X 9cIGvsEOB/7YqJ9901fq94fXa9T0oBmNClJzOA15heWiGEuJXijTMb1Mirwj2R5FYEE4gqLcG3Hm8 0areuBCCjD31ivzVbbs9eaBiekV9zRUbAaqSIqXIMkLVn6hTxplnNyjSRdFwU4ZP+XFiJUXtoefPS 5Dgubyw12Msx8VSKpjjqrELmIn+X+g7cW0xDZ8KPC/5HdxGxVuZhC5RS3b8VoVoFLfejhn+q1tCx0 +07i4sBeTWeDTA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOJzu-0007Pg-L8; Sun, 27 Feb 2022 08:54:03 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 05/12] home: symlink-manager: Remove 'empty-directory?' and avoid TOCTTOU race. Date: Sun, 27 Feb 2022 14:53:35 +0100 Message-Id: <20220227135342.10296-5-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This removes three 'stat' syscalls. * gnu/home/services/symlink-manager.scm (update-symlinks-script)[empty-directory?]: Remove. [cleanup-symlinks]: Replace use of 'file-exists?', 'file-is-directory?', and 'empty-directory?' by a single 'rmdir' call. --- gnu/home/services/symlink-manager.scm | 35 ++++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index f133eb17f2..6b3a9de3d1 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2021 Xinglu Chen +;;; Copyright © 2022 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -101,9 +102,6 @@ (define (get-target-path path) (define (get-backup-path path) (string-append backup-dir "/." path)) - (define (empty-directory? dir) - (equal? (scandir dir) '("." ".."))) - (define (symlink-to-store? path) (and (equal? (stat:type (lstat path)) 'symlink) (store-file-name? (readlink path)))) @@ -127,20 +125,23 @@ (define (cleanup-symlinks old-tree) (('dir . ".") (display (G_ "Cleanup finished.\n\n"))) - (('dir . path) - (if (and - (file-exists? (get-target-path path)) - (file-is-directory? (get-target-path path)) - (empty-directory? (get-target-path path))) - (begin - (format #t (G_ "Removing ~a...") - (get-target-path path)) - (rmdir (get-target-path path)) - (display (G_ " done\n"))) - (format - #t - (G_ "Skipping ~a (not an empty directory)... done\n") - (get-target-path path)))) + (('dir . directory) + (let ((directory (get-target-path directory))) + (catch 'system-error + (lambda () + (rmdir directory) + (format #t (G_ "Removed ~a.\n") directory)) + (lambda args + (let ((errno (system-error-errno args))) + (cond ((= ENOTEMPTY errno) + (format + #t + (G_ "Skipping ~a (not an empty directory)...\n") + directory)) + ((= ENOTDIR errno) + #t) + (else + (apply throw args)))))))) (('file . path) (when (file-exists? (get-target-path path)) -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:28 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:28 +0000 Received: from localhost ([127.0.0.1]:57168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0K-0004rx-4n for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0B-0004qJ-Ds for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:20 -0500 Received: from [2001:470:142:3::e] (port=50250 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOK03-0001Zz-7r; Sun, 27 Feb 2022 08:54:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=YUqT4NDHoNx1g9XMtW5BxCtexC77aTws/H+XCMvS+0s=; b=MOeFB9oNYGTyqgWah3+S S4EmDZ77b5FYd2Oo5li5O9NQFWdNIZXgUBcEbJNprJr7lA13pQ76Patrx1O/8zbJkRWiaAwQPGh/e xQ0zYpe9EU6+DIryn9yMX7OsfjyWx5v1/GDSbLaBkBONdeTh8lxT5ZO/H3d0nRbJ2j+c4GzTviRVs NXPSxWInJm240vsXk3Lz140s/eZB6d4oIcLNsnt9qKTf38PtSzVAzBuNLIgL6vCf++JuOsxfHCXe/ VRRRBQe6s8CaiYpjDfIiyrjxkIyhF91ywgTzRJ0uUec7io0Jh8xM2K0GBW+UHHTWdPqIZwrYPFvwm P33sWUwAS0EdGQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOK02-0007Pg-R0; Sun, 27 Feb 2022 08:54:11 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 12/12] home: symlink-manager: Rename "path" to "file" where appropriate. Date: Sun, 27 Feb 2022 14:53:42 +0100 Message-Id: <20220227135342.10296-12-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/home/services/symlink-manager.scm (update-symlinks-script): [home-path]: Rename to... [home-directory]: ... this. Adjust users. [backup-dir]: Rename to... [backup-directory]: ... this. Adjust user. [get-target-path]: Rename to... [target-file]: ... this. Adjust users. [get-backup-path]: Remove. [backup-file]: Inline it. [cleanup-symlinks](get-source-path): Rename to... (source-file): ... this. Adjust users. Rename 'he-path' to 'home' and 'new-he-path' to 'pivot'. --- gnu/home/services/symlink-manager.scm | 55 ++++++++++++++------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index 16e2e7b772..767b1bdc01 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -48,33 +48,35 @@ (define (update-symlinks-script) (guix i18n) (guix build utils)) - (define home-path + (define home-directory (getenv "HOME")) - (define backup-dir - (string-append home-path "/" (number->string (current-time)) + (define backup-directory + (string-append home-directory "/" (number->string (current-time)) "-guix-home-legacy-configs-backup")) - (define (get-target-path path) - (string-append home-path "/." path)) + (define (target-file file) + ;; Return the target of FILE, a config file name sans leading dot + ;; such as "config/fontconfig/fonts.conf" or "bashrc". + (string-append home-directory "/." file)) - (define (get-backup-path path) - (string-append backup-dir "/." path)) - - (define (symlink-to-store? path) + (define (symlink-to-store? file) (catch 'system-error (lambda () - (store-file-name? (readlink path))) + (store-file-name? (readlink file))) (lambda args (if (= EINVAL (system-error-errno args)) #f (apply throw args))))) - (define (backup-file path) - (mkdir-p backup-dir) - (format #t (G_ "Backing up ~a...") (get-target-path path)) - (mkdir-p (dirname (get-backup-path path))) - (rename-file (get-target-path path) (get-backup-path path)) + (define (backup-file file) + (define backup + (string-append backup-directory "/." file)) + + (mkdir-p backup-directory) + (format #t (G_ "Backing up ~a...") (target-file file)) + (mkdir-p (dirname backup)) + (rename-file (target-file file) backup) (display (G_ " done\n"))) (define (cleanup-symlinks home-generation) @@ -95,7 +97,7 @@ (define (strip file) (file-system-fold (const #t) (lambda (file stat _) ;leaf - (let ((file (get-target-path (strip file)))) + (let ((file (target-file (strip file)))) (when (file-exists? file) ;; DO NOT remove the file if it is no longer a symlink to ;; the store, it will be backed up later during @@ -112,7 +114,7 @@ (define (strip file) (const #t) ;down (lambda (directory stat _) ;up (unless (string=? directory config-file-directory) - (let ((directory (get-target-path (strip directory)))) + (let ((directory (target-file (strip directory)))) (catch 'system-error (lambda () (rmdir directory) @@ -145,14 +147,14 @@ (define (strip file) (string-drop file (+ 1 (string-length config-file-directory)))) - (define (get-source-path path) - (readlink (string-append config-file-directory path))) + (define (source-file file) + (readlink (string-append config-file-directory file))) (file-system-fold (const #t) ;enter? (lambda (file stat result) ;leaf - (let ((source (get-source-path (strip file))) - (target (get-target-path (strip file)))) + (let ((source (source-file (strip file))) + (target (target-file (strip file)))) (when (file-exists? target) (backup-file (strip file))) (format #t (G_ "Symlinking ~a -> ~a...") @@ -161,7 +163,7 @@ (define (get-source-path path) (display (G_ " done\n")))) (lambda (directory stat result) ;down (unless (string=? directory config-file-directory) - (let ((target (get-target-path (strip directory)))) + (let ((target (target-file (strip directory)))) (when (and (file-exists? target) (not (file-is-directory? target))) (backup-file (strip directory))) @@ -183,18 +185,17 @@ (define (get-source-path path) #$%initialize-gettext - (let* ((he-path (string-append (getenv "HOME") "/.guix-home")) - (new-he-path (string-append he-path ".new")) + (let* ((home (string-append (getenv "HOME") "/.guix-home")) + (pivot (string-append home ".new")) (new-home (getenv "GUIX_NEW_HOME")) (old-home (getenv "GUIX_OLD_HOME"))) - (when old-home (cleanup-symlinks old-home)) (create-symlinks new-home) - (symlink new-home new-he-path) - (rename-file new-he-path he-path) + (symlink new-home pivot) + (rename-file pivot home) (display (G_" done\nFinished updating symlinks.\n\n"))))))) -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:29 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:29 +0000 Received: from localhost ([127.0.0.1]:57170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0K-0004s4-KS for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0B-0004qL-EB for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:20 -0500 Received: from [2001:470:142:3::e] (port=50244 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOK01-0001Zp-Cn; Sun, 27 Feb 2022 08:54:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=kRaL04jmZdrVlSDR58XrELI9WO17jDsb7AMDz2U7LbM=; b=QFC/VUdAih5+L7iDWGXR odFHQiJjnZVNzbGkR638kbJtfpNSxCqTu8ZBZmzbKdN3+wReJdF1rnO6zW8iDI8z7y2WVPHa4/cXC bvO712P9ALmtRk25Lb/fzNw0b1hn3gXuHmicw9RSGdit5fK99vwvYRAWaOwbFxDpQHP0wEMggddO6 MCMp1CYhzgn5YZybYxGOQhOy2ug78K39mg/WgiH4M5AaxTCNeC0Y8goj0y/fxc5nLzcEUDMIRuQgG Gx0oQofwyn2OUilCyAvSLt1QGtUVSX53apK9UTYZq9tG89QNkgqyQPfyjSQ/CBwaHDG24uuUFFO0y RvXijYW/DidjyA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOJzz-0007Pg-VT; Sun, 27 Feb 2022 08:54:09 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 09/12] tests: Check 'guix home reconfigure' for a second generation. Date: Sun, 27 Feb 2022 14:53:39 +0100 Message-Id: <20220227135342.10296-9-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * tests/guix-home.sh: Invoke "guix home reconfigure" a second time with a modify config file and check the result. --- tests/guix-home.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/guix-home.sh b/tests/guix-home.sh index 3b397649cc..f054d15172 100644 --- a/tests/guix-home.sh +++ b/tests/guix-home.sh @@ -108,6 +108,7 @@ EOF # Make sure preexisting files were backed up. grep "overridden" "$HOME"/*guix-home*backup/.bashrc grep "overridden" "$HOME"/*guix-home*backup/.config/test.conf + rm -r "$HOME"/*guix-home*backup # # Test 'guix home describe'. @@ -131,6 +132,28 @@ EOF } test "$(canonical_file_name)" == "$(readlink "${HOME}/.guix-home")" + # + # Configure a new generation. + # + + # Change the bashrc snippet content and comment out one service. + sed -i "home.scm" -e's/the content of/the NEW content of/g' + sed -i "home.scm" -e"s/(simple-service 'test-config/#;(simple-service 'test-config/g" + + guix home reconfigure "${test_directory}/home.scm" + test "$(tail -n 2 "${HOME}/.bashrc")" == "\ +# dot-bashrc test file for guix home +# the NEW content of bashrc-test-config.sh" + + # This file must have been removed and not backed up. + ! test -e "$HOME/.config/test.conf" + ! test -e "$HOME"/*guix-home*backup/.config/test.conf + + test "$(cat "$(configuration_file)")" == "$(cat home.scm)" + test "$(canonical_file_name)" == "$(readlink "${HOME}/.guix-home")" + + test $(guix home list-generations | grep "^Generation" | wc -l) -eq 2 + # # Test 'guix home search'. # -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:29 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:29 +0000 Received: from localhost ([127.0.0.1]:57172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0L-0004sC-0G for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44872) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0B-0004qM-ER for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:20 -0500 Received: from [2001:470:142:3::e] (port=50242 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOJzz-0001Zi-Q1; Sun, 27 Feb 2022 08:54:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=uwkm38vquwJo7BaR1mNPNzxsggoICWpBcwabRkBK9kU=; b=SoL2WtDHSyakriqd4LUq hWWEEzOxnKbaU/DYJ4pediTZTmjAKpH3IIhj6eFnVQpOS68LyYp9Lr3ZbGhOhHZAyuHViYdXQGmMi lKlW/YYcfQ27twDF/aMPS1D/p0rbdXh+GPgVVufesXnnbuxNiTXuy5/XAK4DMJZXc6DYZo7JQ8FS+ 9wXYMfZePvDIz9kQuJg5WUYzAx3uWO5xo7FFZOlRBbjyHOI04gnGBwKlQk3Owqj4FUoVw9/0lFbOq G7A1OUhbSOgcYhmpf249XG4NsPvyMErAXcoy4f2WQdN13YRJRNhlWaqmBG1IrNeHui/15K8gZ4x1j MNv+RGVROZxN8A==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOJzw-0007Pg-SH; Sun, 27 Feb 2022 08:54:05 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 08/12] tests: Simplify use of 'local-file' in 'tests/guix-home.sh'. Date: Sun, 27 Feb 2022 14:53:38 +0100 Message-Id: <20220227135342.10296-8-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * tests/guix-home.sh: Remove 'current-filename' trickery since 'local-file' resolves file names relative to the containing file. --- tests/guix-home.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/guix-home.sh b/tests/guix-home.sh index ae3e52c9e1..3b397649cc 100644 --- a/tests/guix-home.sh +++ b/tests/guix-home.sh @@ -81,10 +81,7 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT (service home-bash-service-type (home-bash-configuration (guix-defaults? #t) - (bashrc - (list - (local-file (string-append (dirname (current-filename)) - "/dot-bashrc")))))) + (bashrc (list (local-file "dot-bashrc"))))) (simple-service 'home-bash-service-extension-test home-bash-service-type -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:29 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:29 +0000 Received: from localhost ([127.0.0.1]:57174 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0L-0004sJ-A5 for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44864) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0B-0004qK-EB for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:21 -0500 Received: from [2001:470:142:3::e] (port=50246 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOK01-0001Zv-W0; Sun, 27 Feb 2022 08:54:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=NMW+/R/OsQyNgulr9QFBN2+8U0wHfw9yN+ObmtVobdc=; b=WPvt9jkXztkvBPToshkQ e+aCkfAeWyAht8wCxOP1/yjnxmFqDRWQcE3Q7tVsUbs4EYcXP9UCRQS4HYhKeXnBRHmpyG8OqNngu twPvkWCBVbup0D0lQzBkHvuMB9EjbqnIwJOrC7k77o/t2JAvCqDATgEKpZ5ep8z6bL6BxD+ImpcxE 3MEh9oc1c/N0XEFA6xshShJfd+P7wOqb+Nd/px2qn44NdjW8lEesS28em+j86E56d7GzmXV2BYggY DnFlgIOcs2kxStPXia1827onSltihg6WcTXdo4iwlgwlrRVdt6ob1GOjrZwS1/tAxkmKJx0FzpyjE qs7W/V/yJ/Dy8Q==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOK01-0007Pg-IS; Sun, 27 Feb 2022 08:54:09 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 10/12] home: symlink-manager: 'cleanup-symlinks' uses 'file-system-fold'. Date: Sun, 27 Feb 2022 14:53:40 +0100 Message-Id: <20220227135342.10296-10-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/home/services/symlink-manager.scm (update-symlinks-script)[cleanup-symlinks]: Take a home generation and iterate over its config files directly with 'file-system-fold'. Adjuster caller accordingly. Remove 'old-tree'. --- gnu/home/services/symlink-manager.scm | 107 ++++++++++++++------------ 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index ba42424e8e..4f827c0360 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -118,51 +118,63 @@ (define (backup-file path) (rename-file (get-target-path path) (get-backup-path path)) (display (G_ " done\n"))) - (define (cleanup-symlinks old-tree) - ;; Delete from directory OLD-TREE symlinks that correspond to a - ;; previous generation. - (let ((to-delete ((file-tree-traverse #f) old-tree))) - (display - (G_ - "Cleaning up symlinks from previous home-environment.\n\n")) - (for-each - (match-lambda - (('dir . ".") - (display (G_ "Cleanup finished.\n\n"))) + (define (cleanup-symlinks home-generation) + ;; Delete from $HOME files that originate in HOME-GENERATION, the + ;; store item containing a home generation. + (define config-file-directory + ;; Note: Trailing slash is needed because "files" is a symlink. + (string-append home-generation "/files/")) - (('dir . directory) - (let ((directory (get-target-path directory))) - (catch 'system-error - (lambda () - (rmdir directory) - (format #t (G_ "Removed ~a.\n") directory)) - (lambda args - (let ((errno (system-error-errno args))) - (cond ((= ENOTEMPTY errno) - (format - #t - (G_ "Skipping ~a (not an empty directory)...\n") - directory)) - ((= ENOTDIR errno) - #t) - (else - (apply throw args)))))))) + (define (strip file) + (string-drop file + (+ 1 (string-length config-file-directory)))) - (('file . path) - (when (file-exists? (get-target-path path)) - ;; DO NOT remove the file if it is no longer a symlink to - ;; the store, it will be backed up later during - ;; create-symlinks phase. - (if (symlink-to-store? (get-target-path path)) - (begin - (format #t (G_ "Removing ~a...") (get-target-path path)) - (delete-file (get-target-path path)) - (display (G_ " done\n"))) - (format - #t - (G_ "Skipping ~a (not a symlink to store)... done\n") - (get-target-path path)))))) - to-delete))) + (format #t (G_ "Cleaning up symlinks from previous home at ~a.~%") + home-generation) + (newline) + + (file-system-fold + (const #t) + (lambda (file stat _) ;leaf + (let ((file (get-target-path (strip file)))) + (when (file-exists? file) + ;; DO NOT remove the file if it is no longer a symlink to + ;; the store, it will be backed up later during + ;; create-symlinks phase. + (if (symlink-to-store? file) + (begin + (format #t (G_ "Removing ~a...") file) + (delete-file file) + (display (G_ " done\n"))) + (format #t + (G_ "Skipping ~a (not a symlink to store)... done\n") + file))))) + + (const #t) ;down + (lambda (directory stat _) ;up + (unless (string=? directory config-file-directory) + (let ((directory (get-target-path (strip directory)))) + (catch 'system-error + (lambda () + (rmdir directory) + (format #t (G_ "Removed ~a.\n") directory)) + (lambda args + (let ((errno (system-error-errno args))) + (cond ((= ENOTEMPTY errno) + (format + #t + (G_ "Skipping ~a (not an empty directory)...\n") + directory)) + ((= ENOTDIR errno) #t) + (else + (apply throw args))))))))) + (const #t) ;skip + (const #t) ;error + #t ;init + config-file-directory + lstat) + + (display (G_ "Cleanup finished.\n\n"))) (define (create-symlinks new-tree new-files-path) ;; Create in directory NEW-TREE symlinks to the files under @@ -215,16 +227,11 @@ (define (get-source-path path) ;; to make file-system-tree works it should be a directory. (new-files-dir-path (string-append new-files-path "/.")) - (old-tree (if old-home - ((simplify-file-tree "") - (file-system-tree - (string-append old-home "/files/."))) - #f)) (new-tree ((simplify-file-tree "") (file-system-tree new-files-dir-path)))) - (when old-tree - (cleanup-symlinks old-tree)) + (when old-home + (cleanup-symlinks old-home)) (create-symlinks new-tree new-files-path) -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:30 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:30 +0000 Received: from localhost ([127.0.0.1]:57176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0L-0004sQ-QL for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44874) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0B-0004qP-FP for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:21 -0500 Received: from [2001:470:142:3::e] (port=50248 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOK02-0001Zw-LK; Sun, 27 Feb 2022 08:54:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=Wc3wWS4w0MygLoS4JJqop3sbWx6tOsj/j8PiSyRTIq8=; b=QBxoS6gwSTCHqY+wW+7m 08ZunIRutzf1wX8u3LADR2V0p2FM6wMw0Fer0yoJ/hF/92FpXoqynr3t18z46vFqqIY2aVlakma7i Dzu2K1fht+skK+4/EoHiBxMCAaKrwBwlym2hYEpyuXXAi+1bXH7iivgqUZ2EjrLpzURSAKv65OrlR fVyY+mwHsrwgfOVYbrL/nQirMkXUML2ENbJkPCp26C0FYJPBbkCOYW1KzAQAtVY7/YuXCgrzre+eu D07nVRjlKCC17lw6EGwCPgK6YOjNL17sBYLhp/ww0Cc5CvIiI2rBWmMoL2JALjzXs0F1EO/ChcpIz DfdbvRP5MJXFZw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOK02-0007Pg-5H; Sun, 27 Feb 2022 08:54:10 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 11/12] home: symlink-manager: 'create-symlinks' uses 'file-system-fold'. Date: Sun, 27 Feb 2022 14:53:41 +0100 Message-Id: <20220227135342.10296-11-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This removes the need for two intermediate representations of the file tree. * gnu/home/services/symlink-manager.scm (update-symlinks-script) [simplify-file-tree, file-tree-traverse]: Remove. [create-symlinks]: Rewrite in terms of 'file-system-fold'. --- gnu/home/services/symlink-manager.scm | 130 +++++++++----------------- 1 file changed, 44 insertions(+), 86 deletions(-) diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index 4f827c0360..16e2e7b772 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -43,52 +43,11 @@ (define (update-symlinks-script) (guix i18n))) #~(begin (use-modules (ice-9 ftw) - (ice-9 curried-definitions) (ice-9 match) (srfi srfi-1) (guix i18n) (guix build utils)) - (define ((simplify-file-tree parent) file) - "Convert the result produced by `file-system-tree' to less -verbose and more suitable for further processing format. - -Extract dir/file info from stat and compose a relative path to the -root of the file tree. - -Sample output: - -((dir . \".\") - ((dir . \"config\") - ((dir . \"config/fontconfig\") - (file . \"config/fontconfig/fonts.conf\")) - ((dir . \"config/isync\") - (file . \"config/isync/mbsyncrc\")))) -" - (match file - ((name stat) `(file . ,(string-append parent name))) - ((name stat children ...) - (cons `(dir . ,(string-append parent name)) - (map (simplify-file-tree - (if (equal? name ".") - "" - (string-append parent name "/"))) - children))))) - - (define ((file-tree-traverse preordering) node) - "Traverses the file tree in different orders, depending on PREORDERING. - -if PREORDERING is @code{#t} resulting list will contain directories -before files located in those directories, otherwise directory will -appear only after all nested items already listed." - (let ((prepend (lambda (a b) (append b a)))) - (match node - (('file . path) (list node)) - ((('dir . path) . rest) - ((if preordering append prepend) - (list (cons 'dir path)) - (append-map (file-tree-traverse preordering) rest)))))) - (define home-path (getenv "HOME")) @@ -176,64 +135,63 @@ (define (strip file) (display (G_ "Cleanup finished.\n\n"))) - (define (create-symlinks new-tree new-files-path) - ;; Create in directory NEW-TREE symlinks to the files under - ;; NEW-FILES-PATH, creating backups as needed. + (define (create-symlinks home-generation) + ;; Create in $HOME symlinks for the files in HOME-GENERATION. + (define config-file-directory + ;; Note: Trailing slash is needed because "files" is a symlink. + (string-append home-generation "/files/")) + + (define (strip file) + (string-drop file + (+ 1 (string-length config-file-directory)))) + (define (get-source-path path) - (readlink (string-append new-files-path "/" path))) + (readlink (string-append config-file-directory path))) - (let ((to-create ((file-tree-traverse #t) new-tree))) - (for-each - (match-lambda - (('dir . ".") - (display - (G_ "New symlinks to home-environment will be created soon.\n")) - (format - #t (G_ "All conflicting files will go to ~a.\n\n") backup-dir)) + (file-system-fold + (const #t) ;enter? + (lambda (file stat result) ;leaf + (let ((source (get-source-path (strip file))) + (target (get-target-path (strip file)))) + (when (file-exists? target) + (backup-file (strip file))) + (format #t (G_ "Symlinking ~a -> ~a...") + target source) + (symlink source target) + (display (G_ " done\n")))) + (lambda (directory stat result) ;down + (unless (string=? directory config-file-directory) + (let ((target (get-target-path (strip directory)))) + (when (and (file-exists? target) + (not (file-is-directory? target))) + (backup-file (strip directory))) - (('dir . path) - (let ((target-path (get-target-path path))) - (when (and (file-exists? target-path) - (not (file-is-directory? target-path))) - (backup-file path)) - - (if (file-exists? target-path) - (format - #t (G_ "Skipping ~a (directory already exists)... done\n") - target-path) - (begin - (format #t (G_ "Creating ~a...") target-path) - (mkdir target-path) - (display (G_ " done\n")))))) - - (('file . path) - (when (file-exists? (get-target-path path)) - (backup-file path)) - (format #t (G_ "Symlinking ~a -> ~a...") - (get-target-path path) (get-source-path path)) - (symlink (get-source-path path) (get-target-path path)) - (display (G_ " done\n")))) - to-create))) + (catch 'system-error + (lambda () + (mkdir target)) + (lambda args + (let ((errno (system-error-errno args))) + (unless (= EEXIST errno) + (format #t (G_ "failed to create directory ~a: ~s~%") + target (strerror errno)) + (apply throw args)))))))) + (const #t) ;up + (const #t) ;skip + (const #t) ;error + #t ;init + config-file-directory)) #$%initialize-gettext (let* ((he-path (string-append (getenv "HOME") "/.guix-home")) (new-he-path (string-append he-path ".new")) (new-home (getenv "GUIX_NEW_HOME")) - (old-home (getenv "GUIX_OLD_HOME")) - - (new-files-path (string-append new-home "/files")) - ;; Trailing dot is required, because files itself is symlink and - ;; to make file-system-tree works it should be a directory. - (new-files-dir-path (string-append new-files-path "/.")) - - (new-tree ((simplify-file-tree "") - (file-system-tree new-files-dir-path)))) + (old-home (getenv "GUIX_OLD_HOME"))) (when old-home (cleanup-symlinks old-home)) - (create-symlinks new-tree new-files-path) + (create-symlinks new-home) (symlink new-home new-he-path) (rename-file new-he-path he-path) -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:30 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:30 +0000 Received: from localhost ([127.0.0.1]:57178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0M-0004sY-Cb for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0A-0004qG-Pn for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:23 -0500 Received: from [2001:470:142:3::e] (port=50234 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOJzu-0001ZT-Fp; Sun, 27 Feb 2022 08:54:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=Iu6fW84CZKtG3DrzzEXHBBf/kxZvuu3PydhwG5xiicQ=; b=Difn/DnBQW8tY8Rs877v dOwBCzxQnzkpyA+qKWlmfjQhY/NRX8V8EiunXft4s4mCoAhCCuNHJ8dkLO87j8HotqfKlSN8jLbVd AV9HcDmo+F4toy3Iv2w0/mWAP4peTMZ2BlJDLap1CcDlyp1BUy/tou/3QgA4INgEsgLLKRNQkelZK ptrdykxIDayO4jKbK+CpMv/aZl5fvBGTLMVPoxixVSNpcjetp0mdReZlJxTuf8lFqtVfn5uX+nWHK OepMaj7M44YtvfjrSYe4uidcv5tmiS9/FHUjVKRyD4oe79d87cDJK6RY+y9cn63YJX01beQxLMy8+ EIiCXNSqCb2N8w==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOJzs-0007Pg-SH; Sun, 27 Feb 2022 08:54:02 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 04/12] home: symlink-manager: Use 'file-is-directory?'. Date: Sun, 27 Feb 2022 14:53:34 +0100 Message-Id: <20220227135342.10296-4-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/home/services/symlink-manager.scm (update-symlinks-script)[directory?]: Remove. Change callers to use 'file-is-directory?' instead. --- gnu/home/services/symlink-manager.scm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm index a6344c808f..f133eb17f2 100644 --- a/gnu/home/services/symlink-manager.scm +++ b/gnu/home/services/symlink-manager.scm @@ -101,9 +101,6 @@ (define (get-target-path path) (define (get-backup-path path) (string-append backup-dir "/." path)) - (define (directory? path) - (equal? (stat:type (stat path)) 'directory)) - (define (empty-directory? dir) (equal? (scandir dir) '("." ".."))) @@ -133,7 +130,7 @@ (define (cleanup-symlinks old-tree) (('dir . path) (if (and (file-exists? (get-target-path path)) - (directory? (get-target-path path)) + (file-is-directory? (get-target-path path)) (empty-directory? (get-target-path path))) (begin (format #t (G_ "Removing ~a...") @@ -179,7 +176,7 @@ (define (get-source-path path) (('dir . path) (let ((target-path (get-target-path path))) (when (and (file-exists? target-path) - (not (directory? target-path))) + (not (file-is-directory? target-path))) (backup-file path)) (if (file-exists? target-path) -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 08:54:31 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 13:54:31 +0000 Received: from localhost ([127.0.0.1]:57180 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0M-0004sf-MP for submit@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOK0A-0004qH-Ps for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 08:54:25 -0500 Received: from [2001:470:142:3::e] (port=50240 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOJzw-0001Zc-Mf; Sun, 27 Feb 2022 08:54:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=rUm49j68/EWeFH8IeWP5cuqsDExkhaRgEo7KyXRQJD0=; b=rUy7dXm2drVZZuu6Z47v CdZhn4dqkLxD3/wV5YTKhDeNjX7MpFHXtDZdyvVMgta1LxhL0+ErNIiut1B1G4wFUh+UNQ5sHqEKJ 6GM0GZyl/JVIwmle8o4TEejPs6jjMFxBTbNcyeJC/tu0Y06uvYZRIgBXlNNKFs0DjuW4HqbnlbA5l wXO1/5r1l7q0/b04bptGXMUQftgXjRtrgoe+2mIy8NX9sYOJQ/GaAbbdE0I0y5NCvSzxbKSo32//H AmPEZDKekeI8QDMWroRIoNJvwGH8tDPrCBSLr75ZihGNjaSWpuC9zqBlf0iTWvdvXj/n7IVC1ngX+ YPUp7PrD4BPv5w==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55804 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOJzw-0007Pg-8Q; Sun, 27 Feb 2022 08:54:04 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 54180@debbugs.gnu.org Subject: [PATCH 07/12] tests: Make sure 'guix home reconfigure' backs up files. Date: Sun, 27 Feb 2022 14:53:37 +0100 Message-Id: <20220227135342.10296-7-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220227135342.10296-1-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * tests/guix-home.sh: Create ~/.bashrc and ~/.config/test.conf prior to 'reconfigure' and check whether they were backed up. --- tests/guix-home.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/guix-home.sh b/tests/guix-home.sh index e578559c97..ae3e52c9e1 100644 --- a/tests/guix-home.sh +++ b/tests/guix-home.sh @@ -1,7 +1,7 @@ - # GNU Guix --- Functional package management for GNU # Copyright © 2021 Andrew Tropin # Copyright © 2021 Oleg Pykhalov +# Copyright © 2022 Ludovic Courtès # # This file is part of GNU Guix. # @@ -54,7 +54,12 @@ trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT # Test 'guix home reconfigure'. # - printf "# dot-bashrc test file for guix home" > "dot-bashrc" + echo "# This file will be overridden and backed up." > "$HOME/.bashrc" + mkdir "$HOME/.config" + echo "This file will be overridden too." > "$HOME/.config/test.conf" + echo "This file will stay around." > "$HOME/.config/random-file" + + echo -n "# dot-bashrc test file for guix home" > "dot-bashrc" cat > "home.scm" <<'EOF' (use-modules (guix gexp) @@ -100,6 +105,13 @@ EOF # the content of bashrc-test-config.sh" grep -q "the content of ~/.config/test.conf" "${HOME}/.config/test.conf" + # This one should still be here. + grep "stay around" "$HOME/.config/random-file" + + # Make sure preexisting files were backed up. + grep "overridden" "$HOME"/*guix-home*backup/.bashrc + grep "overridden" "$HOME"/*guix-home*backup/.config/test.conf + # # Test 'guix home describe'. # -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 10:49:33 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 15:49:33 +0000 Received: from localhost ([127.0.0.1]:58904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOLnh-00089f-28 for submit@debbugs.gnu.org; Sun, 27 Feb 2022 10:49:33 -0500 Received: from xavier.telenet-ops.be ([195.130.132.52]:47378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOLnf-00089X-Cl for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 10:49:31 -0500 Received: from [192.168.158.254] ([188.188.52.46]) by xavier.telenet-ops.be with bizsmtp id 0FpV2700G0zovbQ01FpWzS; Sun, 27 Feb 2022 16:49:30 +0100 Message-ID: Subject: Re: [bug#54180] [PATCH 09/12] tests: Check 'guix home reconfigure' for a second generation. From: Maxime Devos To: Ludovic =?ISO-8859-1?Q?Court=E8s?= , 54180@debbugs.gnu.org Date: Sun, 27 Feb 2022 16:49:29 +0100 In-Reply-To: <20220227135342.10296-9-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-9-ludo@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-vTYwIDV/LouJ98JK4b6/" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1645976970; bh=Gk33OqqhBVwFKIUc8zVsTFfiaIxLMyTq903X+YE+UuY=; h=Subject:From:To:Date:In-Reply-To:References; b=mxv93ds5Y7P4dQGgYr6cQhVPUfwPIF0ZKeo+He6smcyThChqWjsIEFsh995iLG8O/ caDUPI2sTcitHeiwz6KQHthKplAU5/gIJYSWY10G9LpGbhkKRz2D89FpMHdKmUYBzV Nr+klx2CyzG1PMb6tbChWhFdrfuG0QdpbznF1jbyimhhZnr/di9ldhafr0+d6nwpuH P0rtAEf8RNu/3Yk8uYsDbnWlNJwdYFGcJ53eRAIWY6fWfloaFUmSAuOykuePsDqHXA Qkkwso8YH+Pqy12wGwauYVCg0ZifOGvvEo40pPx8eAL2+NdU1aAV/qP6QzCBhNNrzb hpu6Y0u1z6BpA== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 54180 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-vTYwIDV/LouJ98JK4b6/ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s schreef op zo 27-02-2022 om 14:53 [+0100]: > * tests/guix-home.sh: Invoke "guix home reconfigure" a second time with > a modify config file and check the result. Something I don't understand, is why these tests are bash scripts in the first place. Wouldn't Scheme code suffice and be easier to reason about? For example, Scheme code would avoid repeating the complicated code for starting a daemon and making sure it exits in every .sh test. Greetings Maxime. --=-vTYwIDV/LouJ98JK4b6/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhudiRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7q+iAP9B5gMixK+bbCJVsJHFqQMvQB8D n2yvBg/s4K2zWOkGAAEAxDjHMuHEGj+tkFTzB/5yKBQpgb4OLu9pkqLUyuFECQk= =bEX3 -----END PGP SIGNATURE----- --=-vTYwIDV/LouJ98JK4b6/-- From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 10:52:29 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 15:52:29 +0000 Received: from localhost ([127.0.0.1]:58946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOLqW-0008Fn-QP for submit@debbugs.gnu.org; Sun, 27 Feb 2022 10:52:28 -0500 Received: from xavier.telenet-ops.be ([195.130.132.52]:50122) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOLqV-0008Ff-C8 for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 10:52:28 -0500 Received: from [192.168.158.254] ([188.188.52.46]) by xavier.telenet-ops.be with bizsmtp id 0FsS270010zovbQ01FsSKY; Sun, 27 Feb 2022 16:52:26 +0100 Message-ID: <20596558fd7521908095e3c10369bd050efc40a4.camel@telenet.be> Subject: Re: [bug#54180] [PATCH 06/12] home: symlink-manager: Avoid extra 'lstat' call. From: Maxime Devos To: Ludovic =?ISO-8859-1?Q?Court=E8s?= , 54180@debbugs.gnu.org Date: Sun, 27 Feb 2022 16:52:25 +0100 In-Reply-To: <20220227135342.10296-6-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-6-ludo@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-i9co6B5jLCRFbnNPM6XT" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1645977146; bh=oFDL/zTyxezZnh83xzwKmzwVTCq9qTsvjP8++tRKsTc=; h=Subject:From:To:Date:In-Reply-To:References; b=AD1/8QwQty89lQ7kFn5q3mGrz39GCXZzDtV5fduR6TTU1trp9mx/5VGqyoQiI1I8Q X9Kz3ocsq8orJ0banfGYFexfWFAmcB2RZiYFpFPtcFPV38zqJOKbHvUlUnSVBpVd7j owjsqq4gDwVX93Dd73JH+u/+clh0YmS2Um/hACF4eCiv5ZxDR0hqqQzUtt7gc0aL75 KpLjGNO7PJR2RKpLUzM07U8EQyqCqjIY54CdnemUeYmS2HjNiT/ZXzYKF7w0jq1xjo cg71dzoLyMRW3iz5BtKB7be0IXEYnvD3xg+9ATyWzEePtEvym8+fRSYNWQf4FfWkSr Hekv10Q76plxg== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 54180 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-i9co6B5jLCRFbnNPM6XT Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: base64 THVkb3ZpYyBDb3VydMOocyBzY2hyZWVmIG9wIHpvIDI3LTAyLTIwMjIgb20gMTQ6NTMgWyswMTAw XToKPiDCoMKgwqDCoMKgwqDCoMKgwqAgKGRlZmluZSAoc3ltbGluay10by1zdG9yZT8gcGF0aCkK PiAtwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGFuZCAoZXF1YWw/IChzdGF0OnR5cGUgKGxzdGF0IHBh dGgpKSAnc3ltbGluaykKPiAtwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChzdG9yZS1m aWxlLW5hbWU/IChyZWFkbGluayBwYXRoKSkpKQo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoCAoY2F0 Y2ggJ3N5c3RlbS1lcnJvcgo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGxhbWJkYSAoKQo+ ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChzdG9yZS1maWxlLW5hbWU/IChyZWFkbGlu ayBwYXRoKSkpCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAobGFtYmRhIGFyZ3MKPiArwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAoaWYgKD0gRUlOVkFMIChzeXN0ZW0tZXJyb3ItZXJy bm8gYXJncykpCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAjZgo+ICvC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGFwcGx5IHRocm93IGFyZ3MpKSkp KQoKSSB0aGluayBpdCB3b3VsZCBiZSBzbGlnaHRseSBjbGVhcmVyIGlmICdzdG9yZS1maWxlLW5h bWU/JyB3YXMgbW92ZWQKb3V0c2lkZSB0aGUgY2F0Y2g6CgogIChhbmQ9PiAoY2F0Y2ggJ3N5c3Rl bS1lcnJvciAobGFtYmRhICgpIChyZWFkbGluayBwYXRoKSkgWy4uLl0pCiAgICAgICAgIHN0b3Jl LWZpbGUtbmFtZT8pCgpJdCBpcyAncmVhZGxpbmsnIHRoYXQgbWlnaHQgdGhyb3cgYW4gZXhjZXB0 aW9uLCBub3QgJ3N0b3JlLWZpbGUtbmFtZT8nLgoKR3JlZXRpbmdzLApNYXhpbWUuCg== --=-i9co6B5jLCRFbnNPM6XT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhueORccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7sAqAP9MWTtllzlc25dMqP7XBK+HAnC+ LmTcUudzYKkACffetAD/f/K95IG1ssZzMy/cSlSaKPgLD6NOX9UZYHNTBck6kAc= =Csaj -----END PGP SIGNATURE----- --=-i9co6B5jLCRFbnNPM6XT-- From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 10:55:01 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 15:55:01 +0000 Received: from localhost ([127.0.0.1]:58977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOLsy-0008Kd-Oa for submit@debbugs.gnu.org; Sun, 27 Feb 2022 10:55:00 -0500 Received: from baptiste.telenet-ops.be ([195.130.132.51]:46358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOLsw-0008KU-T6 for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 10:54:59 -0500 Received: from [192.168.158.254] ([188.188.52.46]) by baptiste.telenet-ops.be with bizsmtp id 0Fuw270050zovbQ01Fuwot; Sun, 27 Feb 2022 16:54:57 +0100 Message-ID: Subject: Re: [bug#54180] [PATCH 05/12] home: symlink-manager: Remove 'empty-directory?' and avoid TOCTTOU race. From: Maxime Devos To: Ludovic =?ISO-8859-1?Q?Court=E8s?= , 54180@debbugs.gnu.org Date: Sun, 27 Feb 2022 16:54:56 +0100 In-Reply-To: <20220227135342.10296-5-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-5-ludo@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-x6zeRj3dXb/eYPCIIq7L" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1645977297; bh=aF8HST1BztPfQq/LJrzKvGdPbQOus3AsU3zRAKUm0QI=; h=Subject:From:To:Date:In-Reply-To:References; b=SkvdTLF+NdhX7hS4SgC6jRBXaCZ8doDehoyOVY2IRuijmYCJXtmkNCPIoRefP2pKJ XKbqOvBmqz/Xs8wEei/zPAaGc4B4V+Lt3EAcXyxOx58Er0wC0yxc2b40WRqujfiKpV atSnU7l0yGaLJU5tlhRA8QM0jaO+OiIwduV+2V+kY0iCO3HHm7e2SDTcIOE4BBWH6m Uj3R83U8WDjAYTRVnJj1d4ibjKSYcb5w3qrvCjdAMqpbthJPEKXE+c7cPPI/W6WLG3 59Ja6b0obhkEEu//luGR457a17FT4Wmw9ZQlbOE8HlGggvZiIjch1N6FLClK0AtGhP zoaLSj/LV7RDQ== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 54180 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-x6zeRj3dXb/eYPCIIq7L Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: base64 THVkb3ZpYyBDb3VydMOocyBzY2hyZWVmIG9wIHpvIDI3LTAyLTIwMjIgb20gMTQ6NTMgWyswMTAw XToKPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGxldCAoKGRpcmVjdG9yeSAo Z2V0LXRhcmdldC1wYXRoIGRpcmVjdG9yeSkpKQo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqAgKGNhdGNoICdzeXN0ZW0tZXJyb3IKPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoCAobGFtYmRhICgpCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgIChybWRpciBkaXJlY3RvcnkpCj4gK8KgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChmb3JtYXQgI3QgKEdfICJSZW1vdmVkIH5h LlxuIikgZGlyZWN0b3J5KSkKPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoCAobGFtYmRhIGFyZ3MKPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqAgKGxldCAoKGVycm5vIChzeXN0ZW0tZXJyb3ItZXJybm8gYXJncykpKQo+ICvCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGNvbmQgKCg9IEVO T1RFTVBUWSBlcnJubykKPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGZvcm1hdAo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICN0Cj4gK8KgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAg KEdfICJTa2lwcGluZyB+YSAobm90IGFuIGVtcHR5IGRpcmVjdG9yeSkuLi5cbiIpCj4gK8KgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqAgZGlyZWN0b3J5KSkKPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgICgoPSBFTk9URElSIGVycm5vKQo+ICvCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAjdCkKPiAr wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgIChlbHNlCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgIChhcHBseSB0aHJvdyBhcmdzKSkpKSkpKSkKCkxpa2Ugd2l0aCBt eSBjb21tZW50IG9uIOKAmEF2b2lkIGV4dHJhICdsc3RhdCBjYWxsLuKAmSwgSSB3b3VsZCBtb3Zl IHRoZQooZm9ybWF0ICN0IChHXyAiUmVtb3ZlZCB+YS5cbiIpIGRpcmVjdG9yeSkgb3V0c2lkZSB0 aGUgY2F0Y2guCgpJZiAnZm9ybWF0JyBzb21laG93IHRocm93cyBhIEVOT1RFTVBUWS9FTk9URElS IHN5c3RlbS1lcnJvciwgc29tZXRoaW5nCmlzIHZlcnkgd3JvbmcuCgpHcmVldGluZ3MsCk1heGlt ZS4K --=-x6zeRj3dXb/eYPCIIq7L Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhue0BccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7j6iAQCsICNSwFBXqofjC2nbCBKZRCx0 BbWT9jCPAVGKmw8apQEAjgJSHkNL9WJDEGvj+RZGSJ423J1ECdfaqBv1pl7j2g4= =0lGV -----END PGP SIGNATURE----- --=-x6zeRj3dXb/eYPCIIq7L-- From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 10:58:13 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 15:58:13 +0000 Received: from localhost ([127.0.0.1]:58990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOLw4-0008QB-Vm for submit@debbugs.gnu.org; Sun, 27 Feb 2022 10:58:13 -0500 Received: from xavier.telenet-ops.be ([195.130.132.52]:55554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOLw3-0008Q3-90 for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 10:58:11 -0500 Received: from [192.168.158.254] ([188.188.52.46]) by xavier.telenet-ops.be with bizsmtp id 0Fy92700S0zovbQ01FyAww; Sun, 27 Feb 2022 16:58:10 +0100 Message-ID: <66bb9a617542057fe6c536631927d94c530dc173.camel@telenet.be> Subject: Re: [bug#54180] [PATCH 02/12] home: symlink-manager: Move helper procedures as top-level defines. From: Maxime Devos To: Ludovic =?ISO-8859-1?Q?Court=E8s?= , 54180@debbugs.gnu.org Date: Sun, 27 Feb 2022 16:58:09 +0100 In-Reply-To: <20220227135342.10296-2-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-2-ludo@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-OdBO8BWLSFlM1hg5/I1P" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1645977490; bh=Kz1nN0xxDcshogZXUKaz8PNG3d7J0Qdu1KmDnzHdl6g=; h=Subject:From:To:Date:In-Reply-To:References; b=Ej4pBRx4zfHQodjt2WhFfmgE0LCZg73JYVieq9T/Fwtes/c4BVGLSCS6N2V1OkS0D uPWXM6pWF2630Nqz8mzIVXDZAizzaB+11TvGUIktxE9xW8colQe96jMxrn/fu7W2l8 airUtodb67C7GA6+ej0Y33wZ1ooTjACPtZo6LrJ/Dq5p+bvV+/SJjvtP96zYF6CKG+ 10Yv4XUOKDTJ2kyLoJ04t4S+HUjQAmgFnc/Gr6D8Ot9vUEQbdhjY7TR2tGPqbxwu4D BXW1aYbf/FsKF1SYTJBf3iY+KRTAJdRilEe/7DrO2sl1w2b3chx7Yr+K0GHIwq9r74 34I46yR+x8v9w== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 54180 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-OdBO8BWLSFlM1hg5/I1P Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s schreef op zo 27-02-2022 om 14:53 [+0100]: > (file-exists? (get-target-path path)) > [... other uses of file-exists? ...] 'file-exists?' does not simply check whether the file exists. E.g., when there is some permission error, then it returns #false. I think that in case of an permission error, it would best be reported to the user, so I think a variant of 'file-exists?' may be needed. Greetings, Maxime. --=-OdBO8BWLSFlM1hg5/I1P Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhufkRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7vhKAQCO8mJ4cSzAmzZVN2RmVm7bmSpG CZNdU1OdgDo2Q7r5bAD8DtN8h6+aiRKMFVxmqIwTgkqpCo1N6hLUowDqrc+h8Qs= =Euq0 -----END PGP SIGNATURE----- --=-OdBO8BWLSFlM1hg5/I1P-- From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 27 11:00:31 2022 Received: (at 54180) by debbugs.gnu.org; 27 Feb 2022 16:00:31 +0000 Received: from localhost ([127.0.0.1]:59022 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOLyJ-0008WT-Dr for submit@debbugs.gnu.org; Sun, 27 Feb 2022 11:00:31 -0500 Received: from xavier.telenet-ops.be ([195.130.132.52]:57814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOLyI-0008WK-4H for 54180@debbugs.gnu.org; Sun, 27 Feb 2022 11:00:30 -0500 Received: from [192.168.158.254] ([188.188.52.46]) by xavier.telenet-ops.be with bizsmtp id 0G0U270060zovbQ01G0VHi; Sun, 27 Feb 2022 17:00:29 +0100 Message-ID: <0091dbaa43a26d44aca034f83ed79eb5658a8b38.camel@telenet.be> Subject: Re: [bug#54180] [PATCH 11/12] home: symlink-manager: 'create-symlinks' uses 'file-system-fold'. From: Maxime Devos To: Ludovic =?ISO-8859-1?Q?Court=E8s?= , 54180@debbugs.gnu.org Date: Sun, 27 Feb 2022 17:00:28 +0100 In-Reply-To: <20220227135342.10296-11-ludo@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-11-ludo@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-CartIkb1Fh5wh27+Gf4F" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1645977629; bh=a9DpG5tyxp14XXh4nVCvac/uD1bWA4Hju73H1QZOh78=; h=Subject:From:To:Date:In-Reply-To:References; b=APEAuoJlHATc4wSrv7df8niavlInL2lRumXEgri9zXH4UZk1NNd/xGC0uSuXBR3G+ T3M2XXGXeIXFCaCtsDPtwBIQ8b32TwgOVAIqYs4a4V4tNtVH6e2+FzIUUTtG6R+2Ji HAjztpnfjYgIBUXnlzTuuQb2ty2LIda5Lk+1fMCMMmGTZ6+bANddMoEagmWy5FfSTu q3Kxwc+Qak5C2660lu6oKlEtvQ+fr4NCABQH3hzez6IDLoy71LYZobBwjgiboSwXH3 RmAuHG4OR01zRsWxq7RDdUG4h5RyTKCjZ25+JuGnE/8vBGA3JcC5ZIafjEMkYSJhbH BEZuNilZk1pEw== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 54180 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-CartIkb1Fh5wh27+Gf4F Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s schreef op zo 27-02-2022 om 14:53 [+0100]: >=20 > + (catch 'system-error > + (lambda () > + (mkdir target)) > + (lambda args > + (let ((errno (system-error-errno args))) > + (unless (=3D EEXIST errno) > + (format #t (G_ "failed to create directory ~a:= ~s~%") > + target (strerror errno)) > + (apply throw args)))))))) This error reporting seems new, perhaps something for a separate commit? Greetings, Maxime. --=-CartIkb1Fh5wh27+Gf4F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYhugHBccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7vXLAP9NaxXulnHpjyUpJW8IWpfIuc90 SYWI576zM2iRHHZBdgEA1hmih2gWgOxOpT4eO9LLbsgaEnWyPTsbOY846eMuWws= =8zwp -----END PGP SIGNATURE----- --=-CartIkb1Fh5wh27+Gf4F-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 28 02:53:30 2022 Received: (at 54180) by debbugs.gnu.org; 28 Feb 2022 07:53:30 +0000 Received: from localhost ([127.0.0.1]:59911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOaqX-0000Oq-RY for submit@debbugs.gnu.org; Mon, 28 Feb 2022 02:53:30 -0500 Received: from mail-lj1-f169.google.com ([209.85.208.169]:40493) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOaqW-0000Ob-4z for 54180@debbugs.gnu.org; Mon, 28 Feb 2022 02:53:28 -0500 Received: by mail-lj1-f169.google.com with SMTP id v22so16185845ljh.7 for <54180@debbugs.gnu.org>; Sun, 27 Feb 2022 23:53:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop-in.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=86JE2JeCzzwWza+hHdX3zaGzNCJabsTk0GbxjZswVZ0=; b=2bOsfkO25DyBPdxnFqZ+vrpP294BxIBZ+RN+4jlHvo7GFlr1MHx+thlkF1wFDd0C14 jQItR3KCmZws6f4hGU8Or/G2X6x/KyFCBbCLqdRWpGGzSJxNDwL+C+vWnGNglTQQs8JS PF5CnNZxACZ5D/9kN3mQjY2vlTm3rGHKXS5cVACpVoCAi78vlccsqinbo7O5wYa6qcDC rVzjZx9vTNPqn1EsQRVmzPjFjb3oRIfmTWlUO4M2nXoMH3E386cyakiPwZhY5J9r+V28 2C2T/WQ/8Xg0rNsVeMWgbEFj9CnhxemwuXXc4Uk6qA4mASZ3Q/qG85tmFId7qgyci+1q YPHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=86JE2JeCzzwWza+hHdX3zaGzNCJabsTk0GbxjZswVZ0=; b=O2HNeRMOgV/liuLYVaek3EZpUcB7iuncr6lUeQrn+bilAU4O1vAGPMk8AVt8pZ6dJ1 Cr15wgYZ5LOBmQk+7UHVXgetUYzIQQTqjVYz9tIgiB6p30+ZstX/WxhrppO3cbFF3Kto dgXviengwNcUrxdH9lKCNBT0N7KYOowY+KTXKc2P0soJ2Tc/0Ty1m1gffUv7r4hxBryl ZaFY6xi6eNfZslhesJiBUlh1sLxaMxV6qNn40ttaq/xhCUkBo2MBMXwCNxO2TKNCWcuD +gQCQI/uDalTYu+DW4uDzfPduoV3HaDR5r9iNaM9H02DZDTVLR/LNceoPrH8c9LMqSvh NjFQ== X-Gm-Message-State: AOAM5337HbgqwLKX8jTxCyYWTL4jxbWfA8GNM7WL8rgFf0tDfJdr5gqa uwiTNdM0Ry8VGiiNlAAOOO+nrw== X-Google-Smtp-Source: ABdhPJzzzddQQ+xINdwgWXurqx2qrFs4f5re0SVQ3YFOgxyIgjrZ6zyc1pwfRtRPmR7UiO0vWfqXEg== X-Received: by 2002:a2e:b604:0:b0:246:652c:854 with SMTP id r4-20020a2eb604000000b00246652c0854mr13669313ljn.517.1646034801800; Sun, 27 Feb 2022 23:53:21 -0800 (PST) Received: from localhost (109-252-135-33.dynamic.spd-mgts.ru. [109.252.135.33]) by smtp.gmail.com with ESMTPSA id bf31-20020a2eaa1f000000b0024637000209sm1178196ljb.10.2022.02.27.23.53.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Feb 2022 23:53:21 -0800 (PST) From: Andrew Tropin To: Ludovic =?utf-8?Q?Court=C3=A8s?= , 54180@debbugs.gnu.org Subject: Re: [bug#54180] [PATCH 00/12] Home: Clarify and better test symlink-manager.scm In-Reply-To: <20220227134006.9860-1-ludo@gnu.org> References: <20220227134006.9860-1-ludo@gnu.org> Date: Mon, 28 Feb 2022 10:53:18 +0300 Message-ID: <87czj7e8b5.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 54180 Cc: Oleg Pykhalov , Ludovic =?utf-8?Q?Court=C3=A8s?= , Xinglu Chen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2022-02-27 14:40, Ludovic Court=C3=A8s wrote: > Hello Guix! > > This patch set aims to increase test coverage for =E2=80=98guix home reco= nfigure=E2=80=99, > to make symlink-manager.scm IMO easier to follow, and to have it more > closely follow the project=E2=80=99s conventions. > > Functionality is unchanged. > > Thoughts? That's great! symlink-manager was a little messy for sure. I took a brief look; On first glance patches seems good. I'll take a deep look later, when will be updating patch for bug#52808 and will report or make a separate patch if something pop up. Thank you very much for working on this :) > > Thanks, > Ludo=E2=80=99. > > Ludovic Court=C3=A8s (12): > home: symlink-manager: Clarify module imports. > home: symlink-manager: Move helper procedures as top-level defines. > home: symlink-manager: Use 'for-each' when used for effects. > home: symlink-manager: Use 'file-is-directory?'. > home: symlink-manager: Remove 'empty-directory?' and avoid TOCTTOU > race. > home: symlink-manager: Avoid extra 'lstat' call. > tests: Make sure 'guix home reconfigure' backs up files. > tests: Simplify use of 'local-file' in 'tests/guix-home.sh'. > tests: Check 'guix home reconfigure' for a second generation. > home: symlink-manager: 'cleanup-symlinks' uses 'file-system-fold'. > home: symlink-manager: 'create-symlinks' uses 'file-system-fold'. > home: symlink-manager: Rename "path" to "file" where appropriate. > > gnu/home/services/symlink-manager.scm | 355 ++++++++++++-------------- > tests/guix-home.sh | 44 +++- > 2 files changed, 198 insertions(+), 201 deletions(-) > > > base-commit: 33ce3f1c866231a3015411fdce18a3e72649e2f6 =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmIcf24PHGFuZHJld0B0 cm9wLmluAAoJECII0glYwd6wyBcP/jal9rPsArKVIVsXYpAaqrwDEf1h/lYEu62i rIhdKKrgKtu8Mg3PMvR1uoG7sUib53NbSrySWAkZN7BpLK8R7oDWbMTc7AkrHFWK GebcDh+bkT/YfmZeiKzgCZI0zFLUaClFZH2KYMg27k4WJJJDCGOSqjQcJOqL2tA7 ijzTLVI+PX456eaOV3DE0utTuJ8QrNtiBz4elqAEKsBFqQcryfvybM1RgWd0jQ78 Q5J64KLykWmZo2rPoKVxliyRA4RchcUe+BDoiTC4cowDBXQXuh6gPf2fv+XvH2qJ qWe4ACVdhRIjiuJb+87u62M5Q+LO4LNpIL2Qrwtm7tB2G0q9Wkg8Kru/Aos8Zqcw 3LnKryRfH+CpyyGS6ZuVhfrOsTHFT1PSmBfT8GxwrqA+RLzqcjeDFzCwM6n2DKOz KQYEGngduWg3PhGJ88cLwzFIHzKRCdleQnOn2m9i6HeaeqFtl+i980XpowPjsAfA j/lY8/4uJ5+OOMSGNrFQNxrm+yyN1J/6xGudsisazSCWlEVXTz0Sot7ZBP6Sn6KO 9S58b3vkkOvLX/Hfbg2UY4x6qqyxziubdxXAPfKeWSmPcKpoimolZppgwhLpkdR9 OYp5BGaybCMRxD6HALMDIBf9krdjkwaub4oS6IqEabIrVFnxRlUqfc/JqDiBsioZ ND8n2v/T =j+X6 -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 05 17:19:34 2022 Received: (at 54180) by debbugs.gnu.org; 5 Mar 2022 22:19:34 +0000 Received: from localhost ([127.0.0.1]:49295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQckP-0004pQ-VQ for submit@debbugs.gnu.org; Sat, 05 Mar 2022 17:19:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQckO-0004pD-Cw for 54180@debbugs.gnu.org; Sat, 05 Mar 2022 17:19:32 -0500 Received: from [2001:470:142:3::e] (port=36888 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQckJ-0006S1-65; Sat, 05 Mar 2022 17:19:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=lBhFCngqJgCLPZrG0PTQNLNn2LptRtSJdbgI/AJJWes=; b=HYjDABrrZTZty5hmsrqq 8fr3+Ud6jj8i4bhdukZhA0uSCD0e22M6w+41xecO6044suBWn5KHpnO9ZTQ9D/cF+45ThBak6GJtx k1iCSXGK6bZ6pTZZqEGP95nQkemoN75+OZsuBTdAYBnwQmmum5M1iJGqnvj/OTVjbYtxeGNrdDjM5 3E2I9GBiwJkZ5Dw2blbi3l//gQIvx8VtRBLsapbZNrFwH2bC/BDcyaG03Eh+bLMQ35eLCYmPAchA7 So+6CUa+S2wO/kU5vR8yN4aXdWrEzMEbx8cWwP0LWzyQInd5GXkTfCRVzEKO1sJmeyukDhLcyxZeI yd7FOIQBDfS44Q==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:50126 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQckI-0004EN-PH; Sat, 05 Mar 2022 17:19:26 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxime Devos Subject: Re: bug#54180: [PATCH 00/12] Home: Clarify and better test symlink-manager.scm References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-5-ludo@gnu.org> Date: Sat, 05 Mar 2022 23:19:25 +0100 In-Reply-To: (Maxime Devos's message of "Sun, 27 Feb 2022 16:54:56 +0100") Message-ID: <87ee3gm49e.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: 54180@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) TWF4aW1lIERldm9zIDxtYXhpbWVkZXZvc0B0ZWxlbmV0LmJlPiBza3JpYmlzOg0KDQo+IEx1ZG92 aWMgQ291cnTDqHMgc2NocmVlZiBvcCB6byAyNy0wMi0yMDIyIG9tIDE0OjUzIFsrMDEwMF06DQo+ PiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGxldCAoKGRpcmVjdG9yeSAoZ2V0 LXRhcmdldC1wYXRoIGRpcmVjdG9yeSkpKQ0KPj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoCAoY2F0Y2ggJ3N5c3RlbS1lcnJvcg0KPj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqAgKGxhbWJkYSAoKQ0KPj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChybWRpciBkaXJlY3RvcnkpDQo+PiArwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGZvcm1hdCAjdCAoR18gIlJlbW92 ZWQgfmEuXG4iKSBkaXJlY3RvcnkpKQ0KPj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqAgKGxhbWJkYSBhcmdzDQo+PiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqAgKGxldCAoKGVycm5vIChzeXN0ZW0tZXJyb3ItZXJybm8gYXJncykp KQ0KPj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAo Y29uZCAoKD0gRU5PVEVNUFRZIGVycm5vKQ0KPj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChmb3JtYXQNCj4+ICvCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg ICN0DQo+PiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoCAoR18gIlNraXBwaW5nIH5hIChub3QgYW4gZW1wdHkgZGlyZWN0b3J5 KS4uLlxuIikNCj4+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgIGRpcmVjdG9yeSkpDQo+PiArwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICgoPSBFTk9URElSIGVy cm5vKQ0KPj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgICN0KQ0KPj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAoZWxzZQ0KPj4gK8KgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChhcHBseSB0aHJv dyBhcmdzKSkpKSkpKSkNCj4NCj4gTGlrZSB3aXRoIG15IGNvbW1lbnQgb24g4oCYQXZvaWQgZXh0 cmEgJ2xzdGF0IGNhbGwu4oCZLCBJIHdvdWxkIG1vdmUgdGhlDQo+IChmb3JtYXQgI3QgKEdfICJS ZW1vdmVkIH5hLlxuIikgZGlyZWN0b3J5KSBvdXRzaWRlIHRoZSBjYXRjaC4NCj4NCj4gSWYgJ2Zv cm1hdCcgc29tZWhvdyB0aHJvd3MgYSBFTk9URU1QVFkvRU5PVERJUiBzeXN0ZW0tZXJyb3IsIHNv bWV0aGluZw0KPiBpcyB2ZXJ5IHdyb25nLg0KDQpQcmVjaXNlbHk6IHdlIGNhbiBrZWVwIHRoZSDi gJhmb3JtYXTigJkgY2FsbCBhZnRlciDigJhybWRpcuKAmSBiZWNhdXNlIHdlIGtub3cNCigxKSBp dOKAmXMgb25seSBnb2luZyB0byBiZSBjYWxsZWQgaWYg4oCYcm1kaXLigJkgc3VjY2VlZHMsIGFu ZCAoMikgaXQgd29u4oCZdA0KdGhyb3cgdG8g4oCYc3lzdGVtLWVycm9y4oCZLg0K From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 05 17:20:42 2022 Received: (at 54180) by debbugs.gnu.org; 5 Mar 2022 22:20:42 +0000 Received: from localhost ([127.0.0.1]:49300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQclW-0004rN-AF for submit@debbugs.gnu.org; Sat, 05 Mar 2022 17:20:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQclU-0004rB-Tm for 54180@debbugs.gnu.org; Sat, 05 Mar 2022 17:20:41 -0500 Received: from [2001:470:142:3::e] (port=36906 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQclP-0000G6-Mm; Sat, 05 Mar 2022 17:20:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=OM4Pmyz7is18J+b9m+Suec65UNzD/eDrGyXAXf2YjR0=; b=OPWNntpsWaUO9ap9WEkD hhTw5s+7MG7nz55V7CdyxjdbVV+y4FugEys3koKdWsRdtkev1iz9jgBqBe/fthqlgrzH+E1qeLGCQ uarXVt1fZlBdBU7w0vU3SYdKH+IUI01lDxAV3wdkSBn+9Dc1UZuqRGQBaFSyvfO6pecBHreIHt3Q3 UZSGwVfrh3faHYVvc3FTPHpi91eOr+1A1DMhMpdqSxUcR6t3uXxoKApfsmoMFKcgDUZKX1rgPCPzp ikY0mGJBjjbk4idGk1KH+gs0aZbDQAAaAaPP83G7aaCaUdkJPJabk3dhSY0za8uTxcpFBfPYrJpQj r0WDqh7uXkxjjw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:50128 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQclM-0004Su-G1; Sat, 05 Mar 2022 17:20:35 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxime Devos Subject: Re: bug#54180: [PATCH 00/12] Home: Clarify and better test symlink-manager.scm References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-9-ludo@gnu.org> Date: Sat, 05 Mar 2022 23:20:31 +0100 In-Reply-To: (Maxime Devos's message of "Sun, 27 Feb 2022 16:49:29 +0100") Message-ID: <87a6e4m47k.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: 54180@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Maxime Devos skribis: > Ludovic Court=C3=A8s schreef op zo 27-02-2022 om 14:53 [+0100]: >> * tests/guix-home.sh: Invoke "guix home reconfigure" a second time with >> a modify config file and check the result. > > Something I don't understand, is why these tests are bash scripts in > the first place. > > Wouldn't Scheme code suffice and be easier to reason about? For > example, Scheme code would avoid repeating the complicated code for > starting a daemon and making sure it exits in every .sh test. It=E2=80=99s useful to have integration tests that exercise the commands; u= nit tests would also be welcome, but that=E2=80=99s what we have so far. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 05 17:27:52 2022 Received: (at 54180) by debbugs.gnu.org; 5 Mar 2022 22:27:52 +0000 Received: from localhost ([127.0.0.1]:49311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQcsS-00052b-Aa for submit@debbugs.gnu.org; Sat, 05 Mar 2022 17:27:52 -0500 Received: from laurent.telenet-ops.be ([195.130.137.89]:38702) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQcsQ-00052R-Gu for 54180@debbugs.gnu.org; Sat, 05 Mar 2022 17:27:51 -0500 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by laurent.telenet-ops.be with bizsmtp id 2mTn270014UW6Th01mTnMb; Sat, 05 Mar 2022 23:27:49 +0100 Message-ID: Subject: Re: bug#54180: [PATCH 00/12] Home: Clarify and better test symlink-manager.scm From: Maxime Devos To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Date: Sat, 05 Mar 2022 23:27:46 +0100 In-Reply-To: <87a6e4m47k.fsf_-_@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-9-ludo@gnu.org> <87a6e4m47k.fsf_-_@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-UYXTJaX1AvN+3C1j8WLO" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1646519269; bh=AU7drHA4q+JOXCZHr/Gv5mPOR58Q/yJZylQyO1S359c=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Ea5kcbWsd2RKWNDTupa6TJ9N6zIsYOzYuOHL24r3OHVf2gnRD9qfP0/2UFwoboF2U dHbdKO/5UsqO8u/vmVoCWOPfL4Fm2fykBSRgK4uFw3XTksZqC8czNf1tBCa3tJD+xZ OSGTMjiYSMRDFBTTAfMGgP62qPk6dtc88O32XklhFVdBrpaShGEK0kKly1wVe8DkNC XOENMM3R7MeSmsayxUq2OGUk9HeBKCLIltutA21N6WDiYNj2F56e4QwNmN5+R2trii 7TXHhN8UAS/s6yE2R3aW0IbqCrQVsA5A5ACXCBjdUjiIbwbK6EXe31WYLWMR95Ryf9 e09jy3XdaF/Xg== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 54180 Cc: 54180@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-UYXTJaX1AvN+3C1j8WLO Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s schreef op za 05-03-2022 om 23:20 [+0100]: > It=E2=80=99s useful to have integration tests that exercise the commands;= unit > tests would also be welcome, but that=E2=80=99s what we have so far. Integreation tests don't have to be in bash. We can have integration tests in Scheme, by=C2=A0running the 'guix-FOO' procedures from (guix scripts ...), like tests/substitute.scm and tests/publish.scm do. Greetings, Maxime. --=-UYXTJaX1AvN+3C1j8WLO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYiPj4hccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7rP1AP9Al6Ggh5aUcJGqrj77s1uwr1lU DpJpBhU9nScWIcLxwQD/aILKuMjpDQVRi8ehhmih8TtY9wjwHF+U/gXxz0Ysvw4= =VXdD -----END PGP SIGNATURE----- --=-UYXTJaX1AvN+3C1j8WLO-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 05 17:37:38 2022 Received: (at 54180) by debbugs.gnu.org; 5 Mar 2022 22:37:38 +0000 Received: from localhost ([127.0.0.1]:49322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQd1u-0005Is-HJ for submit@debbugs.gnu.org; Sat, 05 Mar 2022 17:37:38 -0500 Received: from michel.telenet-ops.be ([195.130.137.88]:44592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQd1p-0005Ig-8y for 54180@debbugs.gnu.org; Sat, 05 Mar 2022 17:37:36 -0500 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by michel.telenet-ops.be with bizsmtp id 2mdX270064UW6Th06mdXzR; Sat, 05 Mar 2022 23:37:31 +0100 Message-ID: Subject: Re: bug#54180: [PATCH 00/12] Home: Clarify and better test symlink-manager.scm From: Maxime Devos To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Date: Sat, 05 Mar 2022 23:37:31 +0100 In-Reply-To: <87ee3gm49e.fsf_-_@gnu.org> References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-5-ludo@gnu.org> <87ee3gm49e.fsf_-_@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-cFAQ97xw8yc2MLsjtJaQ" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1646519851; bh=/9e4kszHBNgpdJCmWV2OoWPalpTbdyeQBabUGWDNzlE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=SrGm4w7XsidedEkQoWf4YR3dJPtze5+zWvwE2PkcBxF0DSS41gVJQnFDJn684l4Of qoLqo8xcu1+serqeELLl0zs5cW0HFc0+iiFR34WVjKkvLDHjoMXEHLRn+/JUmihYWG lFeQKy06xP1sKiH0prhjUIoICsbYD3Am2sa4bx0yFQmaHT+ESzO26z10u5rJ3ej5Sb ErpeYXAV8sEz6eFo8VJGHIgSoKaaz6nRQsZW6s3gDc3cdpXW45JJIrq0ctVVzE/KYo wY3xNTjPpsGfJHJKqRnMGUqaeLfhxaYD3DdPxDp/soRtb+n8CT9chNm8d78GWdcUvz BuiJB30Zc8q+w== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 54180 Cc: 54180@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-cFAQ97xw8yc2MLsjtJaQ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s schreef op za 05-03-2022 om 23:19 [+0100]: > > Like with my comment on =E2=80=98Avoid extra 'lstat call.=E2=80=99, I w= ould move > > the > > (format #t (G_ "Removed ~a.\n") directory) outside the catch. > >=20 > > If 'format' somehow throws a ENOTEMPTY/ENOTDIR system-error, > > something > > is very wrong. >=20 > Precisely: we can keep the =E2=80=98format=E2=80=99 call after =E2=80=98r= mdir=E2=80=99 because we > know (1) it=E2=80=99s only going to be called if =E2=80=98rmdir=E2=80=99 = succeeds, and (2) it > won=E2=80=99t throw to =E2=80=98system-error=E2=80=99. Yes, we could keep it inside the 'catch', but that doesn't it's a good idea, because if format throws a ENOTEMPTY/ENOTDIR, shouldn't that be reported because that seems very wrong? WDYT of (define (delete-if-empty file) ;; Returns #t if deleted, #f if skipped because empty (catch ... (lambda () (rmdir directory) #t)=20 (lambda ... (cond ((=3D ENOTEMPTY ...) #false) ((=3D ENOTDIR ...) [TODO: if it was a regular file, shouldn't it still be del= eted?]) (#true (throw ...)))))) (if (delete-if-empty) (format ... "removed ...") (format ... "skipped ...")) ? --=-cFAQ97xw8yc2MLsjtJaQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYiPmKxccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7quoAQCo2ZM8EqCjSYUYCGXc1qnveOGC LwzAnZOQ3LpsEq6GZAEAy+WR6jmrb7Q3CEfBK4dumz2Iy7qz839iqmWLfF6SLQw= =eZvv -----END PGP SIGNATURE----- --=-cFAQ97xw8yc2MLsjtJaQ-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 05 17:38:38 2022 Received: (at 54180) by debbugs.gnu.org; 5 Mar 2022 22:38:38 +0000 Received: from localhost ([127.0.0.1]:49327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQd2r-0005KU-R7 for submit@debbugs.gnu.org; Sat, 05 Mar 2022 17:38:38 -0500 Received: from laurent.telenet-ops.be ([195.130.137.89]:44832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQd2q-0005KM-2K for 54180@debbugs.gnu.org; Sat, 05 Mar 2022 17:38:36 -0500 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by laurent.telenet-ops.be with bizsmtp id 2mea2700j4UW6Th01meb8A; Sat, 05 Mar 2022 23:38:35 +0100 Message-ID: Subject: Re: [bug#54180] [PATCH 00/12] Home: Clarify and better test symlink-manager.scm From: Maxime Devos To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Date: Sat, 05 Mar 2022 23:38:34 +0100 In-Reply-To: References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-9-ludo@gnu.org> <87a6e4m47k.fsf_-_@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-aMVS3nHcfOYHe2oQqdID" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1646519915; bh=mrED5AxKhiaAT8B05PjKRSVarIwjq82pQ7oG9STHrNc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Nf4B25hfL+dt5TSpTyt8c+QEmZHrqoFDorihKc251JvglEIiXeMBiscDFplpHjn1J UgLpVFQsd1Q9UoE8oeeMlMOkRGa9T1likYG+DWhQ6kplLii+wOciyqdXBRP9vjWP5g 9ECzt3t8qeK53+hffqYDSINO+N283O75cmJSBttr0RV/IuM0tc9OJ7EySpY8bz7KGV EvL7MO2bYMLneDo+bKqrkZRPBUSaykm0nTkvY73sw4pndtdI7xoRW9iIoiO+VzV6IG xrf/pk06ZrYRxpugjLdv+RMvXSVva5r1p3r8qwdbwoi3um1JBU0vh2Qo86c+KtNs2Q NrsQMRpVpG/Rg== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 54180 Cc: 54180@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-aMVS3nHcfOYHe2oQqdID Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable p.s., I'm getting =E2=80=98Undelivered Mail Returned to Sender=E2=80=99: This is the mail system at host taslin.fdn.fr. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. For further assistance, please send mail to postmaster. If you do so, please include this problem report. You can delete your own text from the attached returned message. The mail system (expanded from ): host taslin.fdn.fr[private/dovecot-lmtp] said: 552 5.2.2 Quota exceeded, please contact vlp. (in reply to end of DATA command) --=-aMVS3nHcfOYHe2oQqdID Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYiPmahccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ppxAPsFqlN9V3wm1+nFNELmjvp4/p3W don2AowdgX+k98RrbAEAzfCdBBomEPpN2sRIxyxhFdnGPoNHbyHiqNmJhQt3oAo= =e08S -----END PGP SIGNATURE----- --=-aMVS3nHcfOYHe2oQqdID-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 10 05:23:11 2022 Received: (at 54180) by debbugs.gnu.org; 10 Mar 2022 10:23:11 +0000 Received: from localhost ([127.0.0.1]:33346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nSFws-0003wt-Ue for submit@debbugs.gnu.org; Thu, 10 Mar 2022 05:23:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58006) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nSFwr-0003wf-BD for 54180@debbugs.gnu.org; Thu, 10 Mar 2022 05:23:09 -0500 Received: from [2001:470:142:3::e] (port=53566 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSFwm-0005Oo-1f; Thu, 10 Mar 2022 05:23:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=DWM36XAC0Ku/Xf/QsUgYEdQjP+zg6rAAIXSbzh7/3bA=; b=VOHu2Xa/Alwgk6Lbbf20 Zzg2dEnczzrPrxnHkJSJNp2RwQn7Ln7XtEISRaFSNsBJmw2mCbZvtrZKT4HfPmkelTdlf4tYYFCjd cS0S+DSsQ2rT0WxCcVKtvAPAA6FOckjTWol1/edcTIZL2NFqkx7cxUpvkyqyEwK4U2RHHnkA/N/3f bDXhCTlFN7D69ANR6qHIWrjJkFwj1uY25A/kFN8tCFMIijw7LjRV7qxJSYmVD4C6k8fRjnUjbPp8t STNj0NlZGtr2LI2IdpoDvlC7eyIPeaHP3Iuxz0fEbEAxfIy/bDc2sAV6z15MGgkquKDHP1wYf+oVR Uoy74gbh5Kk8BQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:56800 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSFwl-0002JR-GE; Thu, 10 Mar 2022 05:23:03 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxime Devos Subject: Re: bug#54180: [PATCH 00/12] Home: Clarify and better test symlink-manager.scm References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-9-ludo@gnu.org> <87a6e4m47k.fsf_-_@gnu.org> Date: Thu, 10 Mar 2022 11:23:01 +0100 In-Reply-To: (Maxime Devos's message of "Sat, 05 Mar 2022 23:27:46 +0100") Message-ID: <87fsnqyum2.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: 54180@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Maxime, Maxime Devos skribis: > Ludovic Court=C3=A8s schreef op za 05-03-2022 om 23:20 [+0100]: >> It=E2=80=99s useful to have integration tests that exercise the commands= ; unit >> tests would also be welcome, but that=E2=80=99s what we have so far. > > Integreation tests don't have to be in bash. We can have integration > tests in Scheme, by=C2=A0running the 'guix-FOO' procedures from (guix > scripts ...), like tests/substitute.scm and tests/publish.scm do. Yes, you=E2=80=99re right, but this patch series is not about rewriting the integration tests. :-) The way I see it, we can choose and combine different strategies: Bash tests (the good thing is that they=E2=80=99re as close as can be to what us= ers run), Scheme integration tests like you write when more fine-grain control is needed, and of course unit tests. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 10 05:25:13 2022 Received: (at 54180) by debbugs.gnu.org; 10 Mar 2022 10:25:13 +0000 Received: from localhost ([127.0.0.1]:33367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nSFyr-000410-LR for submit@debbugs.gnu.org; Thu, 10 Mar 2022 05:25:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nSFyr-00040m-1e for 54180@debbugs.gnu.org; Thu, 10 Mar 2022 05:25:13 -0500 Received: from [2001:470:142:3::e] (port=53624 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSFyg-0005jr-U7; Thu, 10 Mar 2022 05:25:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=3Z8pK3OMsz2HQgI4gIfn+h6uA7w1/7YbGF1CQPIuf9Q=; b=iXdyAzU+gIwTwOEJ7n2v QLpwK/hbhgyyqdHpzqA5nTnhCgOcugPd+u8VHcdcxRsFxYJiE6puz6kY37DbREjFGc5UVmwQVCgna 81U5rRyyam6RKiUuuJm37ZswSHVgViFWit+u15TkXq2exOStg5LOCXEKquZWIoj/AjYiOy8O87m4b dOcAkc8p6gcNw3hmxc3bnCwIT40yuuRDIlL43qAK0Sl90xpP0NDww8fX7wJ5hm6//ODIR8nNKGtcC xCFWTHCvYK4rheEt+F2slUOoOVdBwrfS868rcABJzwEDrntfZ3qrMGVcLAPAhdLi8fN576cjH3zb2 VVtWrnQCPCde1Q==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55050 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSFyd-0002hk-C8; Thu, 10 Mar 2022 05:25:00 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxime Devos Subject: Re: bug#54180: [PATCH 00/12] Home: Clarify and better test symlink-manager.scm References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-9-ludo@gnu.org> <87a6e4m47k.fsf_-_@gnu.org> Date: Thu, 10 Mar 2022 11:24:57 +0100 In-Reply-To: (Maxime Devos's message of "Sat, 05 Mar 2022 23:38:34 +0100") Message-ID: <878rtiyuiu.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: 54180@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Maxime Devos skribis: > p.s., I'm getting =E2=80=98Undelivered Mail Returned to Sender=E2=80=99: I think that=E2=80=99s solved, but my mail setup is still in flux=E2=80=A6 = Don=E2=80=99t hesitate to ping me on IRC or something if you think I might have missed a message of yours. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 10 05:28:25 2022 Received: (at 54180) by debbugs.gnu.org; 10 Mar 2022 10:28:25 +0000 Received: from localhost ([127.0.0.1]:33390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nSG1x-00046j-EG for submit@debbugs.gnu.org; Thu, 10 Mar 2022 05:28:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60276) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nSG1v-00046T-Ss for 54180@debbugs.gnu.org; Thu, 10 Mar 2022 05:28:24 -0500 Received: from [2001:470:142:3::e] (port=53664 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSG1q-0006Z5-9w; Thu, 10 Mar 2022 05:28:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=w5f3l+ubzAe6DLbEo/XBtYS98pu/5wOvZkleRsLP/54=; b=VnjFlFh3MoylsiIF7V4u df+WFjIxBzKgl3VfZ4XJ7qZIJWocT5/0Uv08DMK33+lNQevtaUz0et9zhR82nILpPaGSixxwhfAHU mcrFhIn7cIFV0QM0lZnMmGgovSfsWywPnQ1bZuY+EdV4yUz1YtOUsmzwuWuhIicSLjx0alDtyxLfe l/1dSQv9dgvDHewiyj3jbH3oOA5AF7BEAOsiWGHRmBZTpVh4ZQxMpYN4mSGLQl09OkuQjJpFavVVT 9AXfQA8iDlj5apM6wLQUJVTl/X/KPAF6R4/kaTV5KXBZaSfvbygtc6v/J70KrpNuu+MxHThJuLxDB mTU5017Ksnn/mA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:59591 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSG1o-0004q2-Qm; Thu, 10 Mar 2022 05:28:17 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxime Devos Subject: Re: bug#54180: [PATCH 00/12] Home: Clarify and better test symlink-manager.scm References: <20220227135342.10296-1-ludo@gnu.org> <20220227135342.10296-2-ludo@gnu.org> <66bb9a617542057fe6c536631927d94c530dc173.camel@telenet.be> Date: Thu, 10 Mar 2022 11:28:15 +0100 In-Reply-To: <66bb9a617542057fe6c536631927d94c530dc173.camel@telenet.be> (Maxime Devos's message of "Sun, 27 Feb 2022 16:58:09 +0100") Message-ID: <874k46yudc.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180 Cc: 54180@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Maxime Devos skribis: > Ludovic Court=C3=A8s schreef op zo 27-02-2022 om 14:53 [+0100]: >> (file-exists? (get-target-path path)) >> [... other uses of file-exists? ...] Note that this patch just shuffles code around; it does not introduce new =E2=80=98file-exists?=E2=80=99 calls. > 'file-exists?' does not simply check whether the file exists. > E.g., when there is some permission error, then it returns #false. > > I think that in case of an permission error, it would best be reported > to the user, so I think a variant of 'file-exists?' may be needed. I believe later patches mostly address this by avoiding separate =E2=80=98s= tat=E2=80=99 calls (=E2=80=98file-exists?=E2=80=99 is a thin wrapper around =E2=80=98sta= t=E2=80=99). Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 10 05:45:57 2022 Received: (at 54180-done) by debbugs.gnu.org; 10 Mar 2022 10:45:57 +0000 Received: from localhost ([127.0.0.1]:33420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nSGIu-0004ap-VH for submit@debbugs.gnu.org; Thu, 10 Mar 2022 05:45:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nSGIt-0004aX-4L for 54180-done@debbugs.gnu.org; Thu, 10 Mar 2022 05:45:55 -0500 Received: from [2001:470:142:3::e] (port=53798 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSGIm-0001AD-NW; Thu, 10 Mar 2022 05:45:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=8rJZtspPkLTV+Jh6ct1U1U2v/LkZD+0+bft2MXnZtZQ=; b=bx2mcztTig9zLeoUDg+2 DzrFHkeS9tVc5d5NN+iLWATQeX1ZBFLSQsHli5K6KfnlCu9VNz4xhDddv4ggZCHYvnSPxsXuMiZy+ xnf/SP873PdYQUtKIJl26Q8A7ljTujO+rP9uAiZRfDdOy+RpXIHcPTcUvV1UnHXHi7OrWzPu3wtVQ Op+tjJgFhmaRChuM/UeEwbcvcfitKK6wwy6SJEzpO8SCq7BpL93UFbWfCRpe5X33VwoqY6VdTotRf r4xkS9WbBNIYCrfWeDMAsXMQguF/oZq7TVgMKd5V69fV7mmmd6QSnLR17Dq8XY+Ve/l5afXjrRn6f PKwevivg0/4Lgg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:60977 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSGIm-0003BG-9k; Thu, 10 Mar 2022 05:45:48 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 54180-done@debbugs.gnu.org Subject: Re: bug#54180: [PATCH 00/12] Home: Clarify and better test symlink-manager.scm References: <20220227134006.9860-1-ludo@gnu.org> Date: Thu, 10 Mar 2022 11:45:45 +0100 In-Reply-To: <20220227134006.9860-1-ludo@gnu.org> ("Ludovic =?utf-8?Q?Cour?= =?utf-8?Q?t=C3=A8s=22's?= message of "Sun, 27 Feb 2022 14:40:06 +0100") Message-ID: <87y21ixezq.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54180-done Cc: Oleg Pykhalov , Xinglu Chen , Maxime Devos , Andrew Tropin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! I went ahead and pushed this series: 2a55f99aff home: symlink-manager: Rename "path" to "file" where appropria= te. 1fb6ef0473 home: symlink-manager: 'create-symlinks' uses 'file-system-fol= d'. 5fa188e92e home: symlink-manager: 'cleanup-symlinks' uses 'file-system-fo= ld'. 5fabaf1128 tests: Check 'guix home reconfigure' for a second generation. 26e67e0280 tests: Simplify use of 'local-file' in 'tests/guix-home.sh'. 7b7e32d5ad tests: Make sure 'guix home reconfigure' backs up files. a3a76a8384 home: symlink-manager: Avoid extra 'lstat' call. a81bb1e4bb home: symlink-manager: Remove 'empty-directory?' and avoid TOC= TTOU race. e1b38046a6 home: symlink-manager: Use 'file-is-directory?'. cf803b71c7 home: symlink-manager: Use 'for-each' when used for effects. 7a8856f540 home: symlink-manager: Move helper procedures as top-level def= ines. 66bf60a4cd home: symlink-manager: Clarify module imports. Thanks Maxime for taking a look. Ludo=E2=80=99. From unknown Tue Sep 09 21:32:27 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 07 Apr 2022 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator