From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id F1AD6158020 for ; Mon, 26 Dec 2022 17:28:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6F60DE0964; Mon, 26 Dec 2022 17:28:08 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 54C17E0963 for ; Mon, 26 Dec 2022 17:28:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5A30B3410D1 for ; Mon, 26 Dec 2022 17:28:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8CF717FA for ; Mon, 26 Dec 2022 17:28:04 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1672075645.7e80f6fc4739ae2c67929d26b47793f90098b5f4.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/ X-VCS-Repository: proj/pkgcore/pkgcore X-VCS-Files: src/pkgcore/ebuild/processor.py X-VCS-Directories: src/pkgcore/ebuild/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 7e80f6fc4739ae2c67929d26b47793f90098b5f4 X-VCS-Branch: master Date: Mon, 26 Dec 2022 17:28:04 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 892ddb97-6741-4e7c-a688-1365742895af X-Archives-Hash: 803f94bf1d9d863c56c226bbb25e66c5 commit: 7e80f6fc4739ae2c67929d26b47793f90098b5f4 Author: Brian Harring gmail com> AuthorDate: Mon Dec 26 04:16:46 2022 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Mon Dec 26 17:27:25 2022 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=7e80f6fc Throw an exception (py side) for any EBD var starting with '_' Closes: https://github.com/pkgcore/pkgcore/pull/333 Signed-off-by: Brian Harring gmail.com> Signed-off-by: Arthur Zamarin gentoo.org> src/pkgcore/ebuild/processor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pkgcore/ebuild/processor.py b/src/pkgcore/ebuild/processor.py index a4eec7afe..a2f02fd45 100644 --- a/src/pkgcore/ebuild/processor.py +++ b/src/pkgcore/ebuild/processor.py @@ -739,8 +739,10 @@ class EbuildProcessor: for key, val in sorted(env_dict.items()): if key in self._readonly_vars: continue - if not key[0].isalpha(): - raise KeyError(f"{key}: bash doesn't allow digits as the first char") + if not key[0].isalpha() and not key.startswith("_"): + raise KeyError( + f"{key}: bash doesn't allow digits or _ as the first char" + ) if not isinstance(val, (str, list, tuple)): raise ValueError( f"_generate_env_str was fed a bad value; key={key}, val={val}"