Your message dated Fri, 11 Mar 2022 13:03:58 +0000
with message-id <[email protected]>
and subject line Bug#983726: fixed in runit 2.1.2-45
has caused the Debian Bug report #983726,
regarding runsv(8) incorrect regarding control/[dx]
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
983726: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983726
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: runit
Version: 2.1.2-39.1
Severity: normal
Tags: upstream

Hi,

runsv(8) says:

CUSTOMIZE CONTROL
       For each control character c sent to the control pipe, runsv first
       checks if service/control/c exists and is executable. If so, it
       starts service/control/c and waits for it to terminate, before
       interpreting the command. If the program exits with return code 0,
       runsv refrains from sending the service the corresponding signal. The
       command o is always considered as command u. On command d first
       service/control/t is checked, and then service/control/d. On command
       x first service/control/t is checked, and then service/control/x. The
       control of the optional log service cannot be customized.

This is, however, not what the code actually does.

For the 'd' control character 
(https://github.com/vulk-archive/runit/blob/master/src/runsv.c#L324):

  case 'd': /* down */
    s->want =W_DOWN;
    update_status(s);
    if (s->state == S_RUN) stopservice(s);
    break;

'x' is handled analogously.

The stopservice() function 
(https://github.com/vulk-archive/runit/blob/master/src/runsv.c#L246) looks like 
this:

void stopservice(struct svdir *s) {
  if (s->pid && ! custom(s, 't')) {
    kill(s->pid, SIGTERM);
    s->ctrl |=C_TERM;
    update_status(s);
  }
  if (s->want == W_DOWN) {
    kill(s->pid, SIGCONT);
    custom(s, 'd'); return;
  }
  if (s->want == W_EXIT) {
    kill(s->pid, SIGCONT);
    custom(s, 'x');
  }
}

i.e. the control/d or control/x script is only run after runsv sent its child a 
SIGTERM, not before as the manpage suggests.

I would suggest that the code should be changed to reflect the documented 
behaviour, not vice versa. Perhaps the following code would work (but I have 
not tested it):

void stopservice(struct svdir *s) {
  if (s->pid) {
    if (s->want == W_DOWN) {
      kill(s->pid, SIGCONT);
      if (custom(s, 'd')) return;
    }
    if (s->want == W_EXIT) {
      kill(s->pid, SIGCONT);
      if (custom(s, 'x')) return;
    }
    if (! custom(s, 't')) {
      kill(s->pid, SIGTERM);
      s->ctrl |=C_TERM;
      update_status(s);
    }
  }
}

Credits to https://serverfault.com/users/135556/keith for pointing the bug out.

Best regards,

András

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (350, 'unstable'), (350, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-3-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=hu_HU.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8
Shell: /bin/sh linked to /bin/bash
Init: runit (via /run/runit.stopit)
LSM: AppArmor: enabled

Versions of packages runit depends on:
ii  libc6           2.31-9
ii  sysuser-helper  1.3.5.1

Versions of packages runit recommends:
ii  runit-init  2.1.2-39.1

Versions of packages runit suggests:
ii  socklog  2.1.0+repack-4+b1

-- Configuration Files:
/etc/runit/1 changed [not included]
/etc/runit/2 changed [not included]
/etc/runit/3 changed [not included]

-- no debconf information

-- 
                Laughing stock: cattle with a sense of humour.

--- End Message ---
--- Begin Message ---
Source: runit
Source-Version: 2.1.2-45
Done: Lorenzo Puliti <[email protected]>

We believe that the bug you reported is fixed in the latest version of
runit, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Lorenzo Puliti <[email protected]> (supplier of updated runit package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 09 Mar 2022 01:13:37 +0100
Source: runit
Architecture: source
Version: 2.1.2-45
Distribution: unstable
Urgency: medium
Maintainer: Lorenzo Puliti <[email protected]>
Changed-By: Lorenzo Puliti <[email protected]>
Closes: 983726 1005881 1006856
Changes:
 runit (2.1.2-45) unstable; urgency=medium
 .
   * Detect runlevel 0 or 6 in a more robust way
      + thanks to András Korn
   * Fix init-switch autopkgtest, broken because of
      changes in apt, see  #1005881
   * Document with a wiki how to install runit-init,
      since now two separate steps are required.
      Reference the wiki in the package description.
      (Closes: #1005881)
   * Remove `previous' simlink on purge if it exists
   * Getty-run: mark gettys as disabled when there is no tty,
     instead of just removing the symlink which can be confusing
   * Add a Readme for default-syslog virtual service
   * Default-syslog: raise sleep interval
   * Getty-run: add a ttyv0 getty for BSD (Closes: #1006856)
   * Clarify runsv.8 control/[dx] signal override (Closes: #983726)
   * Temporary disable the sv test, because of #1003891
Checksums-Sha1:
 dbe6371860fba841c863b212b58bc50408bd3ca5 2124 runit_2.1.2-45.dsc
 7d88999405e17fb9326d60d167245d49389527f4 50716 runit_2.1.2-45.debian.tar.xz
 f7c4924529e47729e5a0f9f468f2c54713dc3f96 5835 runit_2.1.2-45_source.buildinfo
Checksums-Sha256:
 1f207c2768430d3bff15aa097a6eb43fb48263dfabb80ef72f6d43ab9b3a9b04 2124 
runit_2.1.2-45.dsc
 205ed8cb39be22e39567aee5b3f7a4ca532a3d992ee4b3bb46df032cc6e55362 50716 
runit_2.1.2-45.debian.tar.xz
 7ff2e5af5c182b160b2ddf283979e85b060ca5386717c3258cfe0b3023759591 5835 
runit_2.1.2-45_source.buildinfo
Files:
 132ce2488f138b2ab38fd7a94d404db4 2124 admin optional runit_2.1.2-45.dsc
 01250870488c8a9c48e795bd7ca32c66 50716 admin optional 
runit_2.1.2-45.debian.tar.xz
 4e5ddaeb1ad0ebc8821b7d406a10ae25 5835 admin optional 
runit_2.1.2-45_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQHEBAEBCgAuFiEEQGIgyLhVKAI3jM5BH1x6i0VWQxQFAmIrRUsQHGJhZ2VAZGVi
aWFuLm9yZwAKCRAfXHqLRVZDFCOPDADF01xIyiaDC0MU4bmo/Off5DlrrI8CPgYq
hpnmPRy1VcUgVCEjW5YUukwQOp0mDFBnk0ueof7uBW0uYUfnU1ZYNzIWEzken5k9
Ydn8XpGV+xkSot+jY6SMti4mutb4xcOfSw+vNdQcjsk2oNaFdmM6LwPMo170Ft1W
XxrjPDuDhbZJuMhCnQI4+1QDOuoWNF8njOz79lwxv1kAAj8EuyUk1t/iXEWhMwCb
H2QLDrMDZ0Odd58i+DJoWhW3k/M27N9gA124MhWZDqxOoJYptHL5NFfBO5Urskqy
sXhLzq55FtPw3HmjYdqALAipsfPr1q/1yvPsbtgfczUOdIUwyT7re0+h7EpjEGw8
8ya8GuTc/izFNfDmlytZ6/CFldvMQvtmcY4xbfkyP6rCiLsZEZUmKUOag5Zdpego
MJNse0dWA4ZSjpRjiyrtN09WPrPZZRIrzXlM0d0csZx9vL3wZ2Al/UDLSPGFWC9y
SENnp9eW9LoR5DBncSVlwb2jBtuKlgo=
=2UC1
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to