Re: [PATCH v2 1/2] m4: Run QEMU under a distro-specific user when possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2019-03-26 at 16:20 +0000, Daniel P. Berrangé wrote:
> On Tue, Mar 26, 2019 at 05:06:15PM +0100, Andrea Bolognani wrote:
> > +    # Try to integrate gracefully with downstream packages by running QEMU
> > +    # processes under the same user and group they would
> > +    case $(grep ^ID= /etc/os-release 2>/dev/null) in
> > +      *arch*)
> > +        default_qemu_user=nobody
> > +        default_qemu_group=nobody
> > +        ;;
> > +      *centos*|*fedora*|*gentoo*|*rhel*|*suse*)
> > +        default_qemu_user=qemu
> > +        default_qemu_group=qemu
> > +        ;;
> > +      *debian*)
> > +        default_qemu_user=libvirt-qemu
> > +        default_qemu_group=libvirt-qemu
> > +        ;;
> > +      *ubuntu*)
> > +        default_qemu_user=libvirt-qemu
> > +        default_qemu_group=kvm
> > +        ;;
> 
> Or this needs to gain...
> 
>   *)
>        default_qemu_user=root
>        default_qemu_group=root
> 
> > +    if ! getent passwd "$default_qemu_user" >/dev/null 2>&1 || \
> > +       ! getent group "$default_qemu_group" >/dev/null 2>&1; then
> 
> otherwise these are passing an empty string to getent which
> feels dubious. Even if empty string works I wouldn't want to
> rely on that.

A (quoted) empty string work exactly the way you'd expect it to, in
that it will make the command fail every single time. But sure, I can
do the more obviously correct thing and add the default case above if
you prefer that :)

> > +      default_qemu_user=root
> > +      default_qemu_group=root
> 
> We ought to issue a warning if the expected user/group doesn't
> actually exist.

You got it. v3 coming right up.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux