[pbs-devel] [PATCH v9 proxmox-backup 40/58] pxar: bin: ignore version and prelude entries in listing

Christian Ebner c.ebner at proxmox.com
Wed Jun 5 12:53:58 CEST 2024


Do not list the pxar format version and the prelude entries in the
output of pxar list, these are not regular entries. Do include them
however when dumping with the debug environmet variable set.
Since the prelude is arbitrary in size, only show the content size.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 8:
- prefix subject with `pxar: bin` instead of `pxar` only
- do show enties when debug environment variable is set

 pxar-bin/Cargo.toml  |  1 +
 pxar-bin/src/main.rs | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/pxar-bin/Cargo.toml b/pxar-bin/Cargo.toml
index d91c03d3e..bb010ff78 100644
--- a/pxar-bin/Cargo.toml
+++ b/pxar-bin/Cargo.toml
@@ -20,6 +20,7 @@ pathpatterns.workspace = true
 pxar.workspace = true
 
 proxmox-async.workspace = true
+proxmox-human-byte.workspace = true
 proxmox-router = { workspace = true, features = ["cli", "server"] }
 proxmox-schema = { workspace = true, features = [ "api-macro" ] }
 proxmox-sys.workspace = true
diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs
index 52bb1ca97..7ea5b114a 100644
--- a/pxar-bin/src/main.rs
+++ b/pxar-bin/src/main.rs
@@ -18,6 +18,7 @@ use pbs_client::pxar::{
 };
 use pxar::EntryKind;
 
+use proxmox_human_byte::HumanByte;
 use proxmox_router::cli::*;
 use proxmox_schema::api;
 
@@ -490,6 +491,14 @@ fn dump_archive(archive: String, payload_input: Option<String>) -> Result<(), Er
 
         if log::log_enabled!(log::Level::Debug) {
             match entry.kind() {
+                EntryKind::Version(version) => {
+                    log::debug!("pxar format version '{version:?}'");
+                    continue;
+                }
+                EntryKind::Prelude(prelude) => {
+                    log::debug!("prelude of size {}", HumanByte::from(prelude.data.len()));
+                    continue;
+                }
                 EntryKind::File {
                     payload_offset: Some(offset),
                     size,
@@ -508,7 +517,10 @@ fn dump_archive(archive: String, payload_input: Option<String>) -> Result<(), Er
 
             log::debug!("{}", format_single_line_entry(&entry));
         } else {
-            log::info!("{:?}", entry.path());
+            match entry.kind() {
+                EntryKind::Version(_) | EntryKind::Prelude(_) => continue,
+                _ => log::info!("{:?}", entry.path()),
+            }
         }
     }
     Ok(())
-- 
2.39.2





More information about the pbs-devel mailing list