* [pve-devel] [PATCH-SERIES common/manager/qemu-server 0/4] fix #2077: remove dependency on Term::ReadLine
@ 2025-09-18 13:50 Fiona Ebner
2025-09-18 13:50 ` [pve-devel] [PATCH common 1/4] pty: introduce read_line() function Fiona Ebner
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Fiona Ebner @ 2025-09-18 13:50 UTC (permalink / raw)
To: pve-devel
As a side-effect, this also fixes #6748.
Term::ReadLine would prompt and read from terminal even if
stdin/stdout are redirected, the new helper will use the redirected
channels. It also would underline the prompt, which the new helper
does not. And Term::ReadLine also has advanced editing and history
shortcuts.
For the prompts in pve-manager, not having the advanced features is
perfectly fine. For qm monitor, (advanced) users might be unhappy with
the change.
Other packages need a dependency bump for pve-common.
common:
Fiona Ebner (1):
developer readme: remove libterm-readline-gnu-perl dependency
Stefan Hrdlicka (1):
pty: introduce read_line() function
README.dev | 2 +-
src/PVE/PTY.pm | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
manager:
Fiona Ebner (1):
partially fix #2077: remove dependency on Term::ReadLine
PVE/CLI/pvenode.pm | 19 +++++++------------
debian/control | 1 -
2 files changed, 7 insertions(+), 13 deletions(-)
qemu-server:
Fiona Ebner (1):
partially fix #2077: remove dependency on Term::ReadLine
debian/control | 1 -
src/PVE/CLI/qm.pm | 6 ++----
2 files changed, 2 insertions(+), 5 deletions(-)
Summary over all repositories:
6 files changed, 27 insertions(+), 19 deletions(-)
--
Generated by git-murpp 0.5.0
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] [PATCH common 1/4] pty: introduce read_line() function
2025-09-18 13:50 [pve-devel] [PATCH-SERIES common/manager/qemu-server 0/4] fix #2077: remove dependency on Term::ReadLine Fiona Ebner
@ 2025-09-18 13:50 ` Fiona Ebner
2025-09-22 9:45 ` Stoiko Ivanov
2025-09-22 18:28 ` [pve-devel] applied: " Thomas Lamprecht
2025-09-18 13:50 ` [pve-devel] [RFC common 2/4] developer readme: remove libterm-readline-gnu-perl dependency Fiona Ebner
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Fiona Ebner @ 2025-09-18 13:50 UTC (permalink / raw)
To: pve-devel
From: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
Originally-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
[FE: avoid changes to read_password()
rename from read_input() to read_line()
avoid undef warning if there is no input by avoiding chomp then
print prompt even if not reading from interactive for better log]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/PTY.pm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/PVE/PTY.pm b/src/PVE/PTY.pm
index 5d7d697..1db4863 100644
--- a/src/PVE/PTY.pm
+++ b/src/PVE/PTY.pm
@@ -163,6 +163,23 @@ sub tcsetsize($$$) {
or die "failed to set window size: $!\n";
}
+sub read_line($;$$) {
+ my ($query, $infd, $outfd) = @_;
+
+ $infd //= \*STDIN;
+ $outfd //= \*STDOUT;
+
+ my $msg = -t $infd ? $query : "$query\n";
+ print $outfd $msg;
+
+ my $input = '';
+ local $/ = "\n";
+ $input = <$infd>;
+ chomp $input if $input;
+
+ return $input;
+}
+
sub read_password($;$$) {
my ($query, $infd, $outfd) = @_;
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] [RFC common 2/4] developer readme: remove libterm-readline-gnu-perl dependency
2025-09-18 13:50 [pve-devel] [PATCH-SERIES common/manager/qemu-server 0/4] fix #2077: remove dependency on Term::ReadLine Fiona Ebner
2025-09-18 13:50 ` [pve-devel] [PATCH common 1/4] pty: introduce read_line() function Fiona Ebner
@ 2025-09-18 13:50 ` Fiona Ebner
2025-09-18 14:12 ` Fiona Ebner
2025-09-18 13:50 ` [pve-devel] [PATCH manager 3/4] partially fix #2077: remove dependency on Term::ReadLine Fiona Ebner
2025-09-18 13:50 ` [pve-devel] [RFC qemu-server 4/4] " Fiona Ebner
3 siblings, 1 reply; 8+ messages in thread
From: Fiona Ebner @ 2025-09-18 13:50 UTC (permalink / raw)
To: pve-devel
Previous users are switched over to PVE::PTY::read_input().
Originally-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
[FE: split out from larger patch]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Should not be applied if we don't go ahead with the change for qm
monitor.
README.dev | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.dev b/README.dev
index c5468f8..0ffba53 100644
--- a/README.dev
+++ b/README.dev
@@ -62,7 +62,7 @@ libstring-shellquote-perl dh-systemd rpm2cpio libsqlite3-dev sqlite3 \
libglib2.0-dev librrd-dev librrds-perl rrdcached libdigest-hmac-perl \
libxml-parser-perl gdb libcrypt-openssl-random-perl \
libcrypt-openssl-rsa-perl libnet-ldap-perl libauthen-pam-perl \
-libjson-xs-perl libterm-readline-gnu-perl oathtool libmime-base32-perl \
+libjson-xs-perl oathtool libmime-base32-perl \
liboath0 libpci-dev texi2html libsdl1.2-dev libgnutls28-dev \
libspice-protocol-dev xfslibs-dev libnuma-dev libaio-dev \
pve-libspice-server-dev libusbredirparser-dev glusterfs-common \
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] [PATCH manager 3/4] partially fix #2077: remove dependency on Term::ReadLine
2025-09-18 13:50 [pve-devel] [PATCH-SERIES common/manager/qemu-server 0/4] fix #2077: remove dependency on Term::ReadLine Fiona Ebner
2025-09-18 13:50 ` [pve-devel] [PATCH common 1/4] pty: introduce read_line() function Fiona Ebner
2025-09-18 13:50 ` [pve-devel] [RFC common 2/4] developer readme: remove libterm-readline-gnu-perl dependency Fiona Ebner
@ 2025-09-18 13:50 ` Fiona Ebner
2025-09-18 13:50 ` [pve-devel] [RFC qemu-server 4/4] " Fiona Ebner
3 siblings, 0 replies; 8+ messages in thread
From: Fiona Ebner @ 2025-09-18 13:50 UTC (permalink / raw)
To: pve-devel
As a side-effect, this also fixes #6748.
Originally-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
[FE: rebase and adapt to rename]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Dependency bump for pve-common needed.
PVE/CLI/pvenode.pm | 19 +++++++------------
debian/control | 1 -
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/PVE/CLI/pvenode.pm b/PVE/CLI/pvenode.pm
index 76b05887..7f717642 100644
--- a/PVE/CLI/pvenode.pm
+++ b/PVE/CLI/pvenode.pm
@@ -21,8 +21,7 @@ use PVE::RPCEnvironment;
use PVE::CLIFormatter;
use PVE::RESTHandler;
use PVE::CLIHandler;
-
-use Term::ReadLine;
+use PVE::PTY;
use base qw(PVE::CLIHandler);
@@ -108,13 +107,12 @@ __PACKAGE__->register_method({
}
print $i, ") Custom\n";
- my $term = Term::ReadLine->new('pvenode');
my $get_dir_selection = sub {
- my $selection = $term->readline("Enter selection: ");
+ my $selection = PVE::PTY::read_line("Enter selection: ");
if ($selection =~ /^(\d+)$/) {
$selection = $1;
if ($selection == $i) {
- $param->{directory} = $term->readline("Enter custom URL: ");
+ $param->{directory} = PVE::PTY::read_line("Enter custom URL: ");
$custom_directory = 1;
return;
} elsif ($selection < $i && $selection >= 0) {
@@ -137,8 +135,7 @@ __PACKAGE__->register_method({
if ($meta->{termsOfService}) {
my $tos = $meta->{termsOfService};
print "Terms of Service: $tos\n";
- my $term = Term::ReadLine->new('pvenode');
- my $agreed = $term->readline('Do you agree to the above terms? [y|N]: ');
+ my $agreed = PVE::PTY::read_line('Do you agree to the above terms? [y|N]: ');
die "Cannot continue without agreeing to ToS, aborting.\n"
if ($agreed !~ /^y$/i);
@@ -149,18 +146,16 @@ __PACKAGE__->register_method({
my $eab_enabled = $meta->{externalAccountRequired};
if (!$eab_enabled && $custom_directory) {
- my $term = Term::ReadLine->new('pvenode');
my $agreed =
- $term->readline('Do you want to use external account binding? [y|N]: ');
+ PVE::PTY::read_line('Do you want to use external account binding? [y|N]: ');
$eab_enabled = ($agreed =~ /^y$/i);
} elsif ($eab_enabled) {
print "The CA requires external account binding.\n";
}
if ($eab_enabled) {
print "You should have received a key id and a key from your CA.\n";
- my $term = Term::ReadLine->new('pvenode');
- my $eab_kid = $term->readline('Enter EAB key id: ');
- my $eab_hmac_key = $term->readline('Enter EAB key: ');
+ my $eab_kid = PVE::PTY::read_line('Enter EAB key id: ');
+ my $eab_hmac_key = PVE::PTY::read_line('Enter EAB key: ');
$param->{'eab-kid'} = $eab_kid;
$param->{'eab-hmac-key'} = $eab_hmac_key;
diff --git a/debian/control b/debian/control
index 64b942ce..4d589beb 100644
--- a/debian/control
+++ b/debian/control
@@ -70,7 +70,6 @@ Depends: apt (>= 1.5~),
libpve-storage-perl (>= 9.0.5),
librados2-perl (>= 1.3-1),
libtemplate-perl,
- libterm-readline-gnu-perl,
liburi-perl,
libuuid-perl,
libwww-perl (>= 6.04-1),
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] [RFC qemu-server 4/4] partially fix #2077: remove dependency on Term::ReadLine
2025-09-18 13:50 [pve-devel] [PATCH-SERIES common/manager/qemu-server 0/4] fix #2077: remove dependency on Term::ReadLine Fiona Ebner
` (2 preceding siblings ...)
2025-09-18 13:50 ` [pve-devel] [PATCH manager 3/4] partially fix #2077: remove dependency on Term::ReadLine Fiona Ebner
@ 2025-09-18 13:50 ` Fiona Ebner
3 siblings, 0 replies; 8+ messages in thread
From: Fiona Ebner @ 2025-09-18 13:50 UTC (permalink / raw)
To: pve-devel
Originally-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
[FE: rebase and adapt to rename]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Dependency bump for pve-common needed.
Advanced users might be unhappy with not having the editing and
history shortcuts Term::ReadLine provides anymore.
debian/control | 1 -
src/PVE/CLI/qm.pm | 6 ++----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/debian/control b/debian/control
index f02ef742..7af87a05 100644
--- a/debian/control
+++ b/debian/control
@@ -46,7 +46,6 @@ Depends: conntrack,
libpve-common-perl (>= 9.0.3),
libpve-guest-common-perl (>= 5.2.2),
libpve-storage-perl (>= 9.0.7),
- libterm-readline-gnu-perl,
liburi-perl,
libuuid-perl,
perl (>= 5.10.0-19),
diff --git a/src/PVE/CLI/qm.pm b/src/PVE/CLI/qm.pm
index 2e56e234..8ee5033a 100755
--- a/src/PVE/CLI/qm.pm
+++ b/src/PVE/CLI/qm.pm
@@ -12,7 +12,6 @@ use IO::Select;
use IO::Socket::UNIX;
use JSON;
use POSIX qw(strftime);
-use Term::ReadLine;
use URI::Escape;
use PVE::APIClient::LWP;
@@ -23,6 +22,7 @@ use PVE::GuestImport::OVF;
use PVE::INotify;
use PVE::JSONSchema qw(get_standard_option);
use PVE::Network;
+use PVE::PTY;
use PVE::RPCEnvironment;
use PVE::SafeSyslog;
use PVE::Tools qw(extract_param file_get_contents);
@@ -551,9 +551,7 @@ __PACKAGE__->register_method({
print "Entering QEMU Monitor for VM $vmid - type 'help' for help\n";
- my $term = Term::ReadLine->new('qm');
-
- while (defined(my $input = $term->readline('qm> '))) {
+ while (defined(my $input = PVE::PTY::read_line('qm> '))) {
chomp $input;
next if $input =~ m/^\s*$/;
last if $input =~ m/^\s*q(uit)?\s*$/;
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [pve-devel] [RFC common 2/4] developer readme: remove libterm-readline-gnu-perl dependency
2025-09-18 13:50 ` [pve-devel] [RFC common 2/4] developer readme: remove libterm-readline-gnu-perl dependency Fiona Ebner
@ 2025-09-18 14:12 ` Fiona Ebner
0 siblings, 0 replies; 8+ messages in thread
From: Fiona Ebner @ 2025-09-18 14:12 UTC (permalink / raw)
To: pve-devel
Am 18.09.25 um 3:52 PM schrieb Fiona Ebner:
> Previous users are switched over to PVE::PTY::read_input().
>
> Originally-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
> [FE: split out from larger patch]
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>
> Should not be applied if we don't go ahead with the change for qm
> monitor.
Or if we don't go ahead with pmgsh which also uses advanced features
from Term::ReadLine (will send patches for pmg shortly).
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [pve-devel] [PATCH common 1/4] pty: introduce read_line() function
2025-09-18 13:50 ` [pve-devel] [PATCH common 1/4] pty: introduce read_line() function Fiona Ebner
@ 2025-09-22 9:45 ` Stoiko Ivanov
2025-09-22 18:28 ` [pve-devel] applied: " Thomas Lamprecht
1 sibling, 0 replies; 8+ messages in thread
From: Stoiko Ivanov @ 2025-09-22 9:45 UTC (permalink / raw)
To: Fiona Ebner; +Cc: Proxmox VE development discussion
tested this patch with the patches for PMG from:
https://lore.proxmox.com/pmg-devel/20250918142052.131956-1-f.ebner@proxmox.com/T/#t
worked for me when creating an acme account with custom ACME provider, and
when joining a cluster.
Consider this:
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
On Thu, 18 Sep 2025 15:50:53 +0200
Fiona Ebner <f.ebner@proxmox.com> wrote:
> From: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
>
> Originally-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
> [FE: avoid changes to read_password()
> rename from read_input() to read_line()
> avoid undef warning if there is no input by avoiding chomp then
> print prompt even if not reading from interactive for better log]
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> src/PVE/PTY.pm | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/src/PVE/PTY.pm b/src/PVE/PTY.pm
> index 5d7d697..1db4863 100644
> --- a/src/PVE/PTY.pm
> +++ b/src/PVE/PTY.pm
> @@ -163,6 +163,23 @@ sub tcsetsize($$$) {
> or die "failed to set window size: $!\n";
> }
>
> +sub read_line($;$$) {
> + my ($query, $infd, $outfd) = @_;
> +
> + $infd //= \*STDIN;
> + $outfd //= \*STDOUT;
> +
> + my $msg = -t $infd ? $query : "$query\n";
> + print $outfd $msg;
> +
> + my $input = '';
> + local $/ = "\n";
> + $input = <$infd>;
> + chomp $input if $input;
> +
> + return $input;
> +}
> +
> sub read_password($;$$) {
> my ($query, $infd, $outfd) = @_;
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] applied: [PATCH common 1/4] pty: introduce read_line() function
2025-09-18 13:50 ` [pve-devel] [PATCH common 1/4] pty: introduce read_line() function Fiona Ebner
2025-09-22 9:45 ` Stoiko Ivanov
@ 2025-09-22 18:28 ` Thomas Lamprecht
1 sibling, 0 replies; 8+ messages in thread
From: Thomas Lamprecht @ 2025-09-22 18:28 UTC (permalink / raw)
To: pve-devel, Fiona Ebner
On Thu, 18 Sep 2025 15:50:53 +0200, Fiona Ebner wrote:
> [FE: avoid changes to read_password()
> rename from read_input() to read_line()
> avoid undef warning if there is no input by avoiding chomp then
> print prompt even if not reading from interactive for better log]
>
>
Applied this one already, thanks!
[1/4] pty: introduce read_line() function
commit: 87037597f2068d113d33d3b087f26f5b3f28ee99
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-09-22 18:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-18 13:50 [pve-devel] [PATCH-SERIES common/manager/qemu-server 0/4] fix #2077: remove dependency on Term::ReadLine Fiona Ebner
2025-09-18 13:50 ` [pve-devel] [PATCH common 1/4] pty: introduce read_line() function Fiona Ebner
2025-09-22 9:45 ` Stoiko Ivanov
2025-09-22 18:28 ` [pve-devel] applied: " Thomas Lamprecht
2025-09-18 13:50 ` [pve-devel] [RFC common 2/4] developer readme: remove libterm-readline-gnu-perl dependency Fiona Ebner
2025-09-18 14:12 ` Fiona Ebner
2025-09-18 13:50 ` [pve-devel] [PATCH manager 3/4] partially fix #2077: remove dependency on Term::ReadLine Fiona Ebner
2025-09-18 13:50 ` [pve-devel] [RFC qemu-server 4/4] " Fiona Ebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox