From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 7D2711FF163 for ; Thu, 24 Oct 2024 11:10:27 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BF866A81F; Thu, 24 Oct 2024 11:11:07 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Thu, 24 Oct 2024 11:10:09 +0200 Message-Id: <20241024091009.76949-1-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.028 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [tools.rs] Subject: [pbs-devel] [PATCH proxmox-backup] client: catalog shell: drop payload offset in `stat` output X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Drop the payload offset output for the multi line formatting helper, as the formatting was skewed anyways and the `stat` output is not intended for debugging. Commit 51e8fa96 ("client: pxar: include payload offset in entry listing") introduced the payload offset output for pxar entries in case of split archives for both, single line and multi line formatting helpers with debugging prupose. While the payload offset output is fine for the single line entry formatting (generates the pxar dump output in debugging mode), it should not be included in the multi line entry formatting helper, used to generate the output for the `stat` command of the catalog shell. Fixes: 51e8fa96 ("client: pxar: include payload offset in entry listing") Signed-off-by: Christian Ebner --- pbs-client/src/pxar/tools.rs | 72 +++++++++++------------------------- 1 file changed, 22 insertions(+), 50 deletions(-) diff --git a/pbs-client/src/pxar/tools.rs b/pbs-client/src/pxar/tools.rs index 7a4d75522..b076daf6b 100644 --- a/pbs-client/src/pxar/tools.rs +++ b/pbs-client/src/pxar/tools.rs @@ -187,30 +187,23 @@ pub fn format_multi_line_entry(entry: &Entry) -> String { let meta = entry.metadata(); - let (size, link, type_name, payload_offset) = match entry.kind() { - EntryKind::Version(version) => (format!("{version:?}"), String::new(), "version", None), + let (size, link, type_name) = match entry.kind() { + EntryKind::Version(version) => (format!("{version:?}"), String::new(), "version"), EntryKind::Prelude(prelude) => ( "0".to_string(), format!("raw data: {:?} bytes", prelude.data.len()), "prelude", - None, ), - EntryKind::File { - size, - payload_offset, - .. - } => (format!("{}", *size), String::new(), "file", *payload_offset), + EntryKind::File { size, .. } => (format!("{}", *size), String::new(), "file"), EntryKind::Symlink(link) => ( "0".to_string(), format!(" -> {:?}", link.as_os_str()), "symlink", - None, ), EntryKind::Hardlink(link) => ( "0".to_string(), format!(" -> {:?}", link.as_os_str()), "symlink", - None, ), EntryKind::Device(dev) => ( format!("{},{}", dev.major, dev.minor), @@ -222,12 +215,11 @@ pub fn format_multi_line_entry(entry: &Entry) -> String { } else { "device" }, - None, ), - EntryKind::Socket => ("0".to_string(), String::new(), "socket", None), - EntryKind::Fifo => ("0".to_string(), String::new(), "fifo", None), - EntryKind::Directory => ("0".to_string(), String::new(), "directory", None), - EntryKind::GoodbyeTable => ("0".to_string(), String::new(), "bad entry", None), + EntryKind::Socket => ("0".to_string(), String::new(), "socket"), + EntryKind::Fifo => ("0".to_string(), String::new(), "fifo"), + EntryKind::Directory => ("0".to_string(), String::new(), "directory"), + EntryKind::GoodbyeTable => ("0".to_string(), String::new(), "bad entry"), }; let file_name = match std::str::from_utf8(entry.path().as_os_str().as_bytes()) { @@ -235,41 +227,21 @@ pub fn format_multi_line_entry(entry: &Entry) -> String { Err(_) => std::borrow::Cow::Owned(format!("{:?}", entry.path())), }; - if let Some(offset) = payload_offset { - format!( - " File: {}{}\n \ - Size: {:<13} Type: {}\n\ - Access: ({:o}/{}) Uid: {:<5} Gid: {:<5}\n\ - Modify: {}\n - PayloadOffset: {}\n", - file_name, - link, - size, - type_name, - meta.file_mode(), - mode_string, - meta.stat.uid, - meta.stat.gid, - format_mtime(&meta.stat.mtime), - offset, - ) - } else { - format!( - " File: {}{}\n \ - Size: {:<13} Type: {}\n\ - Access: ({:o}/{}) Uid: {:<5} Gid: {:<5}\n\ - Modify: {}\n", - file_name, - link, - size, - type_name, - meta.file_mode(), - mode_string, - meta.stat.uid, - meta.stat.gid, - format_mtime(&meta.stat.mtime), - ) - } + format!( + " File: {}{}\n \ + Size: {:<13} Type: {}\n\ + Access: ({:o}/{}) Uid: {:<5} Gid: {:<5}\n\ + Modify: {}\n", + file_name, + link, + size, + type_name, + meta.file_mode(), + mode_string, + meta.stat.uid, + meta.stat.gid, + format_mtime(&meta.stat.mtime), + ) } /// Look up the directory entries of the given directory `path` in a pxar archive via it's given -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel