From: Oguz Bektas <o.bektas@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container] pct: fix edge case for 'pct push' with root uid/gid
Date: Tue, 6 Apr 2021 13:56:16 +0200 [thread overview]
Message-ID: <20210406115616.421007-1-o.bektas@proxmox.com> (raw)
we should check if the variable is defined in the end (because root
uid:gid is 0:0, this causes perl to get confused and die, eventhough the
uid:gid was obtained correctly)
reported here:
https://forum.proxmox.com/threads/pct-push-fails-to-get-uid-gid.87065/
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
src/PVE/CLI/pct.pm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 69faf8d..6b63915 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -422,14 +422,16 @@ sub create_file {
if ($user =~ /^\d+$/) {
$uid = int($user);
} else {
- $uid = getpwnam($user) or die "failed to get uid for: $user\n"
+ $uid = getpwnam($user);
+ die "failed to get uid for: $user\n" if !defined($uid);
}
}
if (defined($group)) {
if ($group =~ /^\d+$/) {
$gid = int($group);
} else {
- $gid = getgrnam($group) or die "failed to get gid for: $group\n"
+ $gid = getgrnam($group);
+ die "failed to get gid for: $group\n" if !defined($gid);
}
}
--
2.20.1
next reply other threads:[~2021-04-06 11:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 11:56 Oguz Bektas [this message]
2021-04-06 13:23 ` [pve-devel] applied: " Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210406115616.421007-1-o.bektas@proxmox.com \
--to=o.bektas@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox