GNU bug report logs - #52714
[PATCH v2 3/4] services: postgresql: Ensure correct ownership of directory trees.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Brice Waegeneire <brice@HIDDEN>; Keywords: patch; merged with #52454, #52712, #52713, #52715; dated Tue, 21 Dec 2021 19:38:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Merged 52454 52712 52713 52714 52715. Request was from Brice Waegeneire <brice@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 52454 52713 52714 52715. Request was from Brice Waegeneire <brice@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 52454 52714 52715. Request was from Brice Waegeneire <brice@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Dec 2021 19:37:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 21 14:37:07 2021
Received: from localhost ([127.0.0.1]:55702 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mzkwd-00078Z-0A
	for submit <at> debbugs.gnu.org; Tue, 21 Dec 2021 14:37:07 -0500
Received: from lists.gnu.org ([209.51.188.17]:37552)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <brice@HIDDEN>) id 1mzkwT-000775-2F
 for submit <at> debbugs.gnu.org; Tue, 21 Dec 2021 14:36:59 -0500
Received: from eggs.gnu.org ([209.51.188.92]:36172)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <brice@HIDDEN>) id 1mzkwS-0001xd-NW
 for guix-patches@HIDDEN; Tue, 21 Dec 2021 14:36:56 -0500
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:45729)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <brice@HIDDEN>) id 1mzkwP-0004Em-BS
 for guix-patches@HIDDEN; Tue, 21 Dec 2021 14:36:56 -0500
Received: (Authenticated sender: brice@HIDDEN)
 by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 45DF960009
 for <guix-patches@HIDDEN>; Tue, 21 Dec 2021 19:36:50 +0000 (UTC)
From: Brice Waegeneire <brice@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH v2 3/4] services: postgresql: Ensure correct ownership of
 directory trees.
Date: Tue, 21 Dec 2021 20:36:45 +0100
Message-Id: <20211221193646.16849-3-brice@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <8735mleoxo.fsf_-_@HIDDEN>
References: <8735mleoxo.fsf_-_@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=217.70.183.195; envelope-from=brice@HIDDEN;
 helo=relay3-d.mail.gandi.net
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

* gnu/services/databases.scm (postgresql-activation): Replace 'chown'
  calls by 'lchown-recursive'.
---
 gnu/services/databases.scm | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index 39225a4bd6..58d93a8e35 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2019 Robert Vollmert <rob@HIDDEN>
 ;;; Copyright © 2020 Marius Bakke <marius@HIDDEN>
 ;;; Copyright © 2021 David Larsson <david.larsson@HIDDEN>
+;;; Copyright © 2021 Brice Waegeneire <brice@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -214,8 +215,11 @@ (define postgresql-activation
     (($ <postgresql-configuration> postgresql port locale config-file
                                    log-directory data-directory
                                    extension-packages)
-     #~(begin
+     (with-imported-modules (source-module-closure
+                             '((gnu build activation)))
+       #~(begin
          (use-modules (guix build utils)
+                      (gnu build activation)
                       (ice-9 match))
 
          (let ((user (getpwnam "postgres"))
@@ -230,19 +234,19 @@ (define postgresql-activation
                      '()))))
            ;; Create db state directory.
            (mkdir-p #$data-directory)
-           (chown #$data-directory (passwd:uid user) (passwd:gid user))
+           (lchown-recursive #$data-directory (passwd:uid user) (passwd:gid user))
 
            ;; Create the socket directory.
            (let ((socket-directory
                   #$(postgresql-config-file-socket-directory config-file)))
              (when (string? socket-directory)
                (mkdir-p socket-directory)
-               (chown socket-directory (passwd:uid user) (passwd:gid user))))
+               (lchown-recursive socket-directory (passwd:uid user) (passwd:gid user))))
 
            ;; Create the log directory.
            (when (string? #$log-directory)
              (mkdir-p #$log-directory)
-             (chown #$log-directory (passwd:uid user) (passwd:gid user)))
+             (lchown-recursive #$log-directory (passwd:uid user) (passwd:gid user)))
 
            ;; Drop privileges and init state directory in a new
            ;; process.  Wait for it to finish before proceeding.
@@ -262,7 +266,7 @@ (define postgresql-activation
                           initdb-args)))
                 (lambda ()
                   (primitive-exit 1))))
-             (pid (waitpid pid))))))))
+             (pid (waitpid pid)))))))))
 
 (define postgresql-shepherd-service
   (match-lambda
-- 
2.34.0





Acknowledgement sent to Brice Waegeneire <brice@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#52714; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 21 Dec 2021 20:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.