Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 695750 - sys-apps/portage: map underscores to hyphens in USE flag names if the package has only the latter
Summary: sys-apps/portage: map underscores to hyphens in USE flag names if the package...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Configuration (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-27 17:58 UTC by Michał Górny
Modified: 2019-09-29 09:40 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-09-27 17:58:49 UTC
So far the only argument against replacing underscores with hyphens in USE flag names was that it requires changes in configuration.  While 'usemove' seems like an interesting concept for long-term solution, it's not suitable for immediate implementation.  Instead, I'd like to propose a cheap hack.

If user-specified flags for a package contain 'foo_bar' but IUSE contains 'foo-bar', Portage could automatically map the former into the latter.  This shouldn't cause any real trouble since there is no valid case for having both flag variants in IUSE.
Comment 1 Zac Medico gentoo-dev 2019-09-27 20:18:25 UTC
This should be doable in the config regenerate method. It can handle mappings for negative settings there as well.

Perhaps it can generate mappings from IUSE simply by replacing all hyphens with underscores. Hopefully this kind of mapping could work to unambiguously map python_targets_python3_7 to python_targets_python3-7, yes? Can you think of any scenarios where this sort of mapping would lead to ambiguity?
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-09-27 20:45:06 UTC
IIUC this would only cause problems if we had colliding IUSE values like 'foo_bar' and 'foo-bar'.  I can't think of a real case for this.
Comment 3 Zac Medico gentoo-dev 2019-09-27 20:53:49 UTC
If we have USE_EXPAND="FOO" and a legitimate USE flag named foo-bar, then mapping foo_bar to foo-bar can cause problems only if foo_bar and foo-bar are both in the set of effective IUSE for the current package.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-09-27 21:10:07 UTC
Exactly.  I don't think this really could happen.
Comment 5 Ulrich Müller gentoo-dev 2019-09-29 09:26:52 UTC
(In reply to Michał Górny from comment #2)
> IIUC this would only cause problems if we had colliding IUSE values like
> 'foo_bar' and 'foo-bar'.  I can't think of a real case for this.

So, currently foo_bar and foo-bar don't collide, but once the hack is in place, they will? Why do we bother with renaming flags, if the end result isn't a clear separation of namespaces?

Can we at least limit this in time, and say that the hack will be removed again after a reasonable time for users to upgrade, say, one year?
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-09-29 09:40:42 UTC
Worksforme.  We could also apply update-like mechanism to update config files while at it.