"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: fix 'got import' output sorting issue
To:
Mark Jamsek <mark@jamsek.com>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 5 Jan 2025 09:50:32 +0100

Download raw body.

Thread
On Sun, Jan 05, 2025 at 05:14:06PM +1100, Mark Jamsek wrote:
> Stefan Sperling <stsp@stsp.name> wrote:
> > While running the -portable regression tests on Debian I noticed
> > failures related to path sorting in the output of 'got import':
> > 
> > @@ -1,5 +1,5 @@
> > -A  /tmp/got-test-import_basic-QbjC1yFQpw/tree/gamma/delta
> >  A  /tmp/got-test-import_basic-QbjC1yFQpw/tree/epsilon/zeta
> > +A  /tmp/got-test-import_basic-QbjC1yFQpw/tree/gamma/delta
> >  A  /tmp/got-test-import_basic-QbjC1yFQpw/tree/alpha
> >  A  /tmp/got-test-import_basic-QbjC1yFQpw/tree/beta
> > 
> > We currently process directory entries in readdir() order, which is
> > not guaranteed to match the order of got_path_cmp(). The patch below
> > lets 'got import' traverse entries in got_path_cmp() order and produces
> > the same test failures on OpenBSD. Adjust test expectations accordingly.
> > 
> > ok?
> 
> Yes, makes sense and reads good.

Thanks, sent (though I forgot to add your OK to the commit message).

> ok with one question: should we check the telldir(3) calls for failure?
> 
> POSIX.1-2024 specifies no errors are defined, but telldir(3) on OpenBSD
> and Alpine specify that on failure, -1 is returned and errno is set;
> and OpenBSD also states that telldir() can fail for any of the errors
> specified for realloc(3).

Good catch. I've added telldir error checks on top.