Bug#1030224: Inverted test for /etc/runit/no.emulate.sysv in /etc/runit/2

2023-02-01 Thread Lorenzo
Hi,

On Wed, 1 Feb 2023 11:35:17 +0100
Andras Korn  wrote:

> (I still also think that /etc/sv is the wrong place to check; the
> directory monitored by runsvdir, e.g. /etc/service, could contain a
> symlink to a service that resides somewhere else, not in /etc/sv/,
> and the existence of such a symlink should also cause the initscript
> invocation to be skipped.)

Please see my last message/idea in #1022837 and comment there
> 
> For this particular issue in /etc/runit/2, I recommend just replacing
> the || with &&, so the snippet becomes:

Done in git, will be in *-54, thanks for catching this

> András
> 



Bug#1030224: Inverted test for /etc/runit/no.emulate.sysv in /etc/runit/2

2023-02-01 Thread Andras Korn
Package: runit
Version: 2.1.2-53
Severity: normal
Tags: patch

Hi,

/etc/runit/2 ships with this snippet:

if [ "$runsv_dir" != solo ] || [ ! -e /etc/runit/no.emulate.sysv ]; then
/lib/runit/async-timeout /lib/runit/run_sysv_scripts 
'/etc/rc2.d'
fi

This means that the rc2.d scripts are run if EITHER $runsv_dir does not equal 
"solo" OR the file /etc/runit/no.emulate.sysv doesn't exist.

In other words, for rc2.d scripts to be skipped, BOTH of the following 
conditions must be true:

 1. $runsv_dir has to equal solo; AND
 2. /etc/runit/no.emulate.sysv has to exist.

I think that rc2.d should be skipped if /etc/runit/no.emulate.sysv exists, 
regardless of the value of $runsv_dir. This is also what the README suggests:

* /etc/runit/no.emulate.sysv
 Skip all sysv scripts enabled in rc2.d during the boot sequence, even if
 there is no correspondent native runscript in /etc/sv/

(I still also think that /etc/sv is the wrong place to check; the directory 
monitored by runsvdir, e.g. /etc/service, could contain a symlink to a service 
that resides somewhere else, not in /etc/sv/, and the existence of such a 
symlink should also cause the initscript invocation to be skipped.)

For this particular issue in /etc/runit/2, I recommend just replacing the || 
with &&, so the snippet becomes:

if [ "$runsv_dir" != solo ] && [ ! -e /etc/runit/no.emulate.sysv ]; then
/lib/runit/async-timeout /lib/runit/run_sysv_scripts 
'/etc/rc2.d'
fi

András

-- 
   If debugging is removing bugs, then programming must be putting them in.