Re: [announce] utmps-0.0.1.0

From: Guillermo <gdiazhartusch_at_gmail.com>
Date: Sat, 7 Jul 2018 13:50:43 -0300

Hello,

2018-06-07 9:47 GMT-03:00 Laurent Bercot:
>
> Hello,
> It's been there for some time but there's now a release number.
> utmps-0.0.1.0 is out.
> […]
> It still needs a lot of testing.

So, I noticed the package includes example OpenRC service scripts
(wow!) for utmps-utmpd and utmps-wtmpd. Probably not the kind of
testing you hoped for, but for the sake of correctness: they won't
work :-P The arguments supplied to the program named in the assignment
to 'command' must go in an assignment to variable 'command_args', and
in these particular examples, the end of options marker ("--") before
s6-ipcserver's arguments interacts badly with OpenRC's mechanism for
invoking start-stop-daemon: arguments stored in variable
'start_stop_daemon_args', including -b, end up getting passed to
s6-ipcserver instead, and the script hangs waiting for this program to
exit.

Also, as an improvement, the script doesn't need to assume directory
/run/utmps exists: it can check that using OpenRC's 'checkpath'
command, and create it with the correct owner and mode if it does not
exist, just like service utmps-prepare does in the s6-rc examples (is
its definition directory wrongly named 'sutmp-prepare'?).

Patch at the end of the message with those changes, plus some
additional ones for better readability. Patched scripts tested as
working on Gentoo:

# rc-service utmpd start
 * /run/utmps: creating directory
 * /run/utmps: correcting owner
 * Starting utmpd ... [ ok ]

# rc-service wtmpd start
 * /run/utmps: creating directory
 * Starting wtmpd ... [ ok ]

$ rc-status
...
Dynamic Runlevel: manual
 utmpd [ started ]
 wtmpd [ started ]

$ ps -eo pid,ppid,euser,egroup,args
  PID PPID EUSER EGROUP COMMAND

 3588 1 utmp utmp s6-ipcserverd -- utmps-utmpd
 3620 1 utmp utmp s6-ipcserverd -- utmps-wtmpd

$ ls -ld /run/utmps
drwxr-xr-x 2 utmp utmp 120 Jul 5 23:14 /run/utmps

$ ls -l /run/utmps
total 8
-rw-r--r-- 1 root root 5 Jul 6 23:14 utmpd.pid
srwxrwxrwx 1 utmp utmp 0 Jul 6 23:14 utmpd-socket
-rw-r--r-- 1 root root 5 Jul 6 23:14 wtmpd.pid
srwxrwxrwx 1 utmp utmp 0 Jul 6 23:14 wtmpd-socket

G.

--- original/utmps-0.0.1.2/examples/openrc/utmpd 2017-11-20
11:42:03.000000000 -0300
+++ patched/utmps-0.0.1.2/examples/openrc/utmpd 2018-07-05
23:26:06.490884765 -0300
_at_@ -1,8 +1,13 @@
 #!/sbin/openrc-run

-# Assumes the /run/utmps directory already exists and belongs to utmp
-
 name="utmpd"
-command="s6-ipcserver -- /run/utmps/utmpd-socket utmps-utmpd"
+command="s6-ipcserver"
+command_args="/run/utmps/utmpd-socket utmps-utmpd"
+command_background=yes
+command_user=utmp
 pidfile="/run/utmps/utmpd.pid"
-start_stop_daemon_args="-b -m -c utmp -d /run/utmps"
+start_stop_daemon_args="-d /run/utmps"
+
+start_pre() {
+ checkpath -D -d -o utmp:utmp -m 0755 /run/utmps
+}
--- original/utmps-0.0.1.2/examples/openrc/wtmpd 2017-11-20
11:42:03.000000000 -0300
+++ patched/utmps-0.0.1.2/examples/openrc/wtmpd 2018-07-05
23:26:29.349884765 -0300
_at_@ -1,8 +1,13 @@
 #!/sbin/openrc-run

-# Assumes the /run/utmps directory already exists and belongs to utmp
-
 name="wtmpd"
-command="s6-ipcserver -- /run/utmps/wtmpd-socket utmps-wtmpd"
+command="s6-ipcserver"
+command_args="/run/utmps/wtmpd-socket utmps-wtmpd"
+command_background=yes
+command_user=utmp
 pidfile="/run/utmps/wtmpd.pid"
-start_stop_daemon_args="-b -m -c utmp -d /run/utmps"
+start_stop_daemon_args="-d /run/utmps"
+
+start_pre() {
+ checkpath -D -d -o utmp:utmp -m 0755 /run/utmps
+}
Received on Sat Jul 07 2018 - 16:50:43 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC