Package: runit
Version: 2.1.2-17
Severity: wishlist
Tags: patch


-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.17.3-van (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages runit depends on:
ii  libc6         2.27-8
ii  runit-helper  2.7.3

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

runit suggests no packages.

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

-- no debconf information

-- debsums errors found:
debsums: changed file /sbin/update-service (from runit package)

Hi Dmitry, 
i've have preapred a patch to make update-service handle relative symlinks in 
the default runlevel;
You have alredy addressed this with runit-helper 2.7.3, but there is still some 
corner case where 
update-service fails; moreover i've had a look at the policy and i think that 
some fix is needed
also in update-service to make it comply with policy (10.5).
More datails in commit message
>From ea9c33657e48967e7a7aff45b1e70768cc89b828 Mon Sep 17 00:00:00 2001
From: Lorenzo Puliti <lorenzo.r...@gmail.com>
Date: Sun, 17 Jun 2018 14:06:27 +0200
Subject: [PATCH 1/2] Update-service: handle relative symlinks

Debian Policy (10.5) require symlinks whithin a top level directory
to be relative (e.g. symlink made by dh_link in /etc/runit/runsvdir/default/)
In runit /etc/service/ is a symlink itself that points to
/etc/runit/runsvdir/default/ and update-service acts on /etc/service/ .
The consequence is that, in case of relative symlinks, update-service
consider such link invalid since it points one level up the root.
This has already been addressed in runit-helper (2.7.2-->2.7.3),
but there is still some corner case (getty-tty1) where update-service fails.
This patch make update-service handle relative symlinks in the default
runlevel (e.g. when /etc/service/ point to /etc/runit/runsvidir/default);
note that further change will be necessary if runit implements the runlevel
change mechanism (e.g. /etc/service/ points to 'current' instead of 'default').
---
 debian/contrib/update-service | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/debian/contrib/update-service b/debian/contrib/update-service
index 7b787e0..36fa5f9 100644
--- a/debian/contrib/update-service
+++ b/debian/contrib/update-service
@@ -3,6 +3,8 @@ set -e
 
 servicedir=$SVDIR
 test -n "$servicedir" || servicedir=/etc/service
+# handle relative symlinks, see #899242
+defaultrun=runit/runsvdir/default
 
 err() { >&2 printf '%s\n\n' "$*"; exit 1; }
 fatal() { err "${0##*/}: fatal: $*"; }
@@ -39,7 +41,11 @@ test -n "${sv##.*}" ||
   fatal "The <service-name> must not start with a dot."
 test "$sv" = "${sv#*/}" ||
   fatal "The <service-name> must not contain a slash."
-
+# allow relative symlinks only in 'default' runlevel
+test "$defaultrun" = "$(readlink "$servicedir")" && \
+  relsymdir=../../../sv
+  
+  
 case "$opt" in
   -a|--add)
     test "$(id -u)" = 0 || fatal "${0##*/} -a must be run by root."
@@ -76,7 +82,8 @@ case "$opt" in
       fatal "$servicedir/$sv is not a symbolic link."
     test "$svdir" = "$(readlink "$servicedir"/"$sv")" ||
       test "$svdir"/ = "$(readlink "$servicedir"/"$sv")" ||
-        fatal "$servicedir/$sv does not point to $svdir."
+        test "$relsymdir"/"$sv" = "$(readlink "$servicedir"/"$sv")" ||
+          fatal "$servicedir/$sv does not point to $svdir."
     rm -f "$servicedir"/"$sv"
     printf '%s %s\n' \
       "Service $sv removed," \
-- 
2.19.1

Reply via email to