[Pkg-libvirt-maintainers] Bug#951061: linux_vserver detection broken, easy fix
Andras Korn
korn-debbugs at elan.rulez.org
Mon Feb 10 14:45:13 GMT 2020
Package: virt-what
Version: 1.19-1
Severity: normal
Tags: patch
Hi,
This is broken in two ways:
# Check for Linux-VServer
if test -e "${root}/proc/self/status" \
&& cat "${root}/proc/self/status" | grep -q "VxID: [0-9]*"; then
echo linux_vserver
if grep -q "VxID: 0$" "${root}/proc/self/status"; then
echo linux_vserver-host
else
echo linux_vserver-guest
fi
fi
1. The regex should be "VxID:[[:space:]]+[1-9][0-9]*" (and use egrep), since
different versions of the linux-vserver patch may use different amounts and
kinds of whitespace in /proc/self/status.
2. linux_vserver-host should never be printed. The host is not running
virtualized; printing that virtualization is available just confuses scripts
that need to detect whether they're running on bare metal or not. When not
running virtualized, the script should print nothing.
It's also inconsistent: the script (naturally) doesn't print anything if the
box would be capable of running kvm guests (whether it's currently running
any or not).
Thus, the code above should be changed to this:
# Check for Linux-VServer
if test -e "${root}/proc/self/status" \
&& egrep -q "VxID:[[:space:]]+[1-9][0-9]*"; then
echo linux_vserver-guest
fi
Best regards,
AndrĂ¡s
-- System Information:
Debian Release: 10.0
APT prefers unstable
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.4.206-vs2.3.9.8 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=hu_HU.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: runit (via /run/runit.stopit)
Versions of packages virt-what depends on:
ii dmidecode 3.2-2
ii libc6 2.29-3
virt-what recommends no packages.
virt-what suggests no packages.
-- no debconf information
--
Help Wanted: Telepath. You know where to apply.
More information about the Pkg-libvirt-maintainers
mailing list