Bug#920320: initscripts: Inverted check in /run symlink logic

Pierre Ynard linkfanel at yahoo.fr
Thu Jan 24 05:26:25 GMT 2019


Package: initscripts
Version: 2.88dsf-59
Severity: normal
Tags: patch

It seems to me that the function run_migrate() in /lib/init/mount-functions.sh
has an inverted check:

>                 # Create symlink if not already present.
>                 if [ -L "$OLD" ] && [ "$(readlink "$OLD")" != "$RUN" ]; then
>                         :
>                 else
>                         rm -f "$OLD"
>                         ln -fs "$RUN" "$OLD"
>                         [ -x /sbin/restorecon ] && /sbin/restorecon "$OLD"
>                 fi

This will attempt to correct the symlink if $OLD and $RUN already match,
instead of the contrary. This seems to have got broken in:

https://salsa.debian.org/debian/sysvinit/commit/097799738cf971fac9928e84bcdb6f4b916ce021#3c02e03bae53ff69719346b21039033d8f9809ed_279_277

The impact is uncertain since there's a piece of code already doing
something similar above it. This is rather awkward and the code has
apparently evolved into that cruft after two changes of mind during the
migration.

Personally I noticed it because despite having a correct symlink on my
system, I get a visible error log that removing /dev/shm is impossible
because the file system is read-only (#818442). And also that code is
reached only after the stat checks fail because /usr isn't available.

I suppose it should be looked into whether the redundant transition
logic is still needed or going to be needed, but I guess that inverted
check should at least be fixed with the attached patch.

-- System Information:
Debian Release: 8.11
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable-proposed-updates'), (500, 'oldstable')
Architecture: i386 (i586)

Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages initscripts depends on:
ii  coreutils       8.23-4
ii  debianutils     4.4+b1
ii  libc6           2.19-18+deb8u10
ii  lsb-base        4.1+Debian13+nmu1
ii  mount           2.25.2-6
ii  sysv-rc         2.88dsf-59
ii  sysvinit-utils  2.88dsf-59

Versions of packages initscripts recommends:
ii  e2fsprogs  1.42.12-2+b1
ii  psmisc     22.21-2

initscripts suggests no packages.

-- Configuration Files:
/etc/default/rcS changed [not included]

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: run_symlink.patch
Type: text/x-diff
Size: 479 bytes
Desc: not available
URL: <http://www.chiark.greenend.org.uk/pipermail/debian-init-diversity/attachments/20190124/030bcd75/attachment.patch>


More information about the Debian-init-diversity mailing list