From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id C490D1FF13E for ; Wed, 01 Jul 2026 14:32:34 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B093A213A2; Wed, 01 Jul 2026 14:32:33 +0200 (CEST) Date: Wed, 1 Jul 2026 14:31:59 +0200 From: Stoiko Ivanov To: Daniel Kral Subject: Re: [RFC PATCH guest-common] tunnel: treat reader_stderr as optional parameter in read_tunnel Message-ID: <20260701143159.7f19df30@rosa.proxmox.com> In-Reply-To: <20260630084332.32566-1-d.kral@proxmox.com> References: <20260630084332.32566-1-d.kral@proxmox.com> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1782909115215 X-SPAM-LEVEL: Spam detection results: 0 DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: BAA543EUITCBXC2KK2VRBUKAGEJUQIMB X-Message-ID-Hash: BAA543EUITCBXC2KK2VRBUKAGEJUQIMB X-MailFrom: s.ivanov@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Thanks for the patch (and pointing me to it off-list)! As I ran into an unrelated issue while migrating a container - and got distracted by the spurious error-messages this patch suppresses - I went ahead and gave it a spin - works as advertised. Additionally looked through `git log` in guest-common - and from a quick glance your analysis seems on spot: Tested-by: Stoiko Ivanov Reviewed-by: Stoiko Ivanov On Tue, 30 Jun 2026 10:43:32 +0200 Daniel Kral wrote: > The reader_stderr parameter was introduced for a specific use case for > the users of fork_ssh_tunnel(). The other callers, such as > fork_websocket_tunnel(), do not provide the parameter and the Perl > interpreter will warn about this: > > Use of uninitialized value $reader_stderr in at /usr/share/perl5/PVE/Tunnel.pm line 77. > readline() on unopened filehandle at /usr/share/perl5/PVE/Tunnel.pm line 77. > > Therefore, treat reader_stderr as an optional parameter by not reading > from the handle if it is not provided. > > Fixes: 8c8aa63 ("tunnel: redirect stderr to log function") > Signed-off-by: Daniel Kral > --- > src/PVE/Tunnel.pm | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/src/PVE/Tunnel.pm b/src/PVE/Tunnel.pm > index 148a8e2..68547a5 100644 > --- a/src/PVE/Tunnel.pm > +++ b/src/PVE/Tunnel.pm > @@ -74,8 +74,10 @@ sub read_tunnel { > }; > my $err = $@; > > - while (my $line = <$reader_stderr>) { # $reader_stderr is set up as non-blocking > - $tunnel->{log}->('warn', $line); > + if (defined($reader_stderr)) { > + while (my $line = <$reader_stderr>) { # $reader_stderr is set up as non-blocking > + $tunnel->{log}->('warn', $line); > + } > } > > die "reading from tunnel failed: $err\n" if $err;