Remove the embedded sha256 for the libecc version.
To reduce code, go ahead and use the hash implementation from libecc instead
of using a duplicated version in the tree.
alpine: fix the 15 failing tests
Add libarchive-tools (provides bsdtar) to the Alpine image, matching
Debian.
Replace readlink -e with realpath everywhere (busybox does not have
readlink -e and coreutils (which have realpath since 2012) is now
supporting realpath in every supported linux distro by default.
Add a #!/bin/sh shebang to test_subr.sh so musl execvp runs it when
the triggers test invokes it directly.
tests/frontend: store musl fixture as .binin
musl.bin was committed directly instead of as musl.binin like every
other ELF fixture, so it was missing from out-of-tree builds and the
abi:elfparse / create-parsebin tests failed.
pkg_elf: detect Linux from musl ELF interpreter
musl binaries (e.g. on Alpine Linux) do not carry the glibc GNU ABI
tag note, so pkg could not determine the OS from the ELF and aborted
with "Unable to determine ABI, /bin/sh cannot be parsed". The host
uname fallback is unsuitable as it breaks cross-rootdir operation.
Detect Linux from the binary itself by matching the PT_INTERP loader
path: glibc (ld-linux) and musl (ld-musl) loaders identify a Linux
target, unlike FreeBSD (ld-elf) or NetBSD (ld.elf_so). The version
stays 0.0 for musl since no ABI version is embedded.
Add a musl.bin fixture and wire it into the ELF parse and
create-parsebin tests. Make the native test tolerate a missing
GNU ABI tag by defaulting the version to 0.0.
Limit HTTP mirror list input
HTTP mirror lists are parsed before pkg fetches signed repository
metadata. The reader used getline() and appended every URL entry,
allowing a mirror-list source to consume unbounded memory.
Limit the list size, line size, and number of entries. Close the
response instead of draining it when parsing stops early.
This only affects repositories configured with mirror_type: HTTP,
which is not the default FreeBSD repository configuration.
configure: drop redundant function checks, fix sqlite config
Remove function checks for symbols guaranteed by standards or present
on all supported platforms (Linux, macOS, FreeBSD, OpenBSD, NetBSD,
DragonFly):
- memmove: required by C89
visualization
- pread/pwrite: POSIX.1-2001, present on all targets
- utimensat: POSIX.1-2008, present on all targets
- duplicate strchrnul check
Add pkg_closefrom: portable, async-signal-safe fd closing
Replace the compat closefrom() with a platform-specific pkg_closefrom()
that is async-signal-safe where possible:
- Linux: close_range(2), falling back to a /proc/self/fd scan
- illumos/Solaris: /proc/self/fd scan
- BSD: native closefrom(2)
- Other platforms: blind loop up to sysconf(_SC_OPEN_MAX)
Add pkg-specific endian decoders
pkg only uses le32dec/be32dec/le64dec/be64dec, which the BSDs provide
but Linux/macOS do not. Replace the configure HAVE_DECL_* detection and
compat/endian_util.h fallback with pkg"s own static inline decoders in
libpkg/private/endian.h, identical on every platform.