The spec says in section 12.3.17 "Reserved commands and variables" (since 2008 for the words, "__" was added in 2012): Except where documented otherwise, all functions and variables that contain any of the following strings (ignoring case) are reserved for package manager use and may not be used or relied upon by ebuilds: * __ (two underscores) at beginning of string * abort * dyn * ebuild * hook * paludis * portage * prep Related discussion in #gentoo-qa: <+willikins> https://bugs.gentoo.org/843680 "[Tracker] Eclasses using reserved function and variable names"; Gentoo Linux, Eclasses; CONF; ulm:qa <+arthurzam> ulm: I don't want to argue, but I think blocking the word "rebuild" from function name, as it contains "ebuild" is surprising. [...] <@ulm> I don't know, should the policy say "ebuild" except if it's in the string "rebuild"? <@ulm> not sure if I'd want to open this can of worms <+arthurzam> I will leave this decision to the people who know it :) <@ulm> https://www.thefreedictionary.com/words-containing-ebuild <@ulm> rebuild would pretty much cover it, I don't think we need to care about "musclebuilding" or "castlebuilder" :) So, the proposal would be to say something like "ebuild (except if part of the string rebuild)". I've checked the portage, pkgcore and paludis git repos, and AFAICS neither of them uses shell functions or variables with "rebuild" in their name.
AFAICS "abort", "dyn", and "prep" only occured at the beginning of Portage's function and variable names, so we could also tighten the spec for these.
Created attachment 778178 [details, diff] pkg-mgr-commands.tex: Tighten the spec for reserved names
(In reply to Ulrich Müller from comment #1) > AFAICS "abort", "dyn", and "prep" only occured at the beginning of Portage's > function and variable names, so we could also tighten the spec for these. I would be in favor of this but not the "rebuild" exception (it's too specific). Could you split the two?
Created attachment 778202 [details, diff] pkg-mgr-commands.tex: Tighten the spec for reserved names
Created attachment 778205 [details, diff] pkg-mgr-commands.tex: Tighten the spec on ebuild as a reserved name
(In reply to Michał Górny from comment #3) > I would be in favor of this but not the "rebuild" exception (it's too > specific). Could you split the two? Sure, see attached patches. I've also changed the wording to "\t{ebuild} (unless immediately preceded by another letter)" which is less specific and not used by Portage.
Yeah, that makes more sense. I'd consider going even further, to the equivalent of "\bebuild\b" but that'd require checking historical Portage uses.
(In reply to Michał Górny from comment #7) > Yeah, that makes more sense. I'd consider going even further, to the > equivalent of "\bebuild\b" but that'd require checking historical Portage > uses. In practice, that won't make much of a difference. IMHO looking only for a prefix is slightly more systematic, because it will also cover the "begin with" case of the preceding list. In other words, names beginning with "ebuild" are not allowed.
I have started the work for implementing a check for this issue in pkgcheck. I have a starting skeleton which works and managed to report all ulm's findings in the various bugs he opened. (I know the spec are currently changing in this bug, so I will just update the implementation when final spec committed). I have another question: I see that this rule applies to function names and variable names. Does it also apply to ebuilds, and also to all variable names? (I just saw that ulm opened for eclass functions only, so just want to recheck).
(In reply to Arthur Zamarin from comment #9) > I have another question: I see that this rule applies to function names and > variable names. Does it also apply to ebuilds, and also to all variable > names? Yes, this also applies to ebuilds.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/pms.git/commit/?id=260e21bf65f67ad424e990306a7a4789b6b2f1de commit 260e21bf65f67ad424e990306a7a4789b6b2f1de Author: Ulrich Müller <ulm@gentoo.org> AuthorDate: 2022-05-11 21:55:40 +0000 Commit: Ulrich Müller <ulm@gentoo.org> CommitDate: 2022-05-14 07:29:57 +0000 pkg-mgr-commands.tex: Tighten the spec for reserved names "abort", "dyn" and "prep" are only reserved at the beginning of a name. This appears to be their only (historical and recent) usage in Portage. "ebuild" is allowed as substring of words like "rebuild", which is somewhat common in names. Bug: https://bugs.gentoo.org/843779 Signed-off-by: Ulrich Müller <ulm@gentoo.org> pkg-mgr-commands.tex | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)