[Toybox] [PATCH] Specify owner when testing tar with /dev/null

Colin Cross ccross at google.com
Wed Dec 6 16:15:19 PST 2023


On Tue, Dec 5, 2023 at 11:41 PM Rob Landley <rob at landley.net> wrote:
>
> On 10/6/23 18:52, Colin Cross via Toybox wrote:
> > /dev/null is not owned by root when the toybox tests are run inside
> > a sandbox in the Android CI infrastructure.  Specify the owner as
> > nobody to make the tar results consistent.
>
> Sorry for the delay, window got buried.
>
> The problem here is I need a test where toybox is detecting ownership other than
> the current owner, and "/dev/null is owned by root" is one of the few files I
> can be reasonably sure about. It's true on every Linux distro, true on FreeBSD
> and MacOS (even if the _group_ is "wheel" in those two, the _owner_ is root)...
>
> Who _does_ own /dev/null in your test environment?

"nobody":

    FAIL: tar pass /dev/null
    echo -ne '' | tar c --mtime @0 --group sys /dev/null 2>/dev/null | LST
    --- expected 2023-12-07 00:03:55.797797713 +0000
    +++ actual 2023-12-07 00:03:55.805797762 +0000
    @@ -1 +1 @@
    -crw-rw-rw- root/sys 1,3 1970-01-01 00:00 dev/null
    +crw-rw-rw- nobody/sys 1,3 1970-01-01 00:00 dev/null
    external/toybox/toybox-gtests.cpp:168: Failure
    Expected equality of these values:
      exit_status
        Which is: 1
      0


More information about the Toybox mailing list