public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH common 0/3] upid: fix calls to decode
@ 2025-10-01  9:36 Fiona Ebner
  2025-10-01  9:36 ` [pve-devel] [PATCH common 1/3] upid: order imports alphabetically Fiona Ebner
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Fiona Ebner @ 2025-10-01  9:36 UTC (permalink / raw)
  To: pve-devel

The decode function has a signature and always requires two arguments.
Otherwise, there will be errors like:
> Too few arguments for subroutine 'PVE::UPID::decode'
> (got 1; expected 2) at /usr/share/perl5/PVE/UPID.pm line 60.

pve-common:

Fiona Ebner (3):
  upid: order imports alphabetically
  upid: add missing imports
  upid: fix calls to decode function

 src/PVE/ProcFSTools.pm     | 2 +-
 src/PVE/RESTEnvironment.pm | 4 ++--
 src/PVE/UPID.pm            | 8 +++++---
 3 files changed, 8 insertions(+), 6 deletions(-)


Summary over all repositories:
  3 files changed, 8 insertions(+), 6 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] 7+ messages in thread

* [pve-devel] [PATCH common 1/3] upid: order imports alphabetically
  2025-10-01  9:36 [pve-devel] [PATCH common 0/3] upid: fix calls to decode Fiona Ebner
@ 2025-10-01  9:36 ` Fiona Ebner
  2025-10-01 10:32   ` [pve-devel] applied: " Thomas Lamprecht
  2025-10-01  9:36 ` [pve-devel] [PATCH common 2/3] upid: add missing imports Fiona Ebner
  2025-10-01  9:36 ` [pve-devel] [PATCH common 3/3] upid: fix calls to decode function Fiona Ebner
  2 siblings, 1 reply; 7+ messages in thread
From: Fiona Ebner @ 2025-10-01  9:36 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/UPID.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/UPID.pm b/src/PVE/UPID.pm
index a4fca03..e80f441 100644
--- a/src/PVE/UPID.pm
+++ b/src/PVE/UPID.pm
@@ -2,8 +2,8 @@ package PVE::UPID;
 
 use v5.36;
 
-use IO::File;
 use File::Path qw(make_path);
+use IO::File;
 
 # UPID means 'Unique Process ID' amd uniquely identifies a process in a cluster of nodes.
 #
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] [PATCH common 2/3] upid: add missing imports
  2025-10-01  9:36 [pve-devel] [PATCH common 0/3] upid: fix calls to decode Fiona Ebner
  2025-10-01  9:36 ` [pve-devel] [PATCH common 1/3] upid: order imports alphabetically Fiona Ebner
@ 2025-10-01  9:36 ` Fiona Ebner
  2025-10-01  9:36 ` [pve-devel] [PATCH common 3/3] upid: fix calls to decode function Fiona Ebner
  2 siblings, 0 replies; 7+ messages in thread
From: Fiona Ebner @ 2025-10-01  9:36 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/UPID.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/UPID.pm b/src/PVE/UPID.pm
index e80f441..1256ec3 100644
--- a/src/PVE/UPID.pm
+++ b/src/PVE/UPID.pm
@@ -2,6 +2,8 @@ package PVE::UPID;
 
 use v5.36;
 
+use Fcntl qw(O_CREAT O_EXCL O_WRONLY);
+use File::Basename qw(dirname);
 use File::Path qw(make_path);
 use IO::File;
 
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] [PATCH common 3/3] upid: fix calls to decode function
  2025-10-01  9:36 [pve-devel] [PATCH common 0/3] upid: fix calls to decode Fiona Ebner
  2025-10-01  9:36 ` [pve-devel] [PATCH common 1/3] upid: order imports alphabetically Fiona Ebner
  2025-10-01  9:36 ` [pve-devel] [PATCH common 2/3] upid: add missing imports Fiona Ebner
@ 2025-10-01  9:36 ` Fiona Ebner
  2025-10-01 10:34   ` Thomas Lamprecht
  2 siblings, 1 reply; 7+ messages in thread
From: Fiona Ebner @ 2025-10-01  9:36 UTC (permalink / raw)
  To: pve-devel

The decode function has a signature and always requires two arguments.
Otherwise, there will be errors like:
> Too few arguments for subroutine 'PVE::UPID::decode'
> (got 1; expected 2) at /usr/share/perl5/PVE/UPID.pm line 60.

Fixes: 5600b0b ("create dedicated PVE::UPID module")
Fixes: ea99050 ("switch to using split out PVE::UPID")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/ProcFSTools.pm     | 2 +-
 src/PVE/RESTEnvironment.pm | 4 ++--
 src/PVE/UPID.pm            | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index 51a2e79..a8d66d7 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -525,7 +525,7 @@ sub read_proc_net_ipv6_route {
 sub upid_wait {
     my ($upid, $waitfunc, $sleep_intervall) = @_;
 
-    my $task = PVE::UPID::decode($upid);
+    my $task = PVE::UPID::decode($upid, 0);
 
     $sleep_intervall = $sleep_intervall ? $sleep_intervall : 1;
 
diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm
index 7695850..197cc22 100644
--- a/src/PVE/RESTEnvironment.pm
+++ b/src/PVE/RESTEnvironment.pm
@@ -312,7 +312,7 @@ sub active_workers {
             }
 
             if ($new_upid && !$thash->{$new_upid}) {
-                my $task = PVE::UPID::decode($new_upid);
+                my $task = PVE::UPID::decode($new_upid, 0);
                 $task->{upid} = $new_upid;
                 $thash->{$new_upid} = $task;
                 &$check_task($task, $nocheck);
@@ -406,7 +406,7 @@ my $kill_process_group = sub {
 sub check_worker {
     my ($self, $upid, $killit) = @_;
 
-    my $task = PVE::UPID::decode($upid);
+    my $task = PVE::UPID::decode($upid, 0);
 
     my $running = PVE::ProcFSTools::check_process_running($task->{pid}, $task->{pstart});
 
diff --git a/src/PVE/UPID.pm b/src/PVE/UPID.pm
index 1256ec3..9913531 100644
--- a/src/PVE/UPID.pm
+++ b/src/PVE/UPID.pm
@@ -59,7 +59,7 @@ sub decode($upid, $noerr) {
 }
 
 sub open_log($upid) {
-    my ($task, $filename) = decode($upid);
+    my ($task, $filename) = decode($upid, 0);
 
     my $dirname = dirname($filename);
     make_path($dirname);
@@ -77,7 +77,7 @@ sub open_log($upid) {
 }
 
 sub read_status($upid) {
-    my ($task, $filename) = decode($upid);
+    my ($task, $filename) = decode($upid, 0);
     my $fh = IO::File->new($filename, "r") or return "unable to open file - $!";
 
     my $maxlen = 4096;
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] applied: [PATCH common 1/3] upid: order imports alphabetically
  2025-10-01  9:36 ` [pve-devel] [PATCH common 1/3] upid: order imports alphabetically Fiona Ebner
@ 2025-10-01 10:32   ` Thomas Lamprecht
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Lamprecht @ 2025-10-01 10:32 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

Am 01.10.25 um 11:38 schrieb Fiona Ebner:
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  src/PVE/UPID.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied this and 2/3 squashed into a single commit, for a single
line movement it's not worth the dedicated commit, thanks!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* Re: [pve-devel] [PATCH common 3/3] upid: fix calls to decode function
  2025-10-01  9:36 ` [pve-devel] [PATCH common 3/3] upid: fix calls to decode function Fiona Ebner
@ 2025-10-01 10:34   ` Thomas Lamprecht
  2025-10-01 11:17     ` Fiona Ebner
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Lamprecht @ 2025-10-01 10:34 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

Am 01.10.25 um 11:38 schrieb Fiona Ebner:
> The decode function has a signature and always requires two arguments.
> Otherwise, there will be errors like:
>> Too few arguments for subroutine 'PVE::UPID::decode'
>> (got 1; expected 2) at /usr/share/perl5/PVE/UPID.pm line 60.

I replaced this with just adapting the signature to have a default
value for $noerr defined there, which avoids having to update
call sides; as thanks to use v5.36 we can do

sub decode($upid, $noerr = 0) {
    ...


I also added a basic test harness to finally have some coverage
here.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* Re: [pve-devel] [PATCH common 3/3] upid: fix calls to decode function
  2025-10-01 10:34   ` Thomas Lamprecht
@ 2025-10-01 11:17     ` Fiona Ebner
  0 siblings, 0 replies; 7+ messages in thread
From: Fiona Ebner @ 2025-10-01 11:17 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox VE development discussion

Am 01.10.25 um 12:34 PM schrieb Thomas Lamprecht:
> Am 01.10.25 um 11:38 schrieb Fiona Ebner:
>> The decode function has a signature and always requires two arguments.
>> Otherwise, there will be errors like:
>>> Too few arguments for subroutine 'PVE::UPID::decode'
>>> (got 1; expected 2) at /usr/share/perl5/PVE/UPID.pm line 60.
> 
> I replaced this with just adapting the signature to have a default
> value for $noerr defined there, which avoids having to update
> call sides; as thanks to use v5.36 we can do
> 
> sub decode($upid, $noerr = 0) {
>     ...
> 
> 
> I also added a basic test harness to finally have some coverage
> here.

Oh, good to know that that's possible too :)


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

end of thread, other threads:[~2025-10-01 11:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-01  9:36 [pve-devel] [PATCH common 0/3] upid: fix calls to decode Fiona Ebner
2025-10-01  9:36 ` [pve-devel] [PATCH common 1/3] upid: order imports alphabetically Fiona Ebner
2025-10-01 10:32   ` [pve-devel] applied: " Thomas Lamprecht
2025-10-01  9:36 ` [pve-devel] [PATCH common 2/3] upid: add missing imports Fiona Ebner
2025-10-01  9:36 ` [pve-devel] [PATCH common 3/3] upid: fix calls to decode function Fiona Ebner
2025-10-01 10:34   ` Thomas Lamprecht
2025-10-01 11:17     ` Fiona Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal