public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/3] restore daemon: log some errors for dir traversal
Date: Wed, 15 May 2024 11:55:12 +0200	[thread overview]
Message-ID: <20240515095513.1061658-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20240515095513.1061658-1-d.csapak@proxmox.com>

in case we cannot stat a file in the restore vm, log the path and reason
why. This should normally not happen, but when it does, the path and
error might help us find the issue.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 .../src/proxmox_restore_daemon/api.rs               | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
index c20552225..cb7b53e11 100644
--- a/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
+++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
@@ -182,12 +182,17 @@ fn list(
                         let mut full_path = PathBuf::new();
                         full_path.push(param_path_buf);
                         full_path.push(path);
-                        let entry = get_dir_entry(&full_vm_path);
-                        if let Ok(entry) = entry {
-                            res.push(ArchiveEntry::new(
+                        match get_dir_entry(&full_vm_path) {
+                            Ok(entry) => res.push(ArchiveEntry::new(
                                 full_path.as_os_str().as_bytes(),
                                 Some(&entry),
-                            ));
+                            )),
+                            Err(err) => {
+                                eprintln!(
+                                    "error getting entry: {:?} : {err}",
+                                    full_path.as_os_str()
+                                );
+                            }
                         }
                     }
                 }
-- 
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-05-15  9:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-15  9:55 [pbs-devel] [PATCH proxmox-backup 1/3] fix #5465: restore daemon: mount ntfs with utf8 charset Dominik Csapak
2024-05-15  9:55 ` Dominik Csapak [this message]
2024-05-15  9:55 ` [pbs-devel] [PATCH proxmox-backup 3/3] restore daemon: search disk also with truncated serial Dominik Csapak
2024-05-16 10:04   ` Fabian Grünbichler
2024-05-16  9:51 ` [pbs-devel] applied-series: [PATCH proxmox-backup 1/3] fix #5465: restore daemon: mount ntfs with utf8 charset 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=20240515095513.1061658-2-d.csapak@proxmox.com \
    --to=d.csapak@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