Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-16 19:59:57 +03:00
1 parent 818d391022
commit 639362fbf5
40 files changed
+6701 -429

No files matched your search

+134
View File
@@ -0,0 +1,134 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# != 1 ]]; then
echo "usage: $0 SOURCE_ROOT" >&2
exit 2
fi
source_root=$(realpath -e -- "$1")
temporary=$(mktemp -d "${TMPDIR:-/tmp}/echoion-frontend-licenses.XXXXXX")
trap 'rm -rf -- "$temporary"' EXIT
node_modules="$temporary/node_modules"
mkdir -p \
"$node_modules/plain/docs" \
"$node_modules/@scope/example" \
"$node_modules/parent/node_modules/duplicate" \
"$node_modules/second/node_modules/duplicate" \
"$node_modules/no-notice"
printf '%s\n' \
'{"name":"plain","version":"1.2.3","license":"MIT"}' \
>"$node_modules/plain/package.json"
printf '%s\n' 'plain license' >"$node_modules/plain/LICENSE"
printf '%s\n' 'ignored nested file' >"$node_modules/plain/docs/LICENSE"
printf '%s\n' '{"name":"not-a-package-root"}' \
>"$node_modules/plain/docs/package.json"
printf '%s\n' \
'{"name":"@scope/example","version":"2.0.0-beta.1","license":"Apache-2.0"}' \
>"$node_modules/@scope/example/package.json"
printf '%s\n' 'scoped license' >"$node_modules/@scope/example/LICENCE.md"
printf '%s\n' 'scoped notice' >"$node_modules/@scope/example/NOTICE-extra"
for package_root in \
"$node_modules/parent/node_modules/duplicate" \
"$node_modules/second/node_modules/duplicate"; do
printf '%s\n' \
'{"name":"duplicate","version":"3.4.5","licenses":[{"type":"BSD-2-Clause"}]}' \
>"$package_root/package.json"
printf '%s\n' 'duplicate copying' >"$package_root/COPYING.txt"
done
printf '%s\n' \
'{"name":"no-notice","version":"4.0.0","license":"ISC"}' \
>"$node_modules/no-notice/package.json"
output_one="$temporary/output-one"
output_two="$temporary/output-two"
(
umask 077
python3 "$source_root/scripts/collect-frontend-licenses.py" \
--node-modules "$node_modules" \
--output "$output_one"
)
python3 "$source_root/scripts/collect-frontend-licenses.py" \
--node-modules "$node_modules" \
--output "$output_two"
diff -r -- "$output_one" "$output_two"
[[ -f $output_one/plain@1.2.3/LICENSE ]]
[[ ! -e $output_one/plain@1.2.3/docs ]]
[[ -f $output_one/@scope%2Fexample@2.0.0-beta.1/LICENCE.md ]]
[[ -f $output_one/@scope%2Fexample@2.0.0-beta.1/NOTICE-extra ]]
[[ -f $output_one/duplicate@3.4.5/COPYING.txt ]]
[[ -d $output_one/no-notice@4.0.0 ]]
if find "$output_one" -type d ! -perm 0755 -print -quit | grep -q .; then
echo "license collection created a directory with an unstable mode" >&2
exit 1
fi
if find "$output_one" -type f ! -perm 0644 -print -quit | grep -q .; then
echo "license collection created a file with an unstable mode" >&2
exit 1
fi
python3 - "$output_one/THIRD-PARTY-NOTICES.txt" <<'PY'
from pathlib import Path
import sys
contents = Path(sys.argv[1]).read_text(encoding="utf-8")
packages = [
line.removeprefix("Package: ")
for line in contents.splitlines()
if line.startswith("Package: ")
]
assert packages == sorted(packages)
assert packages == [
"@scope/example@2.0.0-beta.1",
"duplicate@3.4.5",
"no-notice@4.0.0",
"plain@1.2.3",
]
assert contents.count("Package: duplicate@3.4.5") == 1
assert "Declared license: BSD-2-Clause" in contents
assert "Notice files: none published at package root" in contents
assert "@scope%2Fexample@2.0.0-beta.1/NOTICE-extra" in contents
PY
mkdir -p "$temporary/malformed/node_modules/bad"
printf '%s\n' '{"name":"bad","version":"1.0.0"}' \
>"$temporary/malformed/node_modules/bad/package.json"
error_file="$temporary/malformed.error"
if python3 "$source_root/scripts/collect-frontend-licenses.py" \
--node-modules "$temporary/malformed/node_modules" \
--output "$temporary/malformed-output" \
>/dev/null 2>"$error_file"; then
echo "package without license metadata unexpectedly passed" >&2
exit 1
fi
grep -Fq 'package has no declared license' "$error_file"
mkdir -p \
"$temporary/conflict/node_modules/first/node_modules/same" \
"$temporary/conflict/node_modules/second/node_modules/same"
for package_root in \
"$temporary/conflict/node_modules/first/node_modules/same" \
"$temporary/conflict/node_modules/second/node_modules/same"; do
printf '%s\n' \
'{"name":"same","version":"1.0.0","license":"MIT"}' \
>"$package_root/package.json"
done
printf '%s\n' first \
>"$temporary/conflict/node_modules/first/node_modules/same/LICENSE"
printf '%s\n' second \
>"$temporary/conflict/node_modules/second/node_modules/same/LICENSE"
if python3 "$source_root/scripts/collect-frontend-licenses.py" \
--node-modules "$temporary/conflict/node_modules" \
--output "$temporary/conflict-output" >/dev/null 2>&1; then
echo "conflicting duplicate package contents unexpectedly passed" >&2
exit 1
fi
echo "frontend npm license collection regressions passed"
+61
View File
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# != 1 ]]; then
echo "usage: $0 SOURCE_ROOT" >&2
exit 2
fi
source_root=$(realpath -e -- "$1")
temporary=$(mktemp -d "${TMPDIR:-/tmp}/echoion-release-archive.XXXXXX")
trap 'rm -rf -- "$temporary"' EXIT
stage="$temporary/stage"
mkdir -p "$stage/bin" "$stage/lib"
install -m 0755 /bin/true "$stage/bin/echoiond"
install -m 0644 /bin/true "$stage/lib/Echoion.ts"
printf '%s\n' '{}' >"$stage/manifest.json"
cat >"$stage/install.sh" <<'INSTALL'
#!/bin/sh
set -eu
payload_root=$(CDPATH= cd -P -- "$(dirname -- "$0")" && pwd -P)
[ "$(stat -c '%a' -- "$payload_root/bin/echoiond")" = 755 ]
[ "$(stat -c '%a' -- "$payload_root/lib/Echoion.ts")" = 644 ]
[ "$1" = --record ]
record=$2
shift 2
printf '%s\n' "$@" >"$record"
INSTALL
printf '%s\n' '#!/bin/sh' 'exit 0' >"$stage/uninstall.sh"
chmod 0755 "$stage/install.sh" "$stage/uninstall.sh"
base=echoion-1.2.3-linux-x86_64
archive_one="$temporary/one.tar.zst"
installer_one="$temporary/one.run"
archive_two="$temporary/two.tar.zst"
installer_two="$temporary/two.run"
bash "$source_root/scripts/package-release-payload.sh" \
"$stage" "$base" 1700000000 "$archive_one" "$installer_one" "$temporary"
bash "$source_root/scripts/package-release-payload.sh" \
"$stage" "$base" 1700000000 "$archive_two" "$installer_two" "$temporary"
cmp "$archive_one" "$archive_two"
cmp "$installer_one" "$installer_two"
mapfile -t members < <(tar --zstd -tf "$archive_one")
((${#members[@]} > 0))
for member in "${members[@]}"; do
[[ $member == "$base" || $member == "$base/"* ]] || {
echo "archive member escaped top-level directory: $member" >&2
exit 1
}
done
printf '%s\n' "${members[@]}" | grep -Fx "$base/bin/echoiond"
record="$temporary/installer-arguments"
(
umask 077
"$installer_one" --record "$record" alpha 'two words'
)
printf '%s\n' alpha 'two words' >"$temporary/expected-arguments"
cmp "$temporary/expected-arguments" "$record"
echo "release archive layout and .run regressions passed"
+207
View File
@@ -0,0 +1,207 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# != 1 ]]; then
echo "usage: $0 SOURCE_ROOT" >&2
exit 2
fi
source_root=$(realpath -e -- "$1")
temporary=$(mktemp -d "${TMPDIR:-/tmp}/echoion-release-packaging.XXXXXX")
trap 'rm -rf -- "$temporary"' EXIT
bundle="$temporary/bundle"
mkdir -p \
"$bundle/bin" \
"$bundle/lib" \
"$bundle/service" \
"$bundle/share/echoion/web"
install -m 0755 /bin/true "$bundle/bin/echoiond"
install -m 0644 /bin/true "$bundle/lib/Echoion.ts"
printf '%s\n' '<!doctype html><title>Echoion</title>' \
>"$bundle/share/echoion/web/index.html"
printf '%s\n' '[Service]' >"$bundle/service/echoion.service.in"
ln -s Echoion.ts "$bundle/lib/Echoion-current.ts"
python3 "$source_root/scripts/generate-release-manifest.py" \
--root "$bundle" --version 1.2.3
cp "$bundle/manifest.json" "$temporary/manifest.first.json"
python3 "$source_root/scripts/generate-release-manifest.py" \
--root "$bundle" --version 1.2.3
cmp "$temporary/manifest.first.json" "$bundle/manifest.json"
unsafe_file_mode="$temporary/unsafe-file-mode"
cp -a "$bundle" "$unsafe_file_mode"
chmod 0666 "$unsafe_file_mode/lib/Echoion.ts"
if python3 "$source_root/scripts/generate-release-manifest.py" \
--root "$unsafe_file_mode" --version 1.2.3 >/dev/null 2>&1; then
echo "world-writable payload file unexpectedly entered manifest" >&2
exit 1
fi
unsafe_directory_mode="$temporary/unsafe-directory-mode"
cp -a "$bundle" "$unsafe_directory_mode"
chmod 0777 "$unsafe_directory_mode/lib"
if python3 "$source_root/scripts/generate-release-manifest.py" \
--root "$unsafe_directory_mode" --version 1.2.3 >/dev/null 2>&1; then
echo "world-writable payload directory unexpectedly entered manifest" >&2
exit 1
fi
python3 - "$bundle/manifest.json" <<'PY'
import json
import sys
with open(sys.argv[1], encoding="utf-8") as stream:
manifest = json.load(stream)
assert manifest["schemaVersion"] == 2
assert manifest["version"] == "1.2.3"
assert manifest["executable"] == "bin/echoiond"
assert manifest["core"] == "lib/Echoion.ts"
paths = [entry["path"] for entry in manifest["files"]]
assert paths == sorted(paths)
assert "share/echoion/web/index.html" in paths
link = next(entry for entry in manifest["files"] if entry["path"].endswith("current.ts"))
assert link == {
"path": "lib/Echoion-current.ts",
"type": "symlink",
"target": "Echoion.ts",
}
for entry in manifest["files"]:
if entry["type"] == "file":
assert set(entry) == {"path", "type", "size", "sha256", "mode"}
assert len(entry["sha256"]) == 64
assert len(entry["mode"]) == 4
PY
printf '%s\n' '#!/bin/sh' 'exit 0' >"$bundle/install.sh"
printf '%s\n' '#!/bin/sh' 'exit 0' >"$bundle/uninstall.sh"
chmod 0755 "$bundle/install.sh" "$bundle/uninstall.sh"
for overlapping_release_root in "$bundle" "$bundle/releases"; do
if bash "$source_root/scripts/stage-release.sh" \
"$overlapping_release_root" 1.2.3 "$bundle" >/dev/null 2>&1; then
echo "overlapping bundle/release roots unexpectedly staged" >&2
exit 1
fi
done
overlap_parent="$temporary/overlap-parent"
mkdir "$overlap_parent"
cp -a "$bundle" "$overlap_parent/bundle"
if bash "$source_root/scripts/stage-release.sh" \
"$overlap_parent" 1.2.3 "$overlap_parent/bundle" >/dev/null 2>&1; then
echo "release root containing bundle root unexpectedly staged" >&2
exit 1
fi
release_root="$temporary/releases"
bash "$source_root/scripts/stage-release.sh" \
"$release_root" 1.2.3 "$bundle"
[[ -x $release_root/1.2.3/bin/echoiond ]]
[[ -L $release_root/1.2.3/lib/Echoion-current.ts ]]
[[ -x $release_root/1.2.3/install.sh ]]
python3 - "$release_root/pending-release.json" <<'PY'
import json
import sys
with open(sys.argv[1], encoding="utf-8") as stream:
manifest = json.load(stream)
assert manifest["executable"] == "1.2.3/bin/echoiond"
assert manifest["core"] == "1.2.3/lib/Echoion.ts"
assert all(entry["path"].startswith("1.2.3/") for entry in manifest["files"])
assert not any(entry["path"].endswith("install.sh") for entry in manifest["files"])
PY
tampered="$temporary/tampered"
cp -a "$bundle" "$tampered"
python3 "$source_root/scripts/generate-release-manifest.py" \
--root "$tampered" --version 1.2.4
printf '%s\n' tampered >>"$tampered/lib/Echoion.ts"
if bash "$source_root/scripts/stage-release.sh" \
"$release_root" 1.2.4 "$tampered" >/dev/null 2>&1; then
echo "tampered payload unexpectedly staged" >&2
exit 1
fi
rogue="$temporary/rogue"
cp -a "$bundle" "$rogue"
python3 "$source_root/scripts/generate-release-manifest.py" \
--root "$rogue" --version 1.2.6
printf '%s\n' rogue >"$rogue/lib/rogue.so"
if bash "$source_root/scripts/stage-release.sh" \
"$release_root" 1.2.6 "$rogue" >/dev/null 2>&1; then
echo "undeclared immutable payload file unexpectedly staged" >&2
exit 1
fi
[[ ! -e $release_root/1.2.6 ]]
outside_entry="$temporary/outside-entry"
cp -a "$bundle" "$outside_entry"
python3 "$source_root/scripts/generate-release-manifest.py" \
--root "$outside_entry" --version 1.2.8
printf '%s\n' outside >"$outside_entry/outside.dat"
python3 - "$outside_entry/manifest.json" "$outside_entry/outside.dat" <<'PY'
import hashlib
import json
from pathlib import Path
import stat
import sys
manifest_path = Path(sys.argv[1])
outside = Path(sys.argv[2])
with manifest_path.open(encoding="utf-8") as stream:
manifest = json.load(stream)
metadata = outside.stat()
manifest["files"].append(
{
"path": "outside.dat",
"type": "file",
"size": metadata.st_size,
"sha256": hashlib.sha256(outside.read_bytes()).hexdigest(),
"mode": f"{stat.S_IMODE(metadata.st_mode):04o}",
}
)
with manifest_path.open("w", encoding="utf-8", newline="\n") as stream:
json.dump(manifest, stream, indent=2)
stream.write("\n")
PY
if bash "$source_root/scripts/stage-release.sh" \
"$release_root" 1.2.8 "$outside_entry" >/dev/null 2>&1; then
echo "manifest entry outside immutable roots unexpectedly staged" >&2
exit 1
fi
[[ ! -e $release_root/1.2.8 ]]
mkdir "$release_root/.stage-1.2.7.lock"
lock_error="$temporary/stage-lock.error"
if bash "$source_root/scripts/stage-release.sh" \
"$release_root" 1.2.7 "$bundle" > /dev/null 2>"$lock_error"; then
echo "concurrent same-version staging unexpectedly acquired the lock" >&2
exit 1
fi
grep -q 'release staging is already active' "$lock_error"
[[ ! -e $release_root/1.2.7 ]]
rmdir "$release_root/.stage-1.2.7.lock"
if find "$release_root" -mindepth 2 -name '.staging-*' | grep -q .; then
echo "staging directory was nested below a published release" >&2
exit 1
fi
unsafe="$temporary/unsafe"
cp -a "$bundle" "$unsafe"
rm "$unsafe/lib/Echoion-current.ts"
ln -s ../bin/echoiond "$unsafe/lib/Echoion-current.ts"
if python3 "$source_root/scripts/generate-release-manifest.py" \
--root "$unsafe" --version 1.2.5 >/dev/null 2>&1; then
echo "unsafe symlink unexpectedly entered manifest" >&2
exit 1
fi
if bash "$source_root/scripts/stage-release.sh" \
"$release_root" '../unsafe' "$bundle" >/dev/null 2>&1; then
echo "unsafe version unexpectedly staged" >&2
exit 1
fi
echo "release manifest and staging regressions passed"
+237
View File
@@ -0,0 +1,237 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# != 1 ]]; then
echo "usage: $0 SOURCE_ROOT" >&2
exit 2
fi
source_root=$(realpath -e -- "$1")
for command_name in cc cmake patchelf readelf python3; do
command -v "$command_name" >/dev/null || {
echo "missing test command: $command_name" >&2
exit 2
}
done
temporary=$(mktemp -d "${TMPDIR:-/tmp}/echoion-runtime-deps.XXXXXX")
trap 'rm -rf -- "$temporary"' EXIT
configured_build="$temporary/configured-build"
mkdir -p "$configured_build"
configured_compiler=$(realpath -e -- "$(command -v c++)")
printf 'CMAKE_CXX_COMPILER:FILEPATH=%s\n' "$configured_compiler" \
>"$configured_build/CMakeCache.txt"
queried_compiler=$(CXX=/bin/false \
"$source_root/scripts/configured-cxx-compiler.sh" "$configured_build")
[[ $queried_compiler == "$configured_compiler" ]] || {
echo "runtime compiler query followed CXX instead of the configured cache" >&2
exit 1
}
preferred_lib="$temporary/preferred-lib"
other_lib="$temporary/other-lib"
bundle="$temporary/bundle"
resolver="$temporary/resolver"
seed_lib="$temporary/seed-lib"
mkdir -p \
"$preferred_lib" \
"$other_lib" \
"$resolver" \
"$seed_lib" \
"$bundle/bin" \
"$bundle/lib" \
"$bundle/service" \
"$bundle/share/echoion/web"
cat >"$temporary/dependency.c" <<'C'
int echoion_dependency(void) { return 42; }
__attribute__((used, section(".echoion_variant")))
static const char echoion_variant[] = ECHOION_VARIANT;
C
cat >"$temporary/core.c" <<'C'
extern int echoion_dependency(void);
extern int echoion_compiler_runtime(void);
int echoion_core(void) {
return echoion_dependency() + echoion_compiler_runtime();
}
C
cat >"$temporary/main.c" <<'C'
int main(void) { return 0; }
C
cat >"$temporary/compiler-runtime.c" <<'C'
int echoion_compiler_runtime(void) { return 7; }
__attribute__((used, section(".echoion_compiler_variant")))
static const char echoion_compiler_variant[] = ECHOION_VARIANT;
C
for variant in preferred other; do
case $variant in
preferred) variant_lib=$preferred_lib ;;
other) variant_lib=$other_lib ;;
esac
cc -fPIC -shared "$temporary/dependency.c" \
'-DECHOION_VARIANT="'"$variant"'-runtime"' \
-Wl,-soname,libechoion-dependency.so.1 \
-o "$variant_lib/libechoion-dependency.so.1.2.3"
ln -s libechoion-dependency.so.1.2.3 \
"$variant_lib/libechoion-dependency.so.1"
ln -s libechoion-dependency.so.1 \
"$variant_lib/libechoion-dependency.so"
done
for variant in seeded resolver; do
case $variant in
seeded)
variant_lib=$seed_lib
variant_version=100
;;
resolver)
variant_lib=$preferred_lib
variant_version=200
;;
esac
cc -fPIC -shared "$temporary/compiler-runtime.c" \
'-DECHOION_VARIANT="'"$variant"'-compiler-runtime"' \
-Wl,-soname,libstdc++.so.6 \
-o "$variant_lib/libstdc++.so.6.0.$variant_version"
ln -s "libstdc++.so.6.0.$variant_version" \
"$variant_lib/libstdc++.so.6"
done
resolver_core="$resolver/Echoion.ts"
cc -fPIC -shared "$temporary/core.c" \
-L"$preferred_lib" -lechoion-dependency \
-Wl,-l:libstdc++.so.6 \
-Wl,-soname,Echoion.ts \
-Wl,-rpath,"$preferred_lib" \
-o "$resolver_core"
install -m 0644 "$resolver_core" "$bundle/lib/Echoion.ts"
patchelf --set-rpath "\$ORIGIN" "$bundle/lib/Echoion.ts"
cc "$temporary/main.c" -o "$bundle/bin/echoiond"
printf '%s\n' '[Service]' >"$bundle/service/echoion.service.in"
printf '%s\n' '<!doctype html><title>Echoion</title>' \
>"$bundle/share/echoion/web/index.html"
cmake \
"-DBUNDLE_ROOT=$bundle" \
"-DBUNDLE_RESOLVER_LIBRARIES=$resolver_core" \
"-DBUNDLE_SEARCH_DIRECTORIES=$other_lib" \
"-DBUNDLE_SEED_FILES=$seed_lib/libstdc++.so.6" \
"-DPATCHELF_EXECUTABLE=$(command -v patchelf)" \
-P "$source_root/cmake/BundleRuntimeDependencies.cmake"
python3 - "$source_root/scripts/validate-release-elf.py" <<'PY'
import importlib.util
from pathlib import Path
import sys
module_path = Path(sys.argv[1])
spec = importlib.util.spec_from_file_location("validate_release_elf", module_path)
assert spec is not None and spec.loader is not None
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
fixture = """
Version needs section '.gnu.version_r' contains 2 entries:
000000: Version: 1 File: libm.so.6 Cnt: 1
0x0010: Name: GLIBC_9.99 Flags: none Version: 4
0x0020: Version: 1 File: libc.so.6 Cnt: 3
0x0030: Name: GLIBC_2.17 Flags: none Version: 3
0x0040: Name: GLIBC_2.36 Flags: none Version: 2
0x0050: Name: GLIBC_ABI_DT_RELR Flags: none Version: 1
"""
assert module.required_glibc_versions(fixture) == {(2, 17), (2, 36), (9, 99)}
assert module.parse_version("2.35") == (2, 35)
assert module.is_system_dependency("libc.so.6")
assert module.is_system_dependency("libm.so.6")
assert not module.is_system_dependency("libc.so.evil")
assert not module.is_system_dependency("libm.so.99")
unknown_abi = """
Version needs section '.gnu.version_r' contains 1 entry:
000000: Version: 1 File: libc.so.6 Cnt: 1
0x0010: Name: GLIBC_ABI_FUTURE Flags: none Version: 1
"""
try:
module.required_glibc_versions(unknown_abi)
except ValueError as error:
assert "unknown GLIBC ABI requirement" in str(error)
else:
raise AssertionError("unknown GLIBC ABI requirement was accepted")
PY
evil_bundle="$temporary/evil-bundle"
evil_build="$temporary/evil-build"
cp -a -- "$bundle" "$evil_bundle"
mkdir "$evil_build"
cat >"$temporary/evil-dependency.c" <<'C'
int echoion_evil_dependency(void) { return 13; }
C
cat >"$temporary/evil-user.c" <<'C'
extern int echoion_evil_dependency(void);
int echoion_evil_user(void) { return echoion_evil_dependency(); }
C
cc -fPIC -shared "$temporary/evil-dependency.c" \
-Wl,-soname,libc.so.evil -o "$evil_build/libc.so.evil"
cc -fPIC -shared "$temporary/evil-user.c" \
-L"$evil_build" -Wl,-l:libc.so.evil -Wl,-rpath,"$evil_build" \
-o "$evil_build/libevil-user.so"
rm "$evil_build/libc.so.evil"
if cmake \
"-DBUNDLE_ROOT=$evil_bundle" \
"-DBUNDLE_RESOLVER_LIBRARIES=$evil_build/libevil-user.so" \
"-DBUNDLE_SEARCH_DIRECTORIES=$other_lib" \
"-DBUNDLE_SEED_FILES=$seed_lib/libstdc++.so.6" \
"-DPATCHELF_EXECUTABLE=$(command -v patchelf)" \
-P "$source_root/cmake/BundleRuntimeDependencies.cmake" \
>/dev/null 2>&1; then
echo "fake glibc-like SONAME was treated as a system dependency" >&2
exit 1
fi
report="$temporary/dependencies.txt"
python3 "$source_root/scripts/validate-release-elf.py" \
--root "$bundle" --max-glibc 2.35 --report "$report"
grep -F $'NEEDED\tlib/Echoion.ts\tlibechoion-dependency.so.1\tbundled' "$report"
grep -F $'NEEDED\tbin/echoiond\tlibc.so.6\tsystem' "$report"
[[ -L $bundle/lib/libechoion-dependency.so.1 ]]
[[ $(readlink "$bundle/lib/libechoion-dependency.so.1") != /* ]]
[[ -f $bundle/lib/libechoion-dependency.so.1.2.3 ]]
readelf -p .echoion_variant \
"$bundle/lib/libechoion-dependency.so.1.2.3" | grep -F preferred-runtime
if readelf -p .echoion_variant \
"$bundle/lib/libechoion-dependency.so.1.2.3" | grep -Fq other-runtime; then
echo "search-directory runtime replaced the exact build resolver runtime" >&2
exit 1
fi
readelf -p .echoion_compiler_variant \
"$bundle/lib/libstdc++.so.6.0.100" | grep -F seeded-compiler-runtime
if find "$bundle/lib" -maxdepth 1 -name 'libstdc++.so.6.0.200' | grep -q .; then
echo "resolver compiler runtime leaked beside the exact seed" >&2
exit 1
fi
if find "$bundle/lib" -maxdepth 1 -name 'libc.so*' | grep -q .; then
echo "glibc was unexpectedly bundled" >&2
exit 1
fi
patchelf --set-rpath /tmp/unsafe-build-path "$bundle/lib/Echoion.ts"
if python3 "$source_root/scripts/validate-release-elf.py" \
--root "$bundle" >/dev/null 2>&1; then
echo "absolute Core RUNPATH unexpectedly passed validation" >&2
exit 1
fi
patchelf --set-rpath "\$ORIGIN" "$bundle/lib/Echoion.ts"
python3 - "$bundle/lib/Echoion.ts" <<'PY'
import sys
with open(sys.argv[1], "r+b") as stream:
stream.seek(18)
stream.write(b"\xb7\x00") # EM_AARCH64 in a little-endian ELF header.
PY
if python3 "$source_root/scripts/validate-release-elf.py" \
--root "$bundle" >/dev/null 2>&1; then
echo "non-x86-64 Core unexpectedly passed validation" >&2
exit 1
fi
echo "runtime dependency bundling regressions passed"