There are some operations that depend on filesystem permissions and are
run under trace mode; for example, at the end of the install section,
MacPorts attempts to call git rev-parse on the port's path, and in order
to prevent git from refusing to work on a directory not owned by the
user it is running as, drops privileges to whoever owns the copy of the
ports tree.
When running under trace mode, this means the git process will run as
a user that might not normally be able to connect to the trace socket,
which leads to the traced git process calling abort() in the inserted
darwintrace.dylib library. This isn't really necessary, since it's
perfectly fine for this process to connect to the tracing socket, too
— we just need to make sure the permissions of the socket on the
filesystem allow for that. Add a chmod() to change permissions to 0o777
to support this.
This fixes crashes during the install phase when port trees aren't owned
by root or the macports user.
In particular, I've seen this failure mode when building the openjdk11
port in trace mode. I don't know why this happens, and it feels like
a bug in macOS that I can successfully posix_spawn a process, get its
pid, waitpid on that pid, and then be told that my process does not have
children, but as long as the re-signing works (which it seems to),
I don't care.
Fix trace mode on arm64 by stripping the CPU subtype that enables
pointer authentication in the Mach-O headers of Apple's binaries.
Closes: https://trac.macports.org/ticket/66358
When we modify the copying algorithm for the trace mode SIP workaround,
re-copy the files if the mtime didn't change since they were initially
copied, but their ctime is older than that of the Pextlib.dylib (or
darwintrace.dylib) that contains the copying code.
This allows us to modify the copying algorithm, which will then cause
all previously copied files to be considered outdated.
Add a test-specific tclsh wrapper (`tests/test-tclsh`) that extends the
vendor tclsh wrapper with all `src/` package directories on `TCLLIBPATH`,
allowing the test suite to find in-tree packages without anything
installed at the configured prefix.
Switch all test Makefiles from `$(TCLSH)` to `$(TEST_TCLSH)` so unit and
integration tests use the in-tree interpreter. Replace all references
to `${bindir}/port` and `${bindir}/portindex` with direct invocations of
the in-tree `src/port/port.tcl` and `src/port/portindex.tcl` via the test
tclsh wrapper.
Add `init_tmp_prefix` to all test files that call `mportinit`, creating a
throwaway prefix with `macports.conf`, `sources.conf`, and `share/macports`
data populated from the source tree rather than the installed prefix.
Set `extra_env TCLLIBPATH` in test `macports.conf` files so that
`mportinit`'s environment scrub does not strip `TCLLIBPATH`, which threads
need to resolve packages.
Reorder CI workflows to run `make test` before `make install`, since the
test suite no longer requires an installed prefix.
See: https://trac.macports.org/ticket/56016
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Strip inherited darwintrace DYLD and DARWINTRACE environment variables
from the shared non-trace test helpers before invoking portindex and
most port commands, and replace a couple of shell/env helper calls with
Tcl-native setup.
Also clean up the negative darwintrace environment tests so they do not
leave injected DYLD state behind for later tests.
This is an attempted fix for the macOS 15 CI failures where the
site-tags test aborts while portindex is running.
Bundle the BLAKE3 1.8.4 C implementation (CC0/Apache-2.0 licensed) in
pextlib and wire it up as a new checksum type alongside md5, sha1,
rmd160, and sha256.
Architecture-specific SIMD acceleration is selected at configure time:
x86-64 gets SSE2/SSE41/AVX2/AVX512 assembly with runtime dispatch,
arm64 gets NEON intrinsics, and all other architectures (including
i386 and ppc for OS X 10.5 compatibility) use the portable C fallback.
Includes tests, and fixes some bad tests around checksum validation.
See: https://trac.macports.org/ticket/63885