[PATCH v2] linux: return UNSUPPORTED in tst-mount if !support_can_chroot

Michael Hudson-Doyle michael.hudson@canonical.com
Sun Jul 17 21:44:40 GMT 2022


On Sat, 16 Jul 2022 at 03:45, Florian Weimer via Libc-alpha <
libc-alpha@sourceware.org> wrote:

> * Carlos O'Donell:
>
> >> I think you should call and check support_enter_mount_namespace instead,
> >> to make sure that the test does not modify the original mount namespace.
> >
> > Like this in the child?
> >
> > diff --git a/sysdeps/unix/sysv/linux/tst-mount.c
> b/sysdeps/unix/sysv/linux/tst-mount.c
> > index 502d7e3433..d19d70d42d 100644
> > --- a/sysdeps/unix/sysv/linux/tst-mount.c
> > +++ b/sysdeps/unix/sysv/linux/tst-mount.c
> > @@ -107,7 +107,11 @@ do_test (void)
> >
> >    pid_t pid = xfork ();
> >    if (pid == 0)
> > -    subprocess ();
> > +    {
> > +      if (!support_enter_mount_namespace ())
> > +        FAIL_UNSUPPORTED ("could not enter new mount namespace");
> > +      subprocess ();
> > +    }
>
> Yes, except that you need to change
>
>   xwaitpid (pid, &status, 0);
>   TEST_VERIFY (WIFEXITED (status));
>
> as well, to handle status 77.
>

I was a bit confused by this, as subprocess() already calls
FAIL_UNSUPPORTED (if fsopen sets errno to ENOSYS). WIFEXITED (status)
doesn't distinguish between status 0 or 77 though... So I guess I don't
understand how the test machinery works here.


> I'm not entirely sure the fork is necessary, though.
>

Yes, I don't see why it's there either.

Cheers,
mwh


More information about the Libc-alpha mailing list