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.98.2) (envelope-from ) id 1xRYdu-000000014un-1LDA for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Nov 2026 17:31:22 +0000 Received: from localhost ([127.0.0.1]:47716 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xRYds-0000000450q-0v8T for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Nov 2026 17:31:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:46878) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xRA7L-0000000BmTg-35WN for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 15:20:08 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xRA7K-00000000OQd-2yO6 for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 15:20:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=yA0nSNhjQp7l8I1nCvmUzJLrM9+u2imzF9k0RGu/PkY=; b=qrT4ZAOf077m3B46oBp4mwFO4N SBCB5qiID/B4vkKcci/Zz2dpZj0tDEr+71WOrxGtNNXL7kzlixXcuhpci/gDxJbvqcW2tC6Vfp7YS D6yxmXjLauMGdetpsTmPgkXxE0HZXJSJj00CsF+fr2ZEoA1CBMNcxIaa3L5mmeIjR6BkTlAMjPJ4v nRCIWL08SZQcFsIf7UXtS6DLVzar5Yzs3GQPSeW33Wtx//WeH2j0rymTK92ti+QGRjNGjvC+7tr6B YA9N4idOsQUpruXvV+XgPH4qErHtuWzTI8rHVC+6h6s6Pv7CO5wUEcdiw3b86X2RDNdNlbZuMFquf iy5rCzxQ==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xRA7I-000000014xI-0odZ for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 15:20:06 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xRA7H-00000002mUK-0u8e for pgsql-bugs@lists.postgresql.org; Wed, 11 Nov 2026 15:20:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19888: pg_verifybackup accepts ustar member under the wrong manifest path To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: imchifan@163.com Reply-To: imchifan@163.com, pgsql-bugs@lists.postgresql.org Date: Wed, 11 Nov 2026 15:19:18 +0000 Message-ID: <19888-eb886d395129f290@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19888 Logged by: Qifan Liu Email address: imchifan@163.com PostgreSQL version: 18.6 Operating system: Linux/amd64 Description: =20 PostgreSQL 18.6 (Debian 18.6-1.pgdg13+2) on Linux/amd64 reports successful verification after a tar backup member's ustar prefix is changed. GNU tar identifies the member as archive_member_directory_name/backup_label, but pg_verifybackup matches it to the manifest entry backup_label. The replacement prefix is 29 bytes long, preserving the recorded field mutation. Archive verification should construct the pathname from both the ustar prefix and name fields and reject the member because the resulting path is absent from the backup manifest. How to repeat: #!/bin/sh set -eu : "${PG_BASEBACKUP:=3Dpg_basebackup}" : "${PG_VERIFYBACKUP:=3Dpg_verifybackup}" work=3D$(mktemp -d "${TMPDIR:-/tmp}/verify-prefix.XXXXXX") backup=3D"$work/backup" mkdir "$backup" "$PG_BASEBACKUP" -D "$backup" -F tar -X stream "$PG_VERIFYBACKUP" --no-parse-wal "$backup" printf archive_member_directory_name | dd of=3D"$backup/base.tar" bs=3D1 seek=3D345 conv=3Dnotrunc status=3Dnone printf ' ' | dd of=3D"$backup/base.tar" bs=3D1 seek=3D148 conv=3Dnot= runc status=3Dnone checksum=3D$(dd if=3D"$backup/base.tar" bs=3D512 count=3D1 status=3Dnone | = od -An -tu1 | awk '{for(i=3D1;i<=3DNF;i++)s+=3D$i} END {print s}') printf '%06o\0 ' "$checksum" | dd of=3D"$backup/base.tar" bs=3D1 seek=3D148 conv=3Dnotrunc status=3Dnone tar -tf "$backup/base.tar" | grep '^archive_member_directory_name/backup_label$' "$PG_VERIFYBACKUP" --no-parse-wal "$backup" echo "BUG REPRODUCED: pg_verifybackup accepted an archive member whose ustar prefix changes its manifest identity" Set PGHOST and any other required libpq variables for a server that permits replication connections. PG_BASEBACKUP and PG_VERIFYBACKUP may be set to select the tested binaries. Save the script as run.sh and run: chmod +x run.sh ./run.sh With the incidental prefix renamed as above, a successful reproduction is expected to end with: backup successfully verified archive_member_directory_name/backup_label backup successfully verified BUG REPRODUCED: pg_verifybackup accepted an archive member whose ustar prefix changes its manifest identity In the recorded execution, the baseline and mutated pg_verifybackup commands both exited with status 0. GNU tar also exited with status 0 after displaying the prefixed pathname. The tar parser copies the header's name field into the member pathname but does not incorporate the ustar prefix field. pg_verifybackup consequently verifies the member's contents against the unprefixed manifest entry. The issue was reproduced on PostgreSQL 18.6 using GNU tar and ordinary command-line backup tools. This occurs when pg_verifybackup checks a tar-format base backup containing a regular ustar member with a nonempty prefix and a valid recomputed header checksum.