Re: pgsql: Check that we have a working tar before trying to use it

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Check that we have a working tar before trying to use it
Date: 2021-12-08 16:15:49
Message-ID: 3657697.1638980149@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> On 12/8/21 10:39, Tom Lane wrote:
>> ISTM that effectively restricts the test to only running
>> on machines with GNU tar, which basically removes all the
>> interest of it. We know what GNU tar does ... it's the
>> weird legacy tar versions that might teach us something.
>> See 57b5a9646 for a recent example of the sort of bug
>> this test can no longer find.

> I tested on a freebsd system before I did this for that reason. It's not
> using GNU tar:
> user(at)freebsd:~ $ tar --version
> bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.2.5 bz2lib/1.0.8

Right, but on AIX:

tgl(at)gcc119:[/home/tgl]tar --version
tar: Not a recognized flag: -
Usage: tar -{c|r|t|u|x} [ -BdDEFhilmopRUsvwZ ] [ -Number ] [ -f TarFil e ]
[ -b Blocks ] [ -S [ Feet ] | [ Feet(at)Density ] | [ Blocksb ] ]
[ -L InputList ] [-X ExcludeFile] [ -N Blocks ] [ -C Directory ] File ...
Usage: tar {c|r|t|u|x} [ bBdDEfFhilLXmNopRsSUvwZ[0-9] ] ]
[ Blocks ] [ TarFile ] [ InputList ] [ ExcludeFile ]
[ [ Feet ] | [ Feet(at)Density ] | [ Blocksb ] ] [-C Directory ] File ...
tgl(at)gcc119:[/home/tgl]echo $?
1

> Do you have an alternative test we could use?

I think you need to be straight up about it, say

touch foo; tar cf foo.tar foo

(At least on the Unix machines I tried, it works to use /dev/null
as the output file, saving one cleanup step. But I don't know
if that'll work on Windows.)

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2021-12-08 16:53:47 Re: pgsql: Check that we have a working tar before trying to use it
Previous Message Andrew Dunstan 2021-12-08 15:56:46 Re: pgsql: Check that we have a working tar before trying to use it