Package: kvm
Version: 72+dfsg-1.1
Severity: normal

(This bug seems RC to me; please increase severity accordingly if you agree.)

kvm's preinst contains the following code:
> GROUP=kvm
>  
> # Workaround for bug in addgroup
> . /etc/adduser.conf
> [ -z "$FIRST_SYSTEM_UID" ] && exit 1
> [ -z "$LAST_SYSTEM_UID" ] && exit 2
>  
> GID=$(grep ${GROUP} /etc/group >/dev/null && grep ${GROUP} /etc/group | cut 
> -d ':' -f 3)
>  
> if [ -n "$GID" ] \
>     && [ "$GID" -lt "$FIRST_SYSTEM_UID" \
>          -o "$GID" -gt "$LAST_SYSTEM_UID" ]; then
>     cat >&2 <<EOF
>  
> Error: The kvm package needs to create a group named "${GROUP}" in
> /etc/group to be used for /dev/kvm, but the group ${GROUP} already exists
> and it is not a group in the system range 
> (${FIRST_SYSTEM_UID}..${LAST_SYSTEM_UID}). Depending on
> the circumstances, you may want to remove or rename the currently
> existing ${GROUP} group before reinstalling the kvm package.
>  
> Aborting the installation of kvm now.
>  
> EOF
>     exit 3
> fi
>  
> if [ -z "$GID" ]; then
>     /usr/sbin/addgroup --system ${GROUP}
>     if [ $? -ne 0 ]; then
>         echo >&2 "Error: failed to add the group ${GROUP}."
>         exit 4
>     fi
> else
>     echo >&2 "kvm: Using the existing group \"$GROUP\" (gid $GID) for 
> /dev/kvm"
> fi

In particular, note that it simply does "grep ${GROUP} /etc/group".
This will match any line in /etc/group which contains the string
"kvm".  This can lead to two possible failures:

* If an /etc/group line for a non-system group contains "kvm"
  somewhere, the install will incorrectly complain that the group
  already exists.

* If an /etc/group line for a system group contains "kvm" somewhere,
  kvm will use it rather than creating a group "kvm".

Might I suggest "getent group kvm"?

(Also, I haven't seen code like this in any other package that creates
a group.)

- Josh Triplett



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to