Re: [PATCH] t5319: don't trip over a user name with whitespace

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

 



Hi Peff,

On Sun, 30 Jun 2019, Jeff King wrote:

> On Sun, Jun 30, 2019 at 10:59:34PM +0200, Johannes Sixt wrote:
>
> > Am 30.06.19 um 21:48 schrieb Eric Sunshine:
> > > On Sun, Jun 30, 2019 at 2:57 PM Johannes Sixt <j6t@xxxxxxxx> wrote:
> > >> diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
> > >> @@ -443,7 +443,7 @@ test_expect_success 'repack with minimum size does not alter existing packs' '
> > >> -               MINSIZE=$(ls -l .git/objects/pack/*pack | awk "{print \$5;}" | sort -n | head -n 1) &&
> > >> +               MINSIZE=$(stat -c %s .git/objects/pack/*pack | sort -n | head -n 1) &&
> > >
> > > Unfortunately, this is not portable. While "stat -c %s" works on Linux
> > > and MSYS2, neither that option nor the format directive are recognized
> > > on BSD-like platforms (I tested Mac OS and FreeBSD), which instead
> > > need "stat -f %z".
> >
> > Ouch! I did notice that stat(1) is not in POSIX, but hoped that it was
> > sufficiently portable. I need a new idea...
>
> If we are OK relying on rudimentary perl[1], then:
>
>   perl -le "print((stat)[7]) for @ARGV"
>
> works. If you want it more readable, then maybe:
>
>   perl -MFile::stat -le "print stat(\$_)->size for @ARGV"

Or we stop introducing new Perl calls, and use the perfectly fine
`test-tool path-utils file-size` command:

https://github.com/git/git/blob/v2.22.0/t/helper/test-path-utils.c#L302-L312

This solves not only portability problems but also avoids yet another
obstacle into making a `NO_PERL` test suite run really work without Perl.

Ciao,
Dscho




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux