public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH pxar] decoder: fix incorrect accounting for header in payload input
Date: Wed, 18 Sep 2024 17:00:47 +0200	[thread overview]
Message-ID: <20240918150047.485551-1-c.ebner@proxmox.com> (raw)

Payload entries are separated by headers of type PAYLOAD within the
payload stream of split pxar archives, used for consistency checks
when accessing the file contents via a reader instance.

Commit 5b8204d0 moved these consistency checks, so they only happen
when actually accessing the content, thereby drastically improving
performance when navigating contents via the metadata archive.

The commit however also incorrectly increased the `Decoder`s
`payload_consumed` field by the size of the header, in case the file
payload has not been accessed by the `content_reader`.

As this filed is used to account for consumed bytes while sequentially
reading to possibly skip over entries, this leads to incorrectly
skipping of bytes in the stream (less than required). The main
manifestation being that a pxar extract with provided match pattern
failed.

Therefore, drop the incorrect accounting of the payload header.

Fixes: 5b8204d0 ("decoder: move payload header check for split input")

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
Stumbled accorss this one while working on issue 2996.
Without this a
```
pxar extract archive.mpxar target --payload-input archive.ppxar
--pattern <some-pattern>
```
will fail the payload header checks.

 src/decoder/mod.rs | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs
index 6191627..613ec12 100644
--- a/src/decoder/mod.rs
+++ b/src/decoder/mod.rs
@@ -299,14 +299,9 @@ impl<I: SeqRead> DecoderImpl<I> {
                 }
                 State::InPayload {
                     offset,
-                    header_checked,
                     ..
                 } => {
                     if self.input.payload().is_some() {
-                        if !header_checked {
-                            // header is only checked if payload has been accessed
-                            self.payload_consumed += size_of::<Header>() as u64;
-                        }
                         // Update consumed payload as given by the offset referenced by the content reader
                         self.payload_consumed += offset;
                     } else {
-- 
2.39.2



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


                 reply	other threads:[~2024-09-18 15:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240918150047.485551-1-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal