commit: 7e80f6fc4739ae2c67929d26b47793f90098b5f4 Author: Brian Harring <ferringb <AT> gmail <DOT> com> AuthorDate: Mon Dec 26 04:16:46 2022 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> 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 <ferringb <AT> gmail.com> Signed-off-by: Arthur Zamarin <arthurzam <AT> 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}"
