Summary: | Exceptions for reserved function and variable names | ||
---|---|---|---|
Product: | Gentoo Hosted Projects | Reporter: | Ulrich Müller <ulm> |
Component: | PMS/EAPI | Assignee: | PMS/EAPI <pms> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | arthurzam, mgorny |
Priority: | Normal | Keywords: | PATCH |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | https://projects.gentoo.org/pms/8/pms.html#x1-13700012.3.17 | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=843671 https://bugs.gentoo.org/show_bug.cgi?id=843677 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 843680 | ||
Attachments: |
pkg-mgr-commands.tex: Tighten the spec for reserved names
pkg-mgr-commands.tex: Tighten the spec for reserved names pkg-mgr-commands.tex: Tighten the spec on ebuild as a reserved name |
Description
Ulrich Müller
2022-05-11 11:56:19 UTC
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(-) |