Image Packaging System package manager
  • Python 87.8%
  • Roff 8.4%
  • C 1.6%
  • Shell 1.2%
  • Mako 0.4%
  • Other 0.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Till Wegmueller 6795125d86 Fix AttributeError in pkgrepo when an FMRI is in two publisher stores
pkg.catalog.Catalog.get_matching_fmris() documents that it returns
'references' as a dict mapping each matching FMRI to the list of
patterns that matched it:

    {
     fmri1: [pat1, pat2, ...],
     ...
    }

It actually mapped each FMRI to a single bare pattern string, because
the dict comprehension building it used (f, p) rather than accumulating
per FMRI.

pkg.server.repository.Repository.get_matching_fmris() aggregates the
results of every repository store and merges them with dest[k].extend(v),
relying on the documented contract.  As soon as the same FMRI is returned
by two stores, that merge fails:

  # pkgrepo -s /path/to/repo remove consolidation/userland/userland-incorporation
  Traceback (most recent call last):
    ...
    File ".../pkg/server/repository.py", line 3598, in get_matching_fmris
      merge(mrefs, references)
    File ".../pkg/server/repository.py", line 3578, in merge
      dest[k].extend(v)
  AttributeError: 'str' object has no attribute 'extend'

This is reachable on any repository where a publisher's catalog holds
entries belonging to another publisher -- for instance after a rebuild
has indexed manifests that ended up below the wrong publisher directory,
since rebuild takes the publisher from the manifest's own pkg.fmri and
not from the directory name.  Once in that state, pkgrepo remove cannot
be used on the repository at all unless -p is given to restrict the
operation to a single store.

Building references as documented also fixes a second, silent defect:
when one FMRI was matched by several patterns, all but the last were
discarded.

The only consumer that read these values as strings is pull.py, which is
updated to flatten them.  pkgrepo(1) discards the references returned by
remove, and pkgsurf/sign never use them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-24 12:30:25 +02:00
doc Add System/Wayland 2026-06-23 20:04:36 +02:00
exception_lists 39287830 Heap buffer size mismatch in SAT solver vecp_dup 2026-08-24 12:18:36 +02:00
src Fix AttributeError in pkgrepo when an FMRI is in two publisher stores 2026-08-24 12:30:25 +02:00
.gitignore Switch to python 3.9 2022-07-23 15:22:33 -05:00
LICENSE-CDDL 25872713 need LICENSE-* files for IPS github repository 2019-08-08 08:37:10 +03:00
LICENSE-CPIO 25872713 need LICENSE-* files for IPS github repository 2019-08-08 08:37:10 +03:00
LICENSE-MINISAT 25872713 need LICENSE-* files for IPS github repository 2019-08-08 08:37:10 +03:00