[pve-devel] applied: [PATCH container] pct: fix edge case for 'pct push' with root uid/gid

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Apr 6 15:23:39 CEST 2021


applied

On Tue, Apr 06, 2021 at 01:56:16PM +0200, Oguz Bektas wrote:
> 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 at 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





More information about the pve-devel mailing list