From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C512E1FF16E for ; Mon, 3 Feb 2025 12:13:55 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 28D272DBBC; Mon, 3 Feb 2025 12:13:54 +0100 (CET) Message-ID: <72c313ca-95d7-4322-a789-89003c1eda6f@proxmox.com> Date: Mon, 3 Feb 2025 12:13:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox VE development discussion , Filip Schauer References: <20241202160324.139854-1-f.schauer@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20241202160324.139854-1-f.schauer@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.047 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] applied: [PATCH common] tools: explain reason for the explicit PerlIO load X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Am 02.12.24 um 17:03 schrieb Filip Schauer: > Explain the reason for the explicit `use PerlIO::scalar;` statement > introduced in c4945bf ("tools: load PerlIO explicitly to avoid odd > failures") > > Signed-off-by: Filip Schauer > --- > src/PVE/Tools.pm | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm > index 0325f53..57eb86c 100644 > --- a/src/PVE/Tools.pm > +++ b/src/PVE/Tools.pm > @@ -290,12 +290,12 @@ sub file_set_contents { > } else { > # Encode wide characters with print before passing them to syswrite > my $unencoded_data = $data; > - # Without this we get some "Can't locate PerlIO.pm in @INC" errors _sometimes_, and the > - # odd thing about it is that they can be "fixed" by calling file_set_contents in the > - # parent methode/code before the method, from another module, is called. > - # Anyway, loading PerlIO here should be fine as the in-memory variable writing is in > - # fact backed by the PerlIO based "scalar" module. This comment can be removed once the > - # odd behavior is really understood. > + # Preload PerlIO::scalar at compile time to prevent runtime loading issues when > + # file_set_contents is called with PVE::LXC::Setup::protected_call. Normally, > + # PerlIO::scalar is loaded implicitly during the execution of > + # `open(my $data_fh, '>', \$data)`. However, this fails if it is executed within a > + # chroot environment where the necessary PerlIO.pm module file is inaccessible. > + # Preloading the module ensures it is available regardless of the execution context. > use PerlIO::scalar; > open(my $data_fh, '>', \$data) or die "failed to open in-memory variable - $!\n"; > print $data_fh $unencoded_data; Nice detective work! Applied, thanks! _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel