Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w8GLk-000MO6-0b for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Apr 2026 11:36:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8GLh-005VSm-1k for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Apr 2026 11:36:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w8GLh-005VSW-0L for pgsql-hackers@lists.postgresql.org; Thu, 02 Apr 2026 11:36:33 +0000 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w8GLe-00000000Bht-0fsa for pgsql-hackers@lists.postgresql.org; Thu, 02 Apr 2026 11:36:32 +0000 Received: by mail-qt1-x832.google.com with SMTP id d75a77b69052e-506a6cf8242so7022341cf.1 for ; Thu, 02 Apr 2026 04:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1775129788; x=1775734588; darn=lists.postgresql.org; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:from:to:cc:subject :date:message-id:reply-to; bh=lvvkMm+9u1agP2BJtv79j340JS7mY+huvQRIe+OIqFQ=; b=CFcCTGE7R92MkGORTPuZ5Pev4BHnfs6B13CizGKk7jOHwb/Dp2gLvhYvuhytswxZwG glneFPlFM41I80UULFeYF0MC4vzxVcIJNF/QIyLOzXd1YdJty+G7Ozv8ylhw6gQgrYuK 7j5bL1Eilm+m3Bk7wpW7tTSo0HjVFu+AbU1LQ1j5j54czlZbXZTHWtzd/tNdh8GiUvJL NVytZS0XftcahZk9nXQqh7/3QuFq/YmNKuvbAn3WfLuqo3g5bkhDGtCeNDIUefgw3kzx vXGnGLL2s3AhVWwRGLqGRRQ0u2N1USlJMvOs0sFfPOxKlODAOHFOgAqEmE3t/CLu+BH8 fdsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775129788; x=1775734588; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lvvkMm+9u1agP2BJtv79j340JS7mY+huvQRIe+OIqFQ=; b=YUVRMqpCeE/79iKSg82DZw2GKQ8UG7T5tr636HGhJu/n06L+vcLtStPFxvg0bgkCtG ZH/HE4tITKW+QZFuymHMnWz/WtZQwI4MYjbD/UKuQ3c8IbvU4DoCtefiSlCcN/VM/Ery C65XSi3n42kgQqhqla6CpDyt6qmJmbBswF+iXAS2gINO7xGWKZ0vC0rw05SX8ydYOFw3 M49xMhqIz93DGQFnh+mbAwXN5HhdzccXWkMRKyBQckRH+Ce8vrqNDmCtpyNx2/CYAtCY mIKUyBHB3Fpkea1Q94Zm7y5V0kElcfoiRpUK2R1GJF6FlvM/+996rtOdfBQXyPJaMCyq 0Rgw== X-Forwarded-Encrypted: i=1; AJvYcCXecjwt4L+mRGZdIJk7paOvaSUKqz9rZxeuMZlLLQ/SdlFM+tnqbaegAP0leQZHOUYkMoLqraUiEc2KR3TZ@lists.postgresql.org X-Gm-Message-State: AOJu0YzxdZo87UjJ2uyuJ0xcqnAhNaTOROTvcH7puh3j0nFjm8/9UT6r kRa17uLiFn/T8i5EdGdPMKUwMToh9n5U8gc8bfdnXLGYJj8FOSzoMtSKM2B1bQueJLM= X-Gm-Gg: ATEYQzx8KiYdzb1liKsTPsMCZ9T2k88xr51dLzFh8hL+1xHhITJD3KCX1QlmPfJYPVt /qgN6GGcFWJlxhIdBq98RHIQdSfHw2H002AUp53eKH5ACZgRhiDB0nNKVRtsJkRRS7iOf3T1x/+ YzIyBDMeT406UKrcaiWdc6CdMOgonl9qac9x5g7LudWf2xLw/IeKxqSKigjTlEhMoLsbKk/hKZI b+JPjoF6K3iNlfko88DsXZ338rthTYskoeke8dKJSCSAyahR2a8mr4YXQpLyyt8yIT/eDuCLsa9 Yu/YvqC2CUcVDyxVvAQX3WJlBVcLc02jgm9g5PuguYoKCizxf4I4hUhLmceTpVXmGZ1iAXpSD82 cAYfvikcuPUj//z8p7KjbBQcDmW/x60ld3n0dQt5mAdpK1d75aRZ0bl9+pIXHCpjeWtaQva7a4k WI9IKwCH9bEIncMO36kBPVe6MSggJUEqPKjo2T/RP3 X-Received: by 2002:a05:622a:1f88:b0:50b:317c:33aa with SMTP id d75a77b69052e-50d3bcd6e04mr99835911cf.34.1775129787916; Thu, 02 Apr 2026 04:36:27 -0700 (PDT) Received: from ?IPV6:2605:a601:a6b0:500::1cb? ([2605:a601:a6b0:500::1cb]) by smtp.googlemail.com with ESMTPSA id d75a77b69052e-50d4b73ea66sm24252651cf.14.2026.04.02.04.36.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Apr 2026 04:36:27 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------T0dxcgrx2JiXMZF6HewjA4Vs" Message-ID: <94547580-4c88-4e3b-ab53-f501a2da6f06@dunslane.net> Date: Thu, 2 Apr 2026 07:36:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pg_waldump: support decoding of WAL inside tarfile To: Thomas Munro , Tom Lane Cc: Tomas Vondra , Andres Freund , Michael Paquier , Amul Sul , Zsolt Parragi , Robert Haas , Chao Li , Anthonin Bonnefoy , Fujii Masao , Jakub Wartak , PostgreSQL Hackers References: <2250061.1774104346@sss.pgh.pa.us> <2790913.1774200584@sss.pgh.pa.us> <2880042.1774203473@sss.pgh!!.pa.us> <3341199.1774221191@sss.pgh.pa.us> <3424809.1774234940@sss.pgh.pa.us> <1624716.1774736283@sss.pgh.pa.us> <1626907.1774737417@sss.pgh.pa.us> <97a382c0-1f19-4ea0-951f-e37e6abc34a3@vondra.me> <1630755.1774739531@sss.pgh.pa.us> <1873141.1774823011@sss.pgh.pa.us> <3049460.1775067940@sss.pgh.pa.us> From: Andrew Dunstan Content-Language: en-US Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAHNJEFuZHJldyBEdW5zdGFuIDxhbmRyZXdAZHVuc2xhbmUubmV0PsLAlwQTAQgAQQIbAwIX gAIZAQULCQgHAwUVCgkICwUWAgMBAAIeBRYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNGd BQkdEO8nAAoJEJn6f8tZ/DuBq74H/jkTR4Zi3stbw+xC7v2u3QozssK7MYPL2AsVfh7OealS h182fiWXpfvmmAB7WUHbhk9GC2RAOnHI/2d2jgKaMLAHsGYOT0YopTVIwRY43fCw/mK67yxc wmDcX+zyKfLaivNbf5A7QPLNwda98bEAMSJ8Sn652Uc6cA8t3uKGsVzbRBQOoYzjgvBCfSrE 9ql3PDNg0l4BfAqabd2f70ZUm9VAMEPrgv/v2xI7M2XiL4g5BVmqLCOwxLM8RMCotCuoweUr VO43DeBCIDwLxotMJKvGWDjBzQYlU1NPUAtNcz/gN9ITUe1VUGjyvGj4u1lxBOcQQUw7l1+T 5moZ4iZxXzvOwE0ETspYWQEIANGc4zQULOxhbqO2dyD51YhqCNRmm9oKWaqf+wmW4tpDe/VV cxAnNizd4LWCHfzpb5cHAtGkOPePMfzWVf6nvdF7d3eglbtf59+zG7O7llV0xSSoFiieQBsr GvqDInXYX/4mRRXMtyhM353/tixC9RWLs1oofyYmCPPXXY7h9R7en3B8BoVrRFcdzlIY/NFN hFGW/9dkEiGjgna2Rk6e15kln4ZvFBWUg23p93w/pqXcxY6+k/8TEk+C4R+M6w7o2PLGOjdZ +kPiUcw5H85zf/yZJwQXzisXaNduwWB6Vads9YC9dj6kPR1c4VGRqAaYL++LAEOqrlvm2Tvq QqZRtnEAEQEAAcLAfAQYAQgAJgIbDBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNI2BQkd EODdAAoJEJn6f8tZ/DuBfw0IAKTsfD40teP/pp+bsLLMSxPXUYrrprTj7WFB5v61p6dkpSr/ qXmMlyahdxQFaPmfVgVirB1Vk/kHiWNnnGjfUV9nB2Zg9LI0Xb9/ts3LsUiRWXzG3tkMY6XL vsVOxW4XFRND9l2q+WW93aZ1DZl+fqWfYgMvsusFRhmGFOKTRfKPta2Pkv+AhA24N4+PrR5p bU4k2MO8PAGiK8eaYKGFG1bHKuAvoDoF7WXJ3FHxuWqLnKEt4dfOLm5pAe3zq1Lt6q8azT9i QWGpSAK5vQUWQHBHpiDjdPeqKZ6HiAXIIKfSmb+jrvXBqoP+D6/K7rUjG2aXiRtTIAXms9sm VRu7cmw= In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------T0dxcgrx2JiXMZF6HewjA4Vs Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2026-04-01 We 8:16 PM, Thomas Munro wrote: > On Thu, Apr 2, 2026 at 7:25 AM Tom Lane wrote: >> Also, if we are admitting the possibility that what we are reading >> was made by a platform-supplied tar and not our own code, I think >> it verges on lunacy to behave as though unsupported typeflags are >> regular files. > Yeah, if this is the first time we parse files we didn't make then > that makes total sense. I was a bit unsure of that question when I > suggested we reject pax only after we've failed to find a file, in > case there are scenarios that work today with harmless ignorable pax > headers that don't change the file name. > >> So I think we need something more or less like the attached. > LGTM. Tested with both tars here. I updated that little test patch > for this. Not sure if you think it's worth a test though, now that > it's so simple. > > @Andrew: I tried usingFile::Spec->devnull() this time. Are you able > to check if this works OK on Windows, applied on top of Tom's patch? > AFAIK should be able to run this new test and pass, not skip it. But > it could be that the shell invocation needs tweaking. It's hard to > tell from CI. (Huh, apparently Windows ships a copy of BSD tar as > C:\Windows\System32\tar.exe these days.) Yes, that appears to work. I would put a "2>&1" at the end - we don't care about the output, just whether or not it succeeds: C:\Windows\system32>perl -MFile::Spec -e "print File::Spec->devnull();" nul C:\Windows\system32>tar --no-read-sparse -c - nul > nul 2>&1 && echo hello C:\Windows\system32>tar --no-read-sparse -c - nul > nul 2>&1 || echo hello hello cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com --------------T0dxcgrx2JiXMZF6HewjA4Vs Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2026-04-01 We 8:16 PM, Thomas Munro wrote:
On Thu, Apr 2, 2026 at 7:25 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Also, if we are admitting the possibility that what we are reading
was made by a platform-supplied tar and not our own code, I think
it verges on lunacy to behave as though unsupported typeflags are
regular files.
Yeah, if this is the first time we parse files we didn't make then
that makes total sense.  I was a bit unsure of that question when I
suggested we reject pax only after we've failed to find a file, in
case there are scenarios that work today with harmless ignorable pax
headers that don't change the file name.

So I think we need something more or less like the attached.
LGTM.  Tested with both tars here.  I updated that little test patch
for this.  Not sure if you think it's worth a test though, now that
it's so simple.

@Andrew: I tried using File::Spec->devnull() this time.  Are you able
to check if this works OK on Windows, applied on top of Tom's patch?
AFAIK should be able to run this new test and pass, not skip it.  But
it could be that the shell invocation needs tweaking.  It's hard to
tell from CI.  (Huh, apparently Windows ships a copy of BSD tar as
C:\Windows\System32\tar.exe these days.)


Yes, that appears to work. I would put a "2>&1" at the end - we don't care about the output, just whether or not it succeeds:


C:\Windows\system32>perl -MFile::Spec -e "print File::Spec->devnull();"
nul

C:\Windows\system32>tar --no-read-sparse -c - nul > nul 2>&1 && echo hello

C:\Windows\system32>tar --no-read-sparse -c - nul > nul 2>&1 || echo hello
hello


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com
--------------T0dxcgrx2JiXMZF6HewjA4Vs--