Skip to content

Fix duplicated packages with categories from env lock file#4340

Open
Hind-M wants to merge 6 commits into
mamba-org:mainfrom
Hind-M:fix_category
Open

Fix duplicated packages with categories from env lock file#4340
Hind-M wants to merge 6 commits into
mamba-org:mainfrom
Hind-M:fix_category

Conversation

@Hind-M

@Hind-M Hind-M commented Jun 26, 2026

Copy link
Copy Markdown
Member

Description

Fix #4333

Type of Change

  • Bugfix
  • Feature / enhancement
  • CI / Documentation
  • Maintenance

Checklist

  • My code follows the general style and conventions of the codebase, ensuring consistency
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run pre-commit run --all locally in the source folder and confirmed that there are no linter errors.
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes

@github-actions github-actions Bot added the release::bug_fixes For PRs fixing bugs label Jun 26, 2026
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.08%. Comparing base (b9ceb44) to head (1aa038a).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4340      +/-   ##
==========================================
+ Coverage   55.07%   55.08%   +0.01%     
==========================================
  Files         240      240              
  Lines       30302    30331      +29     
  Branches     3237     3241       +4     
==========================================
+ Hits        16688    16709      +21     
- Misses      13611    13619       +8     
  Partials        3        3              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Hind-M Hind-M marked this pull request as ready for review June 29, 2026 14:44
const Context& ctx,
solver::libsolv::Database& database,
std::vector<specs::PackageInfo> packages,
std::unordered_set<specs::PackageInfo> packages,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider using flat_set ? (reminder: it's like unordered_set except implemented as a vector).
It seems it would be more appropriate as we have loops going through it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To follow up on the comment, I think it would also need implementing some missing parts like operator< for PackageInfo as flat_set is sorted.

std::back_insert_iterator(m_solution.actions),
[](specs::PackageInfo&& pkg) { return solver::Solution::Install{ std::move(pkg) }; }
);
for (auto it = packages.begin(); it != packages.end();)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the change, what this loop is doing that's different from the original?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think unordered_set iterators are constant and cannot be used to instantiate std::move_iterator.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes exactly. And it seems flat_set would have the same issue as iterators are const and it doesn't have an extract equivalent.

Comment thread libmamba/src/core/transaction.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release::bug_fixes For PRs fixing bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lack of deduplication with multiple --category options can cause environment creation to fail

3 participants