From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#29992: [PATCH] services: postgresql: Use pg_ctl to start and stop postgres. Date: Wed, 24 Jan 2018 16:04:14 +0100 Message-ID: <87d11zxpqp.fsf@gnu.org> References: <87373ghaza.fsf@gnu.org> <20180124022037.29376-1-clement@lassieur.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eeMbs-00027r-1f for bug-guix@gnu.org; Wed, 24 Jan 2018 10:05:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eeMbn-0004xA-AL for bug-guix@gnu.org; Wed, 24 Jan 2018 10:05:08 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:33307) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eeMbn-0004wz-7q for bug-guix@gnu.org; Wed, 24 Jan 2018 10:05:03 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20180124022037.29376-1-clement@lassieur.org> ("=?UTF-8?Q?Cl=C3=A9ment?= Lassieur"'s message of "Wed, 24 Jan 2018 03:20:37 +0100") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: 29992@debbugs.gnu.org Cl=C3=A9ment Lassieur skribis: > Fixes . > > * gnu/services/databases.scm (postgresql-shepherd-service): Replace > make-forkexec-constructor and make-kill-destructor with pg_ctl. [...] > + (let* ((pg_ctl-wrapper > + ;; Wrapper script that switches to the 'postgres' user befo= re > + ;; launching daemon. > + (program-file > + "pg_ctl-wrapper" > + #~(begin > + (use-modules (ice-9 match) > + (ice-9 format)) > + (match (command-line) > + ((_ mode) > + (let ((user (getpwnam "postgres")) > + (pg_ctl #$(file-append postgresql "/bin/pg_ct= l"))) > + (setgid (passwd:gid user)) > + (setuid (passwd:uid user)) > + (system > + (format #f "~a -D ~a -o '--config-file=3D~a -p ~= d' ~a" > + pg_ctl #$data-directory #$config-file #$= port > + mode)))))))) I think we should use =E2=80=98execl=E2=80=99 here instead of =E2=80=98syst= em=E2=80=99 so that (1) the exit code is correct, and (2) we don=E2=80=99t go through /bin/sh. Apart from that it LGTM, thank you! Ludo=E2=80=99.