[pve-devel] [PATCH manager 1/2] pvereport: dir2text: ignore special . and .. files

Aaron Lauterer a.lauterer at proxmox.com
Tue Oct 3 13:36:37 CEST 2023


So far this hasn't been an issue as each user of dir2text wanted files
with a specific pattern. But if we want every file in the directory, we
need to skip the special files '.' and '..'.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 PVE/Report.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/PVE/Report.pm b/PVE/Report.pm
index c9109dca..435458b9 100644
--- a/PVE/Report.pm
+++ b/PVE/Report.pm
@@ -13,6 +13,7 @@ my sub dir2text {
     my $text = '';
     PVE::Tools::dir_glob_foreach($target_dir, $regexp, sub {
 	my ($file) = @_;
+	return if $file eq '.' || $file eq '..';
 	$text .=  "\n# cat $target_dir$file\n";
 	$text .= PVE::Tools::file_get_contents($target_dir.$file)."\n";
     });
-- 
2.39.2






More information about the pve-devel mailing list