all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [RFC PATCH guest-common] tunnel: treat reader_stderr as optional parameter in read_tunnel
@ 2026-06-30  8:43 Daniel Kral
  2026-07-01 12:31 ` Stoiko Ivanov
  2026-07-03 13:35 ` applied: " Fiona Ebner
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Kral @ 2026-06-30  8:43 UTC (permalink / raw)
  To: pve-devel

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 <HANDLE> 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 <d.kral@proxmox.com>
---
 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;
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH guest-common] tunnel: treat reader_stderr as optional parameter in read_tunnel
  2026-06-30  8:43 [RFC PATCH guest-common] tunnel: treat reader_stderr as optional parameter in read_tunnel Daniel Kral
@ 2026-07-01 12:31 ` Stoiko Ivanov
  2026-07-03 13:35 ` applied: " Fiona Ebner
  1 sibling, 0 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2026-07-01 12:31 UTC (permalink / raw)
  To: Daniel Kral; +Cc: pve-devel

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 <s.ivanov@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>


On Tue, 30 Jun 2026 10:43:32 +0200
Daniel Kral <d.kral@proxmox.com> 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 <HANDLE> 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 <d.kral@proxmox.com>
> ---
>  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;





^ permalink raw reply	[flat|nested] 3+ messages in thread

* applied: [RFC PATCH guest-common] tunnel: treat reader_stderr as optional parameter in read_tunnel
  2026-06-30  8:43 [RFC PATCH guest-common] tunnel: treat reader_stderr as optional parameter in read_tunnel Daniel Kral
  2026-07-01 12:31 ` Stoiko Ivanov
@ 2026-07-03 13:35 ` Fiona Ebner
  1 sibling, 0 replies; 3+ messages in thread
From: Fiona Ebner @ 2026-07-03 13:35 UTC (permalink / raw)
  To: pve-devel, Daniel Kral

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 <HANDLE> at /usr/share/perl5/PVE/Tunnel.pm line 77.
>     readline() on unopened filehandle at /usr/share/perl5/PVE/Tunnel.pm line 77.
> 
> [...]

Applied, thanks!

[1/1] tunnel: treat reader_stderr as optional parameter in read_tunnel
      commit: e10fabc1f26d73767aa984adb329a5a67b6ea57e




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-03 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30  8:43 [RFC PATCH guest-common] tunnel: treat reader_stderr as optional parameter in read_tunnel Daniel Kral
2026-07-01 12:31 ` Stoiko Ivanov
2026-07-03 13:35 ` applied: " Fiona Ebner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal