From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage] file_size_info: handle dangling symlinks
Date: Fri, 2 Oct 2020 13:55:15 +0200 [thread overview]
Message-ID: <20201002115515.3444594-1-f.gruenbichler@proxmox.com> (raw)
and other stat failure modes.
this method returns undef if 'qemu-img info ...' fails to return
information, so callers must handle this already.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
Notes:
https://forum.proxmox.com/threads/local-storage-unable-to-display-content.76741
PVE/Storage/Plugin.pm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index e6cd99c..63f68da 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -783,6 +783,12 @@ sub file_size_info {
my $st = File::stat::stat($filename);
+ if (!defined($st)) {
+ my $extramsg = -l $filename ? ' - dangling symlink?' : '';
+ warn "failed to stat '$filename'$extramsg\n";
+ return undef;
+ }
+
if (S_ISDIR($st->mode)) {
return wantarray ? (0, 'subvol', 0, undef, $st->ctime) : 1;
}
--
2.20.1
next reply other threads:[~2020-10-02 11:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-02 11:55 Fabian Grünbichler [this message]
2020-10-05 10:52 ` [pve-devel] applied: " Thomas Lamprecht
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=20201002115515.3444594-1-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pve-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