[pve-devel] [PATCH storage v3 03/13] export: redirect stdout to avoid any unrelated messages ending up in the export stream
Fiona Ebner
f.ebner at proxmox.com
Thu Dec 19 11:43:06 CET 2024
Current export implementations luckily seems to not run into this
issue yet. However, for the upcoming implementation for RBD, mapping a
volume would print the device path to STDOUT, thus messing up the
export stream.
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
src/PVE/CLI/pvesm.pm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/PVE/CLI/pvesm.pm b/src/PVE/CLI/pvesm.pm
index 9b9676b..d308b3d 100755
--- a/src/PVE/CLI/pvesm.pm
+++ b/src/PVE/CLI/pvesm.pm
@@ -315,7 +315,10 @@ __PACKAGE__->register_method ({
my $outfh;
if ($filename eq '-') {
- $outfh = \*STDOUT;
+ # No other messages must go to STDOUT if it's used for the export stream!
+ open($outfh, '>&', STDOUT) or die "unable to dup() STDOUT - $!\n";
+ close(STDOUT);
+ open(STDOUT, '>', '/dev/null');
} else {
sysopen($outfh, $filename, O_CREAT|O_WRONLY|O_TRUNC)
or die "open($filename): $!\n";
--
2.39.5
More information about the pve-devel
mailing list