Re: vmctl: print root user in status owner field

2019-12-15 Thread Mike Larkin
On Sat, Dec 14, 2019 at 02:16:20AM +0100, Klemens Nanni wrote:
> With "owner root:wheel" (any group) the `vmctl status' output
> will omit the "root" part in the OWNER column:
> 
>   vm "generic" {
>   owner "root:vms"
>   ...
>   }
> 
>   $ vmctl status
>  ID   PID VCPUS  MAXMEM  CURMEM TTYOWNERSTATE NAME
>   1 - 1512M   -   - :vms  stopped generic
> 
> It only omits it if the user is root, presumably to say "only the group
> matters".
> 
> I find this special case confusing as it looks incomplete, instead just
> print whatever is configured: 
> 
>   $ ./obj/vmctl status
>  ID   PID VCPUS  MAXMEM  CURMEM TTYOWNERSTATE NAME
>   1 - 1512M   -   - root:vms  stopped generic
> 
> Feedback? OK?
> 
> 
> Index: vmctl.c
> ===
> RCS file: /cvs/src/usr.sbin/vmctl/vmctl.c,v
> retrieving revision 1.72
> diff -u -p -r1.72 vmctl.c
> --- vmctl.c   12 Dec 2019 03:53:38 -  1.72
> +++ vmctl.c   14 Dec 2019 00:54:23 -
> @@ -768,8 +768,6 @@ print_vm_info(struct vmop_info_result *l
>   (void)strlcpy(user, name, sizeof(user));
>   /* get group name */
>   if (vmi->vir_gid != -1) {
> - if (vmi->vir_uid == 0)
> - *user = '\0';
>   name = group_from_gid(vmi->vir_gid, 1);
>   if (name == NULL)
>   (void)snprintf(group, sizeof(group),
> 

sure



Re: vmctl: print root user in status owner field

2019-12-14 Thread Jasper Lievisse Adriaanse



> On 14 Dec 2019, at 02:16, Klemens Nanni  wrote:
> 
> With "owner root:wheel" (any group) the `vmctl status' output
> will omit the "root" part in the OWNER column:
> 
>   vm "generic" {
>   owner "root:vms"
>   ...
>   }
> 
>   $ vmctl status
>  ID   PID VCPUS  MAXMEM  CURMEM TTYOWNERSTATE NAME
>   1 - 1512M   -   - :vms  stopped generic
> 
> It only omits it if the user is root, presumably to say "only the group
> matters".
> 
> I find this special case confusing as it looks incomplete, instead just
> print whatever is configured: 
> 
>   $ ./obj/vmctl status
>  ID   PID VCPUS  MAXMEM  CURMEM TTYOWNERSTATE NAME
>   1 - 1512M   -   - root:vms  stopped generic
> 
> Feedback? OK?
> 
> 
> Index: vmctl.c
> ===
> RCS file: /cvs/src/usr.sbin/vmctl/vmctl.c,v
> retrieving revision 1.72
> diff -u -p -r1.72 vmctl.c
> --- vmctl.c   12 Dec 2019 03:53:38 -  1.72
> +++ vmctl.c   14 Dec 2019 00:54:23 -
> @@ -768,8 +768,6 @@ print_vm_info(struct vmop_info_result *l
>   (void)strlcpy(user, name, sizeof(user));
>   /* get group name */
>   if (vmi->vir_gid != -1) {
> - if (vmi->vir_uid == 0)
> - *user = '\0';
>   name = group_from_gid(vmi->vir_gid, 1);
>   if (name == NULL)
>   (void)snprintf(group, sizeof(group),
> 

I prefer this output as it’s explicit about the owner. OK with me.

Cheers,
Jasper


vmctl: print root user in status owner field

2019-12-13 Thread Klemens Nanni
With "owner root:wheel" (any group) the `vmctl status' output
will omit the "root" part in the OWNER column:

vm "generic" {
owner "root:vms"
...
}

$ vmctl status
   ID   PID VCPUS  MAXMEM  CURMEM TTYOWNERSTATE NAME
1 - 1512M   -   - :vms  stopped generic

It only omits it if the user is root, presumably to say "only the group
matters".

I find this special case confusing as it looks incomplete, instead just
print whatever is configured: 

$ ./obj/vmctl status
   ID   PID VCPUS  MAXMEM  CURMEM TTYOWNERSTATE NAME
1 - 1512M   -   - root:vms  stopped generic

Feedback? OK?


Index: vmctl.c
===
RCS file: /cvs/src/usr.sbin/vmctl/vmctl.c,v
retrieving revision 1.72
diff -u -p -r1.72 vmctl.c
--- vmctl.c 12 Dec 2019 03:53:38 -  1.72
+++ vmctl.c 14 Dec 2019 00:54:23 -
@@ -768,8 +768,6 @@ print_vm_info(struct vmop_info_result *l
(void)strlcpy(user, name, sizeof(user));
/* get group name */
if (vmi->vir_gid != -1) {
-   if (vmi->vir_uid == 0)
-   *user = '\0';
name = group_from_gid(vmi->vir_gid, 1);
if (name == NULL)
(void)snprintf(group, sizeof(group),