| Commit message (Expand) | Author | Age | Files | Lines |
| * | ebuild.sh: inherit: strip any path components•••In the absence of the sandbox, provided eclass/ exists in a repository,
one could do something like `inherit ../../gentoo/eclass/toolchain-funcs`
which we don't want to allow.
Having this value definitely be relative is also helpful for some
other possible followups.
Signed-off-by: Sam James <sam@gentoo.org>
HEADmaster |  Sam James | 3 days | 1 | -2/+2 |
| * | ebuild.sh: add 2 missing `local`•••Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 3 days | 1 | -0/+2 |
| * | ebuild.sh: allow reading ourselves in die()•••This shows up after 4d45902380c30ab1f79ee4136f2bacd747cba84f for a
global-scope sandbox violation when we call die, as we lack permission
to read ourselves.
Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 3 days | 1 | -1/+1 |
| * | isolated-functions.sh: Don't call sed in die()•••Use pure Bash to extract the failing code snippet.
Restoration of PATH and unsetting of QA_INTERCEPTORS should no longer
be needed, since the function doesn't invoke any external commands.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
|  Ulrich Müller | 5 days | 1 | -38/+14 |
| * | NEWS: update for portage-3.0.81.2•••Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 5 days | 1 | -10/+37 |
| * | phase-functions.sh: guard build-info ebuild copy against missing EBUILD•••For binary merges, Binpkg.__init__ sets EBUILD to
${PORTAGE_BUILDDIR}/build-info/${PF}.ebuild before the clean phase runs;
unpack_metadata() extracts the binpkg (and the ebuild) only afterwards.
The build-info creation block in the outer src-phase case creates the
directory and then tries to cp "${EBUILD}" into it, but the source does
not exist yet, producing:
cp: cannot stat '.../build-info/eselect-pinentry-0.7.5.ebuild': No such file or directory
Guard the cp with [[ -e ${EBUILD} ]]. Source builds are unaffected since
EBUILD points into the portage tree and always exists; binary merges
skip the cp and rely on unpack_metadata() to populate build-info/ as
before.
Bug: https://bugs.gentoo.org/978890
Fixes: 126553a76 ("EbuildExecuter: skip no-op src phases for sourceless packages")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 7 days | 1 | -2/+4 |
| * | EbuildPhase: set up FILESDIR symlink before install when unpack was skipped•••When _can_skip_source_phases() skips the unpack phase,
_prepare_fake_filesdir is never called, so the files/ symlink at
${PORTAGE_BUILDDIR}/files pointing to ${O}/files is never created.
src_install then fails if it references ${FILESDIR} (e.g. via newins or
DOCS).
Call _prepare_fake_filesdir at the start of the install phase when the
symlink does not already exist. The "skip if already set up by unpack
phase" guard avoids redundant work on normal builds.
Bug: https://bugs.gentoo.org/978890
Fixes: 126553a76 ("EbuildExecuter: skip no-op src phases for sourceless packages")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 7 days | 1 | -0/+6 |
| * | EbuildMetadataPhase: port to <py3.12's NamedTemporaryFile•••delete_on_close was added in Python 3.12.
Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 8 days | 1 | -1/+4 |
| * | ebuild: always exit non-zero for sandbox violations in 'depend' phase•••This is needed sometimes (though not always, it depends on at which stage
the violations happen) now we have sandbox in the 'depend' phase.
Don't try to soldier on because it may not be safe to do so. It would
also lead to *very* verbose errors.
Bug: https://bugs.gentoo.org/978846
Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 8 days | 5 | -0/+34 |
| * | ebuild: set SANDBOX_LOG to a non-T value for the depend phase•••Bug: https://bugs.gentoo.org/543774
Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 8 days | 2 | -5/+13 |
| * | isolated-functions.sh: avoid basename(1) in __dump_trace•••It's unnecessary when we can use parameter expansion but also shows up
when we apply the sandbox in more cases.
There's a TODO in the function already to make it pure bash but
not fixed the sed use here.
Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 8 days | 1 | -2/+3 |
| * | Clean up .src_patches marker file•••Fixes: 126553a76 ("EbuildExecuter: skip no-op src phases for sourceless packages")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 8 days | 1 | -1/+2 |
| * | Run black•••Fixes: cbe382c8d ("ebuild: ignore RESTRICT=network-sandbox for depend phase")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 8 days | 1 | -4/+5 |
| * | isolated-functions.sh: Don't have die() call sed in the depend phase•••Commit 4671dba39 made the depend phase run under the sandbox,
therefore external commands cannot be executed. The printout of the
failed line doesn't add much useful info anyway, in the rare cases
when die is called in global scope.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
|  Ulrich Müller | 8 days | 1 | -26/+29 |
| * | ebuild: ignore RESTRICT=network-sandbox for depend phase•••Even if the ebuild has RESTRICT=network-sandbox, we should ignore that
for the depend phase. It's too dangerous and there shouldn't be any
justification for that.
Bug: https://bugs.gentoo.org/978846
Fixes: d56707b9d3451810562fc1e763d4916ab02dd54e
Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 9 days | 1 | -1/+1 |
| * | Revert "pid-sandbox: whitelist "depend" phase"•••This reverts commit e2eb3c8252c2ad154e84cc8803974103e9635eee.
egencache isn't the primary metadata generation tool people use these
days (usually `pmaint regen` from pkgcore, or `pk repo metadata` from
pkgcraft), so it's no(t| longer) good justification for leaving `depend`
un-pid-sandbox'd.
Bug: https://bugs.gentoo.org/978846
Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 9 days | 1 | -1/+1 |
| * | ebuild.sh: run depend phase under sandbox•••It's been this way since the start, it seems, but there's no need for
it to be unsandboxed. Since 40da7ee19c4c195da35083bf2d2fcbd852ad3846, Portage
already forbids cases that rely on PATH lookups, but didn't prevent absolute
paths to commands. Fix that by using sandbox with no paths allowed except
to read the ebuild, eclasses, and to write to /dev/null and sandbox.log.
Some inconvenience arises from the fact that die() wants to call
sed which results in an ugly error, but I don't think that's a blocker
for changing this given that of course only happens when we found a problem.
Bug: https://bugs.gentoo.org/543774
Bug: https://bugs.gentoo.org/734650
Bug: https://bugs.gentoo.org/978846
Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 9 days | 1 | -1/+34 |
| * | EbuildExecuter: fix _can_skip_source_phases() checking SRC_URI instead of A•••pkg._metadata["SRC_URI"] is not populated in the emerge build context,
so the check always returned "" (falsy), causing _can_skip_source_phases()
to skip unpack for any package with DEFINED_PHASES not containing a
skippable phase -- even packages with real source to unpack.
Use settings.configdict["pkg"]["A"] instead: it holds the USE-resolved,
variable-expanded list of files to fetch, matching what EbuildPhase uses
for the same purpose, and is populated before pkg_setup exits.
Bug: https://bugs.gentoo.org/978737
Bug: https://bugs.gentoo.org/978808
Fixes: 126553a76 ("EbuildExecuter: skip no-op src phases for sourceless packages")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 10 days | 1 | -2/+4 |
| * | NEWS: update•••Signed-off-by: Sam James <sam@gentoo.org>
|  Sam James | 10 days | 1 | -10/+19 |
| * | util: remove the defunct pickle_read() function•••The pickle_read() function has no remaining callers in the tree. Its
sibling, the pickle_write() function, was gutted long ago, leaving
behind a None stub annotated as "broken and removed, but can still be
imported". A generic helper whose purpose is to load any pickle with an
unrestricted instance of the Unpickler class is not worth keeping on
the off-chance that an external consumer imports it; any such consumer
is better served by an ImportError than by this.
Remove the pickle_read() function, the pickle_write stub, and both names
from the lazy-import registrations in portage/__init__.py.
See-also: d24e3bf5e266ec819e25a732610b3b62db4c1701
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|  Kerin Millar | 10 days | 2 | -28/+1 |
| * | PreservedLibsRegistry: drop the pickle read fallback•••The preserved-libs registry has been written as JSON since March 2012.
A pickle read fallback remains, but it is useful only for registries
that have not been rewritten by emerge in fourteen years.
Unlike the mtimedb cache file, a registry written in the pickle format
cannot be deserialised by the recently introduced NoGlobalsUnpickler
class, because it contains global references to the builtins.set class.
Remove the fallback path. The pickle write branch and the conversion of
preserved-path sets to lists are now dead code, so remove those as well.
Bug: https://bugs.gentoo.org/19147
See-also: 4c8d1060304a4e793c5d813a1d925e7cf1fcccbd
See-also: 716b1864e03212b09f94ddf3573fbfa451473558
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|  Kerin Millar | 10 days | 2 | -32/+12 |
| * | mtimedb: drop the pickle read fallback•••The mtimedb cache file has been written as JSON since March 2012. A
pickle read fallback remains, but it is useful only for cache files that
have not been rewritten by emerge in fourteen years.
Further, that fallback uses an unrestricted instance of the Unpickler
class, allowing a crafted cache file to induce code execution during
deserialisation.
Remove the fallback path. The _json_write class attribute is defined as
True and nothing ever sets it otherwise, rendering the pickle write
branch unreachable. Remove that branch too, along with the imports of
pickle and io.
Bug: https://bugs.gentoo.org/19147
See-also: 460c42425f530a930b0d04886358fda92cced11e
See-also: 848da97a64b2d3d13c3fbc794c57dae714009854
See-also: 7c4c48d9a4344a6f1c9859ae178ed78408ba2777
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|  Kerin Millar | 10 days | 2 | -20/+6 |
| * | ipc: reject global references in exchanged pickles•••Presently, the ebuild-ipc daemon services requests received over the
FIFO at ${PORTAGE_BUILDDIR}/.ipc/in. It is written to from the ebuild
phase environment, which may be running with reduced privileges or be
confined by the sandbox, while the daemon itself runs in the context of
the emerge process, which commonly enjoys root privileges.
The protocol does not require that an instance of the Unpickler class be
able to import or instantiate arbitrary classes. Despite this, the
daemon deserialises each request with pickle.loads(). A crafted request
can therefore cause code to run in the daemon process, outside the
sandbox that would normally confine the ebuild execution environment,
and with the privileges of the emerge process.
Address this defect by using the recently introduced NoGlobalsUnpickler
class on both sides of the exchange. The existing error handling already
treats UnpicklingError exceptions in the same way as malformed input,
which is the appropriate response to a rejected global reference.
Bug: https://bugs.gentoo.org/978478
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|  Kerin Millar | 10 days | 3 | -2/+10 |
| * | vdb: reject global references in cache pickles•••The vdb cache files loaded by the BlockerCache class and the
vardbapi._aux_cache_init() method do not require that pickle be able to
import or instantiate arbitrary classes. Indeed, both loaders have long
attempted to prevent global references from being resolved by assigning
None to the Unpickler.find_global attribute.
However, this defensive strategy only works with Python 2. As of Python
3, the pickle.Unpickler class rejects any assignment to the find_global
attribute with AttributeError. Currently, Portage catches that
exception, only to ignore it and proceed in accordance with the default
behaviour, rendering the intended restriction wholly ineffective.
Address this defect by introducing and integrating the
portage.util.pickle.NoGlobalsUnpickler class as a subclass of
pickle.Unpickler. It differs by overriding the find_class() method so as
to reject any global reference by raising an UnpicklingError exception.
Bug: https://bugs.gentoo.org/19147
Link: https://docs.python.org/3/library/pickle.html#restricting-globals
See-also: 29950d3be0b14877587dec725eeabbb949e0d616
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|  Kerin Millar | 10 days | 5 | -14/+33 |
| * | dispatch-conf: fix AttributeError in massage() on str from newconfigs•••path_list is decoded to str before splitlines(), so nconf elements are
already str. The .decode() call added in commit 30bbecfbc is wrong; drop
it.
Fixes: 30bbecfbc ("Remove Python 2 unicode compatibility layer")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 11 days | 1 | -3/+1 |
| * | tests: ResolverPlayground: fix TypeError joining Atom objects in failure mess...•••result.atoms contains Atom objects; str.join() requires strings.
Fixes: 7e15fc7fa ("dep: Atom: remove str subtyping")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 11 days | 1 | -2/+2 |
| * | _emerge: fix TypeError joining Atom objects in diagnostic messages•••Same class of bug as fixed in Scheduler._calc_resume_list: Atom objects
must be explicitly converted to str before being passed to str.join().
Fix actions.action_build (dropped_tasks display) and
depgraph._slot_operator_check_reverse_dependencies (debug message).
Fixes: 7e15fc7fa ("dep: Atom: remove str subtyping")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 11 days | 2 | -2/+2 |
| * | _emerge: Scheduler: fix TypeError joining Atom objects in _calc_resume_list•••', '.join(set(atoms))' fails with TypeError when atoms contains Atom
objects rather than strings. Use str() conversion.
Bug: https://bugs.gentoo.org/978486
Fixes: 7e15fc7fa ("dep: Atom: remove str subtyping")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 11 days | 1 | -1/+1 |
| * | checksum: test multi-hash, parallel, and verify_all paths•••The single-pass and thread-per-hash checksum paths, plus verify_all and
perform_all, had no direct test coverage; only single-hash
perform_checksum and _apply_hash_filter were exercised.
Add known-answer tests for perform_multiple_checksums (single hash,
multiple hashes, the size pseudo-hash, unknown-hash rejection) and
perform_all. Cover the parallel path with a file over the threshold and
assert it agrees with the serial single-pass path. Add verify_all tests
for the pass, checksum-mismatch, size-mismatch, insufficient-data,
strict, and missing-file cases.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 11 days | 1 | -2/+137 |
| * | checksum: verify all hashes in one pass•••verify_all called perform_checksum once per hash, re-reading the file for
each. Compute them together with perform_multiple_checksums so the file
is read once (and hashed in parallel for large files).
Behavior change: verification no longer short-circuits at the first hash
type. All hashes are computed before comparing, rather than stopping the
moment one fails. The reported failure reason is unchanged (the first
mismatch in sorted order); on a mismatch this does slightly more work,
which is negligible against the common all-pass case and is the point of
the single-pass read.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 11 days | 1 | -14/+13 |
| * | checksum: hash large files with a thread per hash•••hashlib releases the GIL during update(), so independent hashes can run
on separate cores. When more than one hash is wanted and the file is at
least 1 MiB, stream it once and feed each hash its own worker thread; a
bounded per-hash queue applies backpressure so a slow consumer cannot
buffer the whole file. Smaller files and single-hash requests keep the
serial single-pass path, where thread overhead is not worth it.
Measured ~1.86x on a 300 MiB file with the default BLAKE2B+SHA512 digest
(770 ms -> 414 ms). Hot on every fetch/verify, Manifest regen, and
binpkg index hashing.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 11 days | 1 | -1/+52 |
| * | checksum: read a file once for multiple hashes•••perform_multiple_checksums called perform_checksum once per hash, so an
N-hash digest opened and streamed the file N times. perform_all did the
same across every supported hash.
Read the file once and update every requested hash per block via a new
_checksum_file_serial helper, driven by _perform_checksums. Route
perform_multiple_checksums and perform_all through it. The size pseudo-
hash is taken from a single stat. Output is unchanged for all callers.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 11 days | 1 | -5/+31 |
| * | checksum: factor OSError mapping into a helper•••Extract the OSError-to-portage-exception mapping from perform_checksum
into a _raise_checksum_oserror helper so the single-pass and parallel
checksum paths added next can share the same error semantics.
No functional change.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 11 days | 1 | -5/+9 |
| * | EbuildExecuter: skip no-op src phases for sourceless packages•••A package with no source (empty SRC_URI) that defines none of its own
src_* phases runs only no-op default bodies for unpack/prepare/configure/
compile/test. EbuildExecuter forked an ebuild.sh subprocess for each,
re-sourcing ${T}/environment every time -- a lot of unnecessary work for
empty/virtual packages.
Add _can_skip_source_phases(): when SRC_URI is empty and none of those
phases are defined, skip straight from pkg_setup to src_install (which
creates ${D} and runs install QA). Disabled for FEATURES=noauto and
PROPERTIES=live.
The default src_prepare applies ${PATCHES}, so skipping it would drop any
patches. PATCHES is not in cache metadata, so pkg_setup (which has already
run and sourced the ebuild) records whether it is set via a .src_patches
marker, and the skip is disabled when it is. eapply_user is also skipped;
PMS permits a package manager to implement it as a no-op, so ignoring
/etc/portage/patches for a fileless package is allowed.
src_install is not skipped for two reasons: it creates ${D} and drives the
install-time QA checks, so it always needs to run; and the default
src_install body respects declarative variables such as DOCS, which can
reference FILESDIR (present even for sourceless packages) and therefore
may do real work. By always running src_install, both concerns are avoided
without needing any additional checks.
Merging empty virtuals (warm 1851-pkg vdb, --jobs 1): phase spawns
14 -> 9, wall ~7.2s -> ~6.0s.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 12 days | 2 | -4/+67 |
| * | phase-functions.sh: create build-info before the first src phase•••Move build-info/ creation from the configure|compile sub-case up to the
outer src-phase case so it exists before whichever src phase runs first.
This lets a later change skip the no-op unpack/prepare/configure/compile/
test phases for sourceless packages and still reach src_install. Normal
builds just create it slightly earlier (unpack vs configure); no behavior
change.
Guard on PORTAGE_BUILDDIR existing: the clean phase can run before
prepare_build_dirs() and __dyn_clean tolerates a missing builddir, so an
unguarded cd would fail and leave a stray build-info/ in the cwd.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 12 days | 1 | -6/+14 |
| * | getbinpkg: accelerate package index parsing with plain dicts•••Package index entries have used slot-dict classes since 2008 in order to
save memory. That tradeoff no longer works well for the short-lived
entries created while parsing large binhost indexes. Modern dicts are
smaller than they were when this code was written, while the cost of
emulating the mapping protocol in Python remains high. When readBody()
tests an entry for truth to detect the end of the input, the operation
probes all 34 allowed keys, and the subsequent application of default
and inherited values adds another 20 or so attribute lookups per entry,
with most of them raising AttributeError.
Instead, use ordinary dicts for package entries, while preserving the
allowed-key filter by checking parsed keys against a frozenset. Further,
intern the parsed key names, because split() creates fresh strings for
each input line and a plain dict would otherwise retain a separate copy
for every entry.
Given a binhost index comprising 19,629 entries, parse time falls from
about 4.0 to 1.1 seconds on the Xeon E5-2450 system I use for testing.
The tracemalloc module shows memory usage rising from 39.9 to 49.5 MiB,
an increase of about 0.5 KiB per entry.
This improvement should be keenly felt because emerge prints nothing
whatsoever before the first index has been parsed.
Link: https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-compactdict
Link: https://docs.python.org/3/library/sys.html#sys.intern
See-also: 04066d484cf68bda8de37c037aad003a44088e8a
See-also: 9a58611323e313a7a5d48fa65a316a3ffedc3954
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|  Kerin Millar | 12 days | 3 | -8/+13 |
| * | install-qa-check.d/60pkgconfig: relax prefix match for libdir check•••Otherwise ${exec_prefix}/lib can pass undetected.
Bug: https://bugs.gentoo.org/978404
Signed-off-by: Alfred Wingate <parona@protonmail.com>
Part-of: https://github.com/gentoo/portage/pull/1618
Closes: https://github.com/gentoo/portage/pull/1618
Signed-off-by: Sam James <sam@gentoo.org>
|  Alfred Wingate | 12 days | 1 | -1/+1 |
| * | vartree: skip preserve-libs linkmap rebuild for fileless packages•••With FEATURES=preserve-libs, every merge and unmerge runs
_linkmap_rebuild(), a full-system scan of every installed package's
NEEDED.ELF.2. A package that owns no files (empty/virtual packages) has no
libraries of its own to preserve and removes no files, so it cannot drop
the last consumer of an already-preserved library and leave that library
orphaned; the rebuild and the preserve/prune scans it feeds are guaranteed
no-ops.
Gate them on self.getcontents() being non-empty at the two per-package
sites that run on every merge: the treewalk merge-side rebuild (which
only feeds _find_libs_to_preserve() on the replaced instance) and
_prune_plib_registry(). unregister()/store() still run so empty registry
entries are cleaned up. This also skips the rebuild for fresh installs
and when preserve-libs is disabled, where its result was already unused.
The post-merge _prune_plib_registry() call site is separately gated by
98d0362 (if contents:), which additionally avoids taking the registry
lock; this change is complementary, covering the merge-side rebuild and
the unmerge path that gate does not touch.
Re-merging an empty virtual (--emptytree --nodeps virtual/acl) on a warm
1854-package vdb, counting NEEDED.ELF.2 opens via strace: 1857 -> 3. The
full-system scan of every installed package is gone; only the merged
package's own (absent) NEEDED.ELF.2 is probed.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 12 days | 1 | -22/+51 |
| * | Remove prelink support•••The sys-devel/prelink package was treecleaned from the Gentoo repository
in 2022 (9e73effa5191, bug #579388), so none of portage's prelink code
can run any more: PRELINK_BINARY never exists, so prelink_capable is
always False and the FEATURES=prelink-checksums path, the calc_prelink
checksum reversal, and the env-update prelink.conf generation are all
dead.
Drop it all: the prelink machinery and calc_prelink parameters in
checksum.py and their vartree callers, the prelink.conf generation in
env_update, the prelink-checksums FEATURE and PRELINK_BINARY/
PRELINK_PATH/PRELINK_PATH_MASK constants, and the make.conf
documentation.
Closes: https://bugs.gentoo.org/833909
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 12 days | 6 | -168/+28 |
| * | porttree: remove redundant pkgsplit import•••Signed-off-by: Zac Medico <zmedico@gentoo.org>
|  Zac Medico | 13 days | 1 | -1/+1 |
| * | porttree: hoist pkgsplit import out of findname2•••findname2 is on the resolver hot path (called once per candidate cpv,
tens of thousands of times per @world resolve) and did 'from
portage.versions import pkgsplit' on every call. The import is cheap not
free at that call volume. Import pkgsplit at module scope instead; there
is no circular-import risk (portage.versions does not import porttree).
Also drop the now-redundant in-function import in the deprecated
getname().
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 13 days | 1 | -4/+1 |
| * | configparser: remove readfp fallback for Python <3.2•••ConfigParser.read_file() exists since Python 3.2 and
ConfigParser.readfp() was removed in Python 3.12. Use read_file() and
the "source" kwarg directly.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 13 days | 1 | -17/+2 |
| * | mtimedb: remove Python 2 Unpickler.find_global compat•••find_global is a Python 2 attribute on Unpickler. Setting it to None was
a Python 2 safety measure to restrict unpickling. In Python 3 it does
not exist, so the assignment always raised AttributeError and the except
clause ran pass on every call. Remove the dead try/except.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 13 days | 1 | -5/+0 |
| * | socks5-server: remove asyncio compat for Python <3.7•••asyncio.ensure_future exists since Python 3.4.4 and asyncio.current_task
since Python 3.7. Both are unconditionally available on Python >=3.9.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 13 days | 1 | -15/+2 |
| * | remove array.tostring() fallbacks, use tobytes() directly•••array.tostring() was removed in Python 3.9. array.tobytes() has been
available since Python 3.2.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 13 days | 4 | -20/+4 |
| * | process: remove Python <3.4 compat guards for set_inheritable and FD_CLOEXEC•••os.set_inheritable and fcntl.FD_CLOEXEC are unconditionally available
since Python 3.4. Since portage requires Python >=3.9, the try/except
guards and None-checks are dead code.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
|  Matt Turner | 13 days | 1 | -43/+25 |
| * | output: jettison the set_term_size() function•••As of the referenced commit, the set_term_size() function is no longer
used. Nor did a review of the packages in the app-portage category
reveal any that make use of it. Jettison the function.
See-also: 131fb0a0455a87b2460d3924952897550133be17
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|  Kerin Millar | 13 days | 4 | -40/+5 |
| * | estrip: prevent setfattr(1) from following symlinks•••As of attr v2.6.0, the setfattr(1) utility warns if the --restore option
is specified without the options that prevent the unsafe handling of
symbolic links. Without -P, symbolic links in the directory components
of restored pathnames may be traversed. Without -h, the final pathname
component may be dereferenced if it is a symbolic link. In either case,
attributes may be restored to a different file than was intended.
Address this issue by specifying the -h option, and by specifying the -P
option where it is found to be supported. It should be noted that I have
made no attempt to correct the behaviour of the xattr-helper.py script,
which remains defective in several respects.
Link: https://www.openwall.com/lists/oss-security/2026/06/29/1
Bug: https://bugs.gentoo.org/978288
Bug: https://bugs.gentoo.org/978280
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|  Kerin Millar | 13 days | 2 | -3/+16 |
| * | isolated-functions.sh: drop the RC_DOT_PATTERN variable•••Normally, the ebegin() function composes a message comprising the
positional parameters, having been joined in accordance with the state
of the 'IFS' variable, followed by a <space> and three <period>
characters (so as to resemble an ellipsis). However, if the
'RC_DOT_PATTERN' variable is defined as a non-empty string, the function
will instead partially right-pad the composed message with its contents.
$ stty size
24 79
$ ebegin "Got to be starting something" # 35 chars printed
* Got to be starting something ...
$ RC_DOT_PATTERN=_
$ ebegin "Got to be starting something" # 72 chars printed
* Got to be starting something_________________________________________
OpenRC does not implement this feature. Nor does gentoo-functions,
though it used to define the 'RC_DOT_PATTERN' variable (despite making
no use of it). I can find no evidence that the feature is being used and
am hard-pressed to believe that anyone would miss it. Get rid of it.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|  Kerin Millar | 13 days | 2 | -12/+3 |
| * | isolated-functions.sh: drop the RC_INDENTATION variable•••Owing to the fact that the value of the 'RC_INDENTATION' variable is
never changed from its default value of 0, it has no effect in portage.
The gentoo-functions library implements an equivalent variable, named
'genfun_indent', which is manipulated by the eindent() and eoutdent()
functions. However, the "isolated-functions.sh" unit implements neither
of these functions. Jettison the 'RC_INDENTATION' variable.
See-also: eb1a32ed5698621dd41ebb88bfc88f5ed39cc38c
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|  Kerin Millar | 13 days | 2 | -6/+4 |