From: ludo@gnu.org (Ludovic Courtès)
To: "Clément Lassieur" <clement@lassieur.org>
Cc: 29992@debbugs.gnu.org
Subject: bug#29992: [PATCH] services: postgresql: Use pg_ctl to start and stop postgres.
Date: Wed, 24 Jan 2018 16:04:14 +0100 [thread overview]
Message-ID: <87d11zxpqp.fsf@gnu.org> (raw)
In-Reply-To: <20180124022037.29376-1-clement@lassieur.org> ("Clément Lassieur"'s message of "Wed, 24 Jan 2018 03:20:37 +0100")
Clément Lassieur <clement@lassieur.org> skribis:
> Fixes <https://bugs.gnu.org/29992>.
>
> * 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 before
> + ;; 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_ctl")))
> + (setgid (passwd:gid user))
> + (setuid (passwd:uid user))
> + (system
> + (format #f "~a -D ~a -o '--config-file=~a -p ~d' ~a"
> + pg_ctl #$data-directory #$config-file #$port
> + mode))))))))
I think we should use ‘execl’ here instead of ‘system’ so that (1) the
exit code is correct, and (2) we don’t go through /bin/sh.
Apart from that it LGTM, thank you!
Ludo’.
next prev parent reply other threads:[~2018-01-24 15:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-05 15:32 bug#29992: 'postgres' service doesn't stop Clément Lassieur
2018-01-08 10:59 ` Ludovic Courtès
2018-01-08 11:33 ` Clément Lassieur
2018-01-08 21:55 ` Alex Kost
2018-01-12 9:46 ` Catonano
2018-01-12 21:42 ` Danny Milosavljevic
2018-01-24 2:20 ` bug#29992: [PATCH] services: postgresql: Use pg_ctl to start and stop postgres Clément Lassieur
2018-01-24 15:04 ` Ludovic Courtès [this message]
2018-01-24 17:16 ` Clément Lassieur
2018-01-25 13:13 ` Clément Lassieur
2018-01-25 13:20 ` Clément Lassieur
2018-01-25 14:22 ` Ludovic Courtès
2018-01-25 14:56 ` Clément Lassieur
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d11zxpqp.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=29992@debbugs.gnu.org \
--cc=clement@lassieur.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).