From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] client: catalog shell: drop payload offset in `stat` output
Date: Thu, 24 Oct 2024 11:10:09 +0200 [thread overview]
Message-ID: <20241024091009.76949-1-c.ebner@proxmox.com> (raw)
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 <c.ebner@proxmox.com>
---
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
next reply other threads:[~2024-10-24 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 9:10 Christian Ebner [this message]
2024-10-25 12:41 ` [pbs-devel] applied: " Fabian Grünbichler
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=20241024091009.76949-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