Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muzbo-0000yo-Mk for pgsql-committers@arkaria.postgresql.org; Wed, 08 Dec 2021 16:15:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1muzbm-0006CR-Jh for pgsql-committers@arkaria.postgresql.org; Wed, 08 Dec 2021 16:15:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muzbm-0006CH-CL for pgsql-committers@lists.postgresql.org; Wed, 08 Dec 2021 16:15:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muzbk-000167-1K for pgsql-committers@lists.postgresql.org; Wed, 08 Dec 2021 16:15:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1B8GFnl53657698; Wed, 8 Dec 2021 11:15:49 -0500 From: Tom Lane To: Andrew Dunstan cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Check that we have a working tar before trying to use it In-reply-to: <2e118a11-6936-21ec-6782-e9dbb20972c2@dunslane.net> References: <3655283.1638977975@sss.pgh.pa.us> <2e118a11-6936-21ec-6782-e9dbb20972c2@dunslane.net> Comments: In-reply-to Andrew Dunstan message dated "Wed, 08 Dec 2021 10:56:46 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3657696.1638980149.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 08 Dec 2021 11:15:49 -0500 Message-ID: <3657697.1638980149@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrew Dunstan 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@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@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@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@Density ] | [ Blocksb ] ] [-C Directory ] F= ile ... tgl@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