From 056e00a5b1b8693ce9b5099b3e8caffc48424224 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sat, 14 Nov 2026 17:33:49 +0800 Subject: [PATCH 1/5] feat(packages): migrate base tools to official Alpine APKs Use signed libbsd, dosfstools and e2fsprogs packages, isolate libbsd development inputs, preserve standard command paths and transfer ownership during upgrades. Ship the real CA bundle in every profile and replace old empty console bundles through a versioned trust dependency. Update licenses, translations and migration checks. Validation: rootfs and installer builds, 25 offline update regressions, QEMU console installation and login, signed CA migration and native ext2/ext4/FAT checks. Full make test remains blocked by the pre-existing settings/reliefsettings duplicate icon check. --- .gitattributes | 2 + Documentation/admin-guide/packages.rst | 8 +- .../en/LC_MESSAGES/admin-guide/packages.po | 9 +- .../ja/LC_MESSAGES/admin-guide/packages.po | 7 +- NOTICE | 23 +- configs/apk-ownership.json | 24 +- configs/auth-upstream.json | 8 - configs/dependencies.lock.json | 169 +++- configs/storage-upstream.json | 16 - resources/licenses/e2fsprogs-NOTICE | 863 ++++++++++++++++++ resources/licenses/libbsd-LICENSE | 558 +++++++++++ scripts/reliefos/Makefile.apk | 6 +- scripts/reliefos/Makefile.apk-dependencies | 16 +- scripts/reliefos/Makefile.rootfs | 2 +- scripts/reliefos/Makefile.upstream | 7 +- tests/build/test-apk-ownership.sh | 4 +- tests/build/test-apk-stage-selection.sh | 9 + tests/build/test-desktop-backend.sh | 14 +- tests/build/test-libbsd-development.sh | 354 +++++++ tests/integration/apk-base-migration.sh | 49 + tests/integration/upstream-incremental.sh | 7 +- tests/integration/upstream-products.sh | 15 +- tools/build/apk-stage.sh | 31 +- tools/build/libbsd-development.sh | 188 ++++ tools/build/rootfs-stage.sh | 23 +- tools/build/upstream.sh | 8 +- tools/storage_tools.py | 21 +- tools/test_installer_accounts_qemu.py | 2 +- tools/test_installer_update_packages.py | 85 +- tools/test_storage_payload.py | 2 +- 30 files changed, 2390 insertions(+), 140 deletions(-) create mode 100644 resources/licenses/e2fsprogs-NOTICE create mode 100644 resources/licenses/libbsd-LICENSE create mode 100755 tests/build/test-libbsd-development.sh create mode 100644 tests/integration/apk-base-migration.sh create mode 100755 tools/build/libbsd-development.sh diff --git a/.gitattributes b/.gitattributes index bf232e57..e144f278 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,4 @@ # Unified-diff context keeps its required leading space before tabs and blank lines. patches/**/*.patch whitespace=-blank-at-eol,-space-before-tab +# Preserve the upstream license notice's indentation and blank-line spacing. +resources/licenses/e2fsprogs-NOTICE whitespace=-blank-at-eol,-space-before-tab diff --git a/Documentation/admin-guide/packages.rst b/Documentation/admin-guide/packages.rst index 61e6e5f6..cbbb30a0 100644 --- a/Documentation/admin-guide/packages.rst +++ b/Documentation/admin-guide/packages.rst @@ -32,10 +32,16 @@ sl、ncurses、zlib、libpng、SQLite、mbedTLS 3 由签名 Alpine APK 提供。 ``apk info --who-owns /usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` 查询。 离线更新器在预检时将旧包装包的 world 请求转换为官方包,保留其他包和配置; 正式事务自动卸载旧包,完成后清除离线缓存中的旧包装包归档。 -新的自有包使用第 4 代版本前缀,保证从第 2、3 代包按正常版本顺序升级。 +新的自有包使用第 5 代版本前缀,保证从第 2、3、4 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 SQLite VFS 或厂商内部符号的外部程序需要重新编译。 +libbsd、dosfstools、e2fsprogs 及其运行库和文档也直接使用锁定的官方 Alpine APK。 +ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口由兼容链接转发。 +本地认证支持包继续提供 libmd,本地文件系统包继续提供 exfatprogs;它们通过真实的 +APK 依赖安装已迁移的官方包,升级事务同时转移旧文件的所有权,不强制覆盖文件。 +shadow 构建使用独立提取的 libbsd 开发文件,不把 Alpine 的 Linux 头文件混入 SDK。 + RPR 本地发布树继续包含完整的签名索引、原始上游 APK 和自有包,构建 ``rpr-pages`` 不等于部署到线上。运行库因新增 ELF NEEDED 而得到真实 APK 依赖,不能只复制新的 ``libreliefos.so.2`` 而遗漏配套库。 diff --git a/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po b/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po index b9fce4a4..e6d0edb9 100644 --- a/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po +++ b/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po @@ -55,7 +55,7 @@ msgid "" "系统直接请求官方命令、终端工具/数据和 SQLite 命令/运行库,不再生成本地包装包。 文件所有权可通过 ``apk info --who-owns " "/usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` 查询。 " "离线更新器在预检时将旧包装包的 world 请求转换为官方包,保留其他包和配置; 正式事务自动卸载旧包,完成后清除离线缓存中的旧包装包归档。 " -"新的自有包使用第 4 代版本前缀,保证从第 2、3 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " +"新的自有包使用第 5 代版本前缀,保证从第 2、3、4 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " "SQLite VFS 或厂商内部符号的外部程序需要重新编译。" msgstr "" "sl, ncurses, zlib, libpng, SQLite, and mbedTLS 3 are supplied by signed " @@ -67,11 +67,14 @@ msgstr "" "to official packages while preserving other packages and configuration. The " "actual transaction automatically removes old packages; afterward it clears " "their wrapper archives from the offline cache. New project-owned packages " -"use a fourth-generation version prefix to upgrade normally from second- and " -"third-generation packages. The old ``sqlite.so.3`` ABI has been removed. " +"use a fifth-generation version prefix to upgrade normally from second-, " +"third-, and fourth-generation packages. The old ``sqlite.so.3`` ABI has been removed. " "External programs depending on the old custom SQLite VFS or vendor-internal " "symbols must be rebuilt." +msgid "libbsd、dosfstools、e2fsprogs 及其运行库和文档也直接使用锁定的官方 Alpine APK。 ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口由兼容链接转发。 本地认证支持包继续提供 libmd,本地文件系统包继续提供 exfatprogs;它们通过真实的 APK 依赖安装已迁移的官方包,升级事务同时转移旧文件的所有权,不强制覆盖文件。 shadow 构建使用独立提取的 libbsd 开发文件,不把 Alpine 的 Linux 头文件混入 SDK。" +msgstr "libbsd, dosfstools, e2fsprogs, and their runtime libraries and documentation also come directly from pinned official Alpine APKs. The ext2/3/4 and FAT tools retain their official ``/sbin`` paths; compatibility links forward older ``/usr/sbin`` entry points. The local authentication support package still supplies libmd, and the local filesystem package still supplies exfatprogs. Real APK dependencies install the migrated official packages, transferring ownership of old files in the same upgrade transaction without forced overwrites. Shadow builds use separately extracted libbsd development files, keeping Alpine Linux headers out of the SDK." + msgid "" "RPR 本地发布树继续包含完整的签名索引、原始上游 APK 和自有包,构建 ``rpr-pages`` 不等于部署到线上。运行库因新增 ELF " "NEEDED 而得到真实 APK 依赖,不能只复制新的 ``libreliefos.so.2`` 而遗漏配套库。" diff --git a/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po b/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po index 94810697..02b2fe26 100644 --- a/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po +++ b/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po @@ -51,7 +51,7 @@ msgid "" "系统直接请求官方命令、终端工具/数据和 SQLite 命令/运行库,不再生成本地包装包。 文件所有权可通过 ``apk info --who-owns " "/usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` 查询。 " "离线更新器在预检时将旧包装包的 world 请求转换为官方包,保留其他包和配置; 正式事务自动卸载旧包,完成后清除离线缓存中的旧包装包归档。 " -"新的自有包使用第 4 代版本前缀,保证从第 2、3 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " +"新的自有包使用第 5 代版本前缀,保证从第 2、3、4 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " "SQLite VFS 或厂商内部符号的外部程序需要重新编译。" msgstr "" "sl、ncurses、zlib、libpng、SQLite、mbedTLS 3 は署名済み Alpine APK " @@ -60,9 +60,12 @@ msgstr "" "/usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` " "で照会できます。オフライン更新器は事前検査で旧ラッパーパッケージの world " "要求を公式パッケージに変換し、他のパッケージと設定は保持します。正式な処理では旧パッケージを自動削除し、完了後にオフラインキャッシュから旧ラッパーのアーカイブを除去します。新しい自有パッケージは第" -" 4 世代のバージョン接頭辞を使い、第 2・第 3 世代から通常のバージョン順に更新できます。旧 ``sqlite.so.3`` ABI " +" 5 世代のバージョン接頭辞を使い、第 2・第 3・第 4 世代から通常のバージョン順に更新できます。旧 ``sqlite.so.3`` ABI " "は削除済みです。旧独自 SQLite VFS やベンダー内部シンボルに依存する外部プログラムは再コンパイルが必要です。" +msgid "libbsd、dosfstools、e2fsprogs 及其运行库和文档也直接使用锁定的官方 Alpine APK。 ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口由兼容链接转发。 本地认证支持包继续提供 libmd,本地文件系统包继续提供 exfatprogs;它们通过真实的 APK 依赖安装已迁移的官方包,升级事务同时转移旧文件的所有权,不强制覆盖文件。 shadow 构建使用独立提取的 libbsd 开发文件,不把 Alpine 的 Linux 头文件混入 SDK。" +msgstr "libbsd、dosfstools、e2fsprogs とその実行時ライブラリおよび文書も、固定した公式 Alpine APK を直接使用します。ext2/3/4 と FAT のツールは公式の ``/sbin`` パスを維持し、従来の ``/usr/sbin`` 入口は互換リンクで転送します。ローカル認証支援パッケージは引き続き libmd を、ローカルファイルシステムパッケージは exfatprogs を提供します。実際の APK 依存関係により移行済みの公式パッケージを導入し、同じ更新処理で旧ファイルの所有権を移転するため、強制上書きは行いません。shadow のビルドには別途展開した libbsd 開発ファイルを使い、Alpine の Linux ヘッダーを SDK に混在させません。" + msgid "" "RPR 本地发布树继续包含完整的签名索引、原始上游 APK 和自有包,构建 ``rpr-pages`` 不等于部署到线上。运行库因新增 ELF " "NEEDED 而得到真实 APK 依赖,不能只复制新的 ``libreliefos.so.2`` 而遗漏配套库。" diff --git a/NOTICE b/NOTICE index 023fcfd8..40479503 100644 --- a/NOTICE +++ b/NOTICE @@ -39,18 +39,23 @@ Runtime, libraries, and applications * util-linux 2.41.6 (su/runuser and storage utilities/libraries): upstream GPL/LGPL and file-specific terms; see README.licensing. -* e2fsprogs 1.47.4: upstream GPL/LGPL/BSD/MIT and file-specific terms; - see NOTICE. dosfstools 4.2 and exfatprogs 1.4.4: see their COPYING files - and individual source headers. Fixed archive references and checksums are - in configs/storage-upstream.json; notices are installed under - /usr/share/licenses//. +* e2fsprogs 1.47.4 and dosfstools 4.2: unmodified signed Alpine APKs, + including their split runtime libraries and documentation. Versions, + archive hashes, recipe commits and package licenses are recorded in + configs/dependencies.lock.json. See resources/licenses/e2fsprogs-NOTICE + and the dosfstools-doc package's /usr/share/doc/dosfstools/COPYING. + exfatprogs 1.4.4 remains source-built; see its COPYING and source headers, + configs/storage-upstream.json and /usr/share/licenses/exfatprogs/. * libxcrypt 4.5.2: LGPL-2.1-or-later and file-specific terms; see COPYING.LIB and LICENSING. * shadow-utils 4.20.2: BSD-3-Clause and file-specific SPDX terms; see COPYING. -* libbsd 0.12.2: BSD/ISC/MIT and file-specific terms; see COPYING. -* libmd 1.2.0: BSD/ISC/Beerware/public-domain and file-specific terms; - see COPYING. These authentication dependencies use verified release archives - listed in configs/auth-upstream.json; full notices are copied into the +* libbsd 0.12.2: unmodified signed Alpine runtime/documentation APKs; + development APKs are extracted only for building shadow. See + resources/licenses/libbsd-LICENSE for BSD/ISC/MIT and file-specific terms, + and configs/dependencies.lock.json for archive identities. +* libmd 1.3.0: BSD/ISC/Beerware/public-domain and file-specific terms; + see COPYING. This authentication dependency uses verified release archives + identified in configs/dependencies.lock.json; full notices are copied into the isolated staging root's /usr/share/licenses// directory. * Vim (vim, vim-common, xxd): Vim License. Installed from signed Alpine APKs; versions and archive hashes are recorded in configs/dependencies.lock.json. diff --git a/configs/apk-ownership.json b/configs/apk-ownership.json index 79d10cd1..ae9d76fc 100644 --- a/configs/apk-ownership.json +++ b/configs/apk-ownership.json @@ -109,7 +109,7 @@ "components": [], "paths": ["lib/ld-musl-x86_64.so.1", "lib/libc.so", "etc/ld-musl-x86_64.path"], "alpine_candidates": ["musl"], - "reason": "Password-file locking patch and loader ABI require validation before replacing the running system libc. No fabricated musl provides." + "reason": "The locally patched musl owns the real loader/libc. Its musl compatibility provider uses the binary-checked upstream version; it does not claim Alpine revisions." }, "reliefos-mimalloc": { "destination": "reliefos", @@ -212,10 +212,10 @@ "auth-support-libraries": { "destination": "alpine-after-validation", "components": [], - "library_stems": ["lib/libbsd", "lib/libmd"], - "paths": ["usr/include/bsd", "usr/share/licenses/libbsd", "usr/share/licenses/libmd"], - "alpine_candidates": ["libbsd", "libmd"], - "reason": "Upstream dependencies of shadow; transfer headers, libraries and metadata with authentication consumers." + "library_stems": ["lib/libmd"], + "paths": ["usr/share/licenses/libmd"], + "alpine_candidates": ["libmd"], + "reason": "Local libmd 1.3.0 supplies the real libmd.so.0 ABI. Official libbsd owns its runtime; its development files are isolated for building shadow." }, "storage-util-linux": { "destination": "alpine-after-validation", @@ -227,17 +227,9 @@ "storage-filesystems": { "destination": "alpine-after-validation", "components": [], - "library_stems": ["usr/lib/libcom_err", "usr/lib/libe2p", "usr/lib/libext2fs", "usr/lib/libss"], - "paths": ["usr/include/ext2fs", "usr/include/ss", "usr/include/e2p", "usr/include/et", "usr/include/com_err.h", "usr/share/et", "usr/share/ss"], - "alpine_candidates": ["e2fsprogs", "dosfstools", "exfatprogs"], - "reason": "Transfer formatter/checker aliases with commands; preserve ext2 installer behavior." - }, - "ca-certificates-bundle": { - "destination": "alpine-after-validation", - "components": [], - "paths": ["etc/ssl/certs/ca-certificates.crt"], - "alpine_candidates": ["ca-certificates-bundle"], - "reason": "The actual CA bundle is packaged separately so curl dependencies and authenticated upstream updates can own it." + "paths": ["usr/bin/chattr", "usr/bin/lsattr", "usr/sbin/e2fsck", "usr/sbin/mke2fs", "usr/sbin/dosfsck", "usr/sbin/dosfslabel", "usr/sbin/fatlabel", "usr/sbin/mkdosfs", "usr/sbin/mkfs.ext3", "usr/sbin/fsck.ext3", "usr/sbin/mkfs.vfat", "usr/sbin/fsck.vfat", "usr/sbin/mkfs.msdos", "usr/sbin/fsck.msdos", "usr/sbin/mkfs.fat32", "usr/sbin/fsck.fat32", "sbin/mkfs.fat32", "sbin/fsck.fat32"], + "alpine_candidates": ["exfatprogs"], + "reason": "Local exfatprogs and compatibility aliases depend on official e2fsprogs/dosfstools packages. Official APKs retain ownership of ext/FAT executables, shared libraries, configuration and documentation." }, "trust": { "destination": "alpine-after-validation", diff --git a/configs/auth-upstream.json b/configs/auth-upstream.json index 2741c8c6..c48e315c 100644 --- a/configs/auth-upstream.json +++ b/configs/auth-upstream.json @@ -7,14 +7,6 @@ "license_file": "COPYING", "checksum_source": "https://lists.freedesktop.org/archives/libbsd/2026-May/000509.html" }, - "libbsd": { - "version": "0.12.2", - "url": "https://libbsd.freedesktop.org/releases/libbsd-0.12.2.tar.xz", - "sha256": "b88cc9163d0c652aaf39a99991d974ddba1c3a9711db8f1b5838af2a14731014", - "directory": "libbsd-0.12.2", - "license_file": "COPYING", - "checksum_source": "https://lists.freedesktop.org/archives/libbsd/2024-March/000455.html" - }, "shadow": { "version": "4.20.2", "url": "https://github.com/shadow-maint/shadow/releases/download/4.20.2/shadow-4.20.2.tar.xz", diff --git a/configs/dependencies.lock.json b/configs/dependencies.lock.json index 545f4d19..7e270514 100644 --- a/configs/dependencies.lock.json +++ b/configs/dependencies.lock.json @@ -528,7 +528,7 @@ "directory": "ca-certificates-bundle-20261020-r0", "script": "tools/build/upstream-apk.sh", "target": "apk-root", - "feature": "xorg", + "feature": "base", "note": "Alpine v3.24 main x86_64 APKINDEX license = MPL-2.0 AND MIT; embedded APK signature is verified by apk-tools", "license_in_source": ".PKGINFO" }, @@ -2541,28 +2541,95 @@ "target": "storage-upstream" }, { - "id": "dosfstools", - "kind": "tarball", - "version": "4.2", - "url": "https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz", - "sha256": "64926eebf90092dca21b14259a5301b7b98e7b1943e8a201c7d726084809b527", - "directory": "dosfstools-4.2", - "license_in_source": "COPYING", - "checksum_source": "https://raw.githubusercontent.com/buildroot/buildroot/2025.02/package/dosfstools/dosfstools.hash", - "script": "tools/build/upstream.sh", - "target": "storage-upstream" + "id": "alpine-dosfstools", + "kind": "apk", + "version": "4.2-r2", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/dosfstools-4.2-r2.apk", + "sha256": "54387981e6dd2e432f9bf401d04845e4bc7f7e20d279ef7bcc96b6dc6e24232e", + "directory": "dosfstools-4.2-r2", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 9024026ee6838388f8b87e52a17495786ed85d4e; .PKGINFO license = GPL-3.0-or-later; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys", + "license_in_source": ".PKGINFO" }, { - "id": "e2fsprogs", - "kind": "tarball", - "version": "1.47.4", - "url": "https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.47.4/e2fsprogs-1.47.4.tar.xz", - "sha256": "fd5bf388cbdbe006a3d3b318d983b2948382440acc85a87f1e7d108653e8db0b", - "directory": "e2fsprogs-1.47.4", - "license_in_source": "NOTICE", - "checksum_source": "https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.47.4/sha256sums.asc", - "script": "tools/build/upstream.sh", - "target": "storage-upstream" + "id": "alpine-dosfstools-doc", + "kind": "apk", + "version": "4.2-r2", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/dosfstools-doc-4.2-r2.apk", + "sha256": "cada0b794fe893606a35bdd97e30fcae09f426e2eac8e5e7c91b9e5c28fafdf0", + "directory": "dosfstools-doc-4.2-r2", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 repository, noarch documentation package; aports recipe commit 9024026ee6838388f8b87e52a17495786ed85d4e; .PKGINFO license = GPL-3.0-or-later; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-e2fsprogs", + "kind": "apk", + "version": "1.47.4-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/e2fsprogs-1.47.4-r0.apk", + "sha256": "c7a99a18206827b09f0cfa2373e6f1db0963845ad8468a378a3b99a7e716a0e8", + "directory": "e2fsprogs-1.47.4-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 8683a6972cb245fbbdb535dad6435a9930bb9374; .PKGINFO license = GPL-2.0-or-later AND LGPL-2.0-or-later AND BSD-3-Clause AND MIT; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; libblkid.so.1 and libuuid.so.1 remain provided by local util-linux", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-e2fsprogs-extra", + "kind": "apk", + "version": "1.47.4-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/e2fsprogs-extra-1.47.4-r0.apk", + "sha256": "602afe1eaa5838a25a82254a549df0490a4f94ee8bad07443eb36375b609aa5c", + "directory": "e2fsprogs-extra-1.47.4-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 8683a6972cb245fbbdb535dad6435a9930bb9374; .PKGINFO license = GPL-2.0-or-later AND LGPL-2.0-or-later AND BSD-3-Clause AND MIT; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-e2fsprogs-libs", + "kind": "apk", + "version": "1.47.4-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/e2fsprogs-libs-1.47.4-r0.apk", + "sha256": "2e067395a6981b06cfd2cd3abf0e6c6574f7ef64d02e01f75fc5323d4a337fb9", + "directory": "e2fsprogs-libs-1.47.4-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 8683a6972cb245fbbdb535dad6435a9930bb9374; .PKGINFO license = GPL-2.0-or-later AND LGPL-2.0-or-later AND BSD-3-Clause AND MIT; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; provides libe2p.so.2, libext2fs.so.2 and libss.so.2", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-libcom_err", + "kind": "apk", + "version": "1.47.4-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/libcom_err-1.47.4-r0.apk", + "sha256": "4723d0fb8e286dc6adb54dd3cdaedcd8db54260f75ee778a5acb4c16922c0f52", + "directory": "libcom_err-1.47.4-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 8683a6972cb245fbbdb535dad6435a9930bb9374; .PKGINFO license = GPL-2.0-or-later AND LGPL-2.0-or-later AND BSD-3-Clause AND MIT; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; provides libcom_err.so.2", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-e2fsprogs-doc", + "kind": "apk", + "version": "1.47.4-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/e2fsprogs-doc-1.47.4-r0.apk", + "sha256": "26a9fd1526abd44718645c7bceeb346258ce46ce4c4337649d764f072d29b9de", + "directory": "e2fsprogs-doc-1.47.4-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 repository, noarch documentation package; aports recipe commit 8683a6972cb245fbbdb535dad6435a9930bb9374; .PKGINFO license = GPL-2.0-or-later AND LGPL-2.0-or-later AND BSD-3-Clause AND MIT; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys", + "license_in_source": ".PKGINFO" }, { "id": "exfatprogs", @@ -2589,16 +2656,30 @@ "license": "userland/fastfetch/LICENSE" }, { - "id": "libbsd", - "kind": "tarball", - "version": "0.12.2", - "url": "https://libbsd.freedesktop.org/releases/libbsd-0.12.2.tar.xz", - "sha256": "b88cc9163d0c652aaf39a99991d974ddba1c3a9711db8f1b5838af2a14731014", - "directory": "libbsd-0.12.2", - "license_in_source": "COPYING", - "checksum_source": "https://lists.freedesktop.org/archives/libbsd/2024-March/000455.html", - "script": "tools/build/upstream.sh", - "target": "auth-upstream" + "id": "alpine-libbsd", + "kind": "apk", + "version": "0.12.2-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/libbsd-0.12.2-r0.apk", + "sha256": "407597c04b41dbfe8a05b35d45a3453e32fae7df84aed3a06ff48dd4df1338b6", + "directory": "libbsd-0.12.2-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 02365e78d654a7beb23fd35d7d69f4a649009ede; .PKGINFO license = BSD-3-Clause; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; libmd.so.0 remains provided by local libmd 1.3.0", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-libbsd-doc", + "kind": "apk", + "version": "0.12.2-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/libbsd-doc-0.12.2-r0.apk", + "sha256": "135ee3aa256ea160ea15091e1f680722c1b515c9d7754d9c6068e42bd1444707", + "directory": "libbsd-doc-0.12.2-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 repository, noarch documentation package; aports recipe commit 02365e78d654a7beb23fd35d7d69f4a649009ede; .PKGINFO license = BSD-3-Clause; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys", + "license_in_source": ".PKGINFO" }, { "id": "libmd", @@ -2946,6 +3027,32 @@ "note": "Alpine v3.24 main x86_64; official APK signature verified before use; license = blessing.", "license_in_source": ".PKGINFO" }, + { + "id": "runtime-dev-libbsd-dev", + "kind": "apk", + "version": "0.12.2-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/libbsd-dev-0.12.2-r0.apk", + "sha256": "487e821afe8810b679774591c0e38813fb98732df61ce64dd25ae2f76d95051b", + "directory": "libbsd-dev-0.12.2-r0", + "script": "tools/build/libbsd-development.sh", + "target": "libbsd-development", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 02365e78d654a7beb23fd35d7d69f4a649009ede; .PKGINFO license = BSD-3-Clause; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; build-only headers, linker script and pkg-config files; never a rootfs overlay; use local libmd 1.3.0 development files", + "license_in_source": ".PKGINFO" + }, + { + "id": "runtime-dev-libbsd-static", + "kind": "apk", + "version": "0.12.2-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/libbsd-static-0.12.2-r0.apk", + "sha256": "7dc2388984e93cd8df94b58b7a89e96ba410c984a18744c375586fbdc17e508c", + "directory": "libbsd-static-0.12.2-r0", + "script": "tools/build/libbsd-development.sh", + "target": "libbsd-development", + "feature": "base", + "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 02365e78d654a7beb23fd35d7d69f4a649009ede; .PKGINFO license = BSD-3-Clause; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; build-only libbsd.a; never a rootfs overlay", + "license_in_source": ".PKGINFO" + }, { "id": "runtime-dev-libpng-dev", "kind": "apk", diff --git a/configs/storage-upstream.json b/configs/storage-upstream.json index 0ba69ca2..1f1e4a76 100644 --- a/configs/storage-upstream.json +++ b/configs/storage-upstream.json @@ -1,20 +1,4 @@ { - "e2fsprogs": { - "version": "1.47.4", - "url": "https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.47.4/e2fsprogs-1.47.4.tar.xz", - "sha256": "fd5bf388cbdbe006a3d3b318d983b2948382440acc85a87f1e7d108653e8db0b", - "directory": "e2fsprogs-1.47.4", - "license_file": "NOTICE", - "checksum_source": "https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.47.4/sha256sums.asc" - }, - "dosfstools": { - "version": "4.2", - "url": "https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz", - "sha256": "64926eebf90092dca21b14259a5301b7b98e7b1943e8a201c7d726084809b527", - "directory": "dosfstools-4.2", - "license_file": "COPYING", - "checksum_source": "https://raw.githubusercontent.com/buildroot/buildroot/2025.02/package/dosfstools/dosfstools.hash" - }, "exfatprogs": { "version": "1.4.4", "url": "https://github.com/exfatprogs/exfatprogs/releases/download/1.4.4/exfatprogs-1.4.4.tar.xz", diff --git a/resources/licenses/e2fsprogs-NOTICE b/resources/licenses/e2fsprogs-NOTICE new file mode 100644 index 00000000..b7254e86 --- /dev/null +++ b/resources/licenses/e2fsprogs-NOTICE @@ -0,0 +1,863 @@ +This package, the EXT2 filesystem utilities, are made available under +the GNU Public License version 2, with the exception of the lib/ext2fs +and lib/e2p libraries, which are made available under the GNU Library +General Public License Version 2, the lib/uuid library which is made +available under a BSD-style license and the lib/et and lib/ss +libraries which are made available under an MIT-style license. Please +see lib/uuid/COPYING for more details for the license for the files +comprising the libuuid library, and the source file headers of the +libet and libss libraries for more information. + +The most recent officially distributed version can be found at +http://e2fsprogs.sourceforge.net. If you need to make a distribution, +that's the one you should use. If there is some reason why you'd like +a more recent version that is still in ALPHA testing (i.e., either +using the "WIP" test distributions or one from the hg or git +repository from the development branch, please contact me +(tytso@mit.edu) before you ship. The release schedules for this +package are flexible, if you give me enough lead time. + + + Theodore Ts'o + 23-June-2007 + +---------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + +---------------------------------------------------------------------- + + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/resources/licenses/libbsd-LICENSE b/resources/licenses/libbsd-LICENSE new file mode 100644 index 00000000..7814d8f4 --- /dev/null +++ b/resources/licenses/libbsd-LICENSE @@ -0,0 +1,558 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: + * +Copyright: + Copyright © 2004-2024 Guillem Jover +License: BSD-3-clause + +Files: + include/bsd/err.h + include/bsd/stdlib.h + include/bsd/sys/param.h + include/bsd/unistd.h + src/bsd_getopt.c + src/err.c + src/fgetln.c + src/progname.c +Copyright: + Copyright © 2005, 2008-2012, 2019 Guillem Jover + Copyright © 2005 Hector Garcia Alvarez + Copyright © 2005 Aurelien Jarno + Copyright © 2006 Robert Millan + Copyright © 2018 Facebook, Inc. +License: BSD-3-clause + +Files: + include/bsd/netinet/ip_icmp.h + include/bsd/sys/bitstring.h + include/bsd/sys/queue.h + include/bsd/sys/time.h + include/bsd/timeconv.h + include/bsd/vis.h + man/bitstring.3bsd + man/errc.3bsd + man/explicit_bzero.3bsd + man/fgetln.3bsd + man/fgetwln.3bsd + man/fpurge.3bsd + man/funopen.3bsd + man/getbsize.3bsd + man/heapsort.3bsd + man/nlist.3bsd + man/pwcache.3bsd + man/queue.3bsd + man/radixsort.3bsd + man/reallocarray.3bsd + man/reallocf.3bsd + man/setmode.3bsd + man/strmode.3bsd + man/strnstr.3bsd + man/strtoi.3bsd + man/strtou.3bsd + man/unvis.3bsd + man/vis.3bsd + man/wcslcpy.3bsd + src/getbsize.c + src/heapsort.c + src/merge.c + src/nlist.c + src/pwcache.c + src/radixsort.c + src/setmode.c + src/strmode.c + src/strnstr.c + src/strtoi.c + src/strtou.c + src/unvis.c +Copyright: + Copyright © 1980, 1982, 1986, 1989-1994 + The Regents of the University of California. All rights reserved. + Copyright © 1992 Keith Muller. + Copyright © 2001 Mike Barcroft + . + Some code is derived from software contributed to Berkeley by + the American National Standards Committee X3, on Information + Processing Systems. + . + Some code is derived from software contributed to Berkeley by + Peter McIlroy. + . + Some code is derived from software contributed to Berkeley by + Ronnie Kon at Mindcraft Inc., Kevin Lew and Elmer Yglesias. + . + Some code is derived from software contributed to Berkeley by + Dave Borman at Cray Research, Inc. + . + Some code is derived from software contributed to Berkeley by + Paul Vixie. + . + Some code is derived from software contributed to Berkeley by + Chris Torek. + . + Copyright © UNIX System Laboratories, Inc. + All or some portions of this file are derived from material licensed + to the University of California by American Telephone and Telegraph + Co. or Unix System Laboratories, Inc. and are reproduced herein with + the permission of UNIX System Laboratories, Inc. +License: BSD-3-clause-Regents + +Files: + src/vis.c +Copyright: + Copyright © 1989, 1993 + The Regents of the University of California. All rights reserved. + . + Copyright © 1999, 2005 The NetBSD Foundation, Inc. + All rights reserved. +License: BSD-3-clause-Regents and BSD-2-clause-NetBSD + +Files: + include/bsd/libutil.h +Copyright: + Copyright © 1996 Peter Wemm . + All rights reserved. + Copyright © 2002 Networks Associates Technology, Inc. + All rights reserved. +License: BSD-3-clause-author + +Files: + man/timeradd.3bsd +Copyright: + Copyright © 2009 Jukka Ruohonen + Copyright © 1999 Kelly Yancey + All rights reserved. +License: BSD-3-clause-John-Birrell + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the author nor the names of any co-contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +Files: + man/setproctitle.3bsd +Copyright: + Copyright © 1995 Peter Wemm + All rights reserved. +License: BSD-5-clause-Peter-Wemm + Redistribution and use in source and binary forms, with or without + modification, is permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice immediately at the beginning of the file, without modification, + this list of conditions, and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. This work was done expressly for inclusion into FreeBSD. Other use + is permitted provided this notation is included. + 4. Absolutely no warranty of function or purpose is made by the author + Peter Wemm. + 5. Modifications may be freely made to this file providing the above + conditions are met. + +Files: + include/bsd/stringlist.h + man/arc4random.3bsd + man/fmtcheck.3bsd + man/humanize_number.3bsd + man/stringlist.3bsd + man/timeval.3bsd + src/fmtcheck.c + src/humanize_number.c + src/stringlist.c + src/strtonum.c +Copyright: + Copyright © 1994, 1997-2000, 2002, 2008, 2010, 2014 + The NetBSD Foundation, Inc. + Copyright © 2013 John-Mark Gurney + All rights reserved. + . + Copyright © 2014 The NetBSD Foundation, Inc. + All rights reserved. + . + Some code was derived from software contributed to The NetBSD Foundation + by Taylor R. Campbell. + . + Some code was contributed to The NetBSD Foundation by Allen Briggs. + . + Some code was contributed to The NetBSD Foundation by Luke Mewburn. + . + Some code is derived from software contributed to The NetBSD Foundation + by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + NASA Ames Research Center, by Luke Mewburn and by Tomas Svensson. + . + Some code is derived from software contributed to The NetBSD Foundation + by Julio M. Merino Vidal, developed as part of Google's Summer of Code + 2005 program. + . + Some code is derived from software contributed to The NetBSD Foundation + by Christos Zoulas. + . + Some code is derived from software contributed to The NetBSD Foundation + by Jukka Ruohonen. +License: BSD-2-clause-NetBSD + +Files: + include/bsd/sys/endian.h + man/byteorder.3bsd + man/closefrom.3bsd + man/expand_number.3bsd + man/flopen.3bsd + man/getpeereid.3bsd + man/pidfile.3bsd + src/expand_number.c + src/pidfile.c + src/reallocf.c + src/timeconv.c +Copyright: + Copyright © 1998, M. Warner Losh + All rights reserved. + . + Copyright © 2001 Dima Dorfman. + All rights reserved. + . + Copyright © 2001 FreeBSD Inc. + All rights reserved. + . + Copyright © 2002 Thomas Moestl + All rights reserved. + . + Copyright © 2002 Mike Barcroft + All rights reserved. + . + Copyright © 2005 Pawel Jakub Dawidek + All rights reserved. + . + Copyright © 2005 Colin Percival + All rights reserved. + . + Copyright © 2007 Eric Anderson + Copyright © 2007 Pawel Jakub Dawidek + All rights reserved. + . + Copyright © 2007 Dag-Erling Coïdan Smørgrav + All rights reserved. + . + Copyright © 2009 Advanced Computing Technologies LLC + All rights reserved. + . + Copyright © 2011 Guillem Jover +License: BSD-2-clause + +Files: + src/flopen.c +Copyright: + Copyright © 2007-2009 Dag-Erling Coïdan Smørgrav + All rights reserved. +License: BSD-2-clause-verbatim + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer + in this position and unchanged. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +Files: + include/bsd/sys/tree.h + man/fparseln.3bsd + man/tree.3bsd + src/fparseln.c +Copyright: + Copyright © 1997 Christos Zoulas. + All rights reserved. + . + Copyright © 2002 Niels Provos + All rights reserved. +License: BSD-2-clause-author + +Files: + include/bsd/readpassphrase.h + man/readpassphrase.3bsd + man/strlcpy.3bsd + man/strtonum.3bsd + src/arc4random.c + src/arc4random_linux.h + src/arc4random_uniform.c + src/arc4random_unix.h + src/arc4random_win.h + src/closefrom.c + src/freezero.c + src/getentropy_aix.c + src/getentropy_bsd.c + src/getentropy_hpux.c + src/getentropy_hurd.c + src/getentropy_linux.c + src/getentropy_osx.c + src/getentropy_solaris.c + src/getentropy_win.c + src/readpassphrase.c + src/reallocarray.c + src/recallocarray.c + src/strlcat.c + src/strlcpy.c + test/explicit_bzero.c + test/strtonum.c +Copyright: + Copyright © 2004 Ted Unangst and Todd Miller + All rights reserved. + . + Copyright © 1996 David Mazieres + Copyright © 1998, 2000-2002, 2004-2005, 2007, 2010, 2012-2015 + Todd C. Miller + Copyright © 2004 Ted Unangst + Copyright © 2004 Otto Moerbeek + Copyright © 2008 Damien Miller + Copyright © 2008, 2010-2011, 2016-2017 Otto Moerbeek + Copyright © 2013 Markus Friedl + Copyright © 2014 Bob Beck + Copyright © 2014 Brent Cook + Copyright © 2014 Pawel Jakub Dawidek + Copyright © 2014 Theo de Raadt + Copyright © 2014 Google Inc. + Copyright © 2015 Michael Felt + Copyright © 2015, 2022 Guillem Jover +License: ISC + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + . + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Files: + src/inet_net_pton.c +Copyright: + Copyright © 1996 by Internet Software Consortium. +License: ISC-Original + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + . + THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + SOFTWARE. + +Files: + src/setproctitle.c +Copyright: + Copyright © 2010 William Ahern + Copyright © 2012 Guillem Jover +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + . + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. + +Files: + src/explicit_bzero.c + src/chacha_private.h +Copyright: + None +License: public-domain + Public domain. + +Files: + man/mdX.3bsd +Copyright: + None +License: Beerware + "THE BEER-WARE LICENSE" (Revision 42): + wrote this file. As long as you retain this notice you + can do whatever you want with this stuff. If we meet some day, and you think + this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + +License: BSD-3-clause-Regents + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD-3-clause-author + Redistribution and use in source and binary forms, with or without + modification, is permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +License: BSD-3-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD-2-clause-NetBSD + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +License: BSD-2-clause-author + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: BSD-2-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. diff --git a/scripts/reliefos/Makefile.apk b/scripts/reliefos/Makefile.apk index c4bb7b00..50ad3d86 100644 --- a/scripts/reliefos/Makefile.apk +++ b/scripts/reliefos/Makefile.apk @@ -8,10 +8,10 @@ APK_REPOSITORY := $(APK_WORK)/repository APK_MANIFEST := $(APK_WORK)/manifest.json APK_OWNERSHIP := $(APK_WORK)/ownership.tsv APK_SIGNING_KEY ?= $(HOME)/.local/share/leonos/apk-signing/key.pem -# Generation 4 removes the terminal/SQLite wrapper packages entirely. -# This sorts after generation 3 even for development builds at the same commit. +# Generation 5 transfers libbsd and ext/FAT tools to official Alpine owners. +# This sorts after generation 4 even for development builds at the same commit. # Published releases must still use an increasing SOURCE_DATE_EPOCH. -APK_BUILD_VERSION ?= 4.$(SOURCE_DATE_EPOCH)-r0 +APK_BUILD_VERSION ?= 5.$(SOURCE_DATE_EPOCH)-r0 APK_STAGE_SCRIPT := $(RELIEFOS_SRC)/tools/build/apk-stage.sh APK_STAGE_INPUTS := $(RELIEFOS_SRC)/tools/build/apk-layout.sh $(RELIEFOS_LAYOUT_TOOL) $(RELIEFOS_LOCK) $(RELIEFOS_DEPS_TOOL) BUILD_LOG_INPUTS := $(RELIEFOS_SHELL_LOG) $(RELIEFOS_SRC)/tools/build/run-logged.sh $(RELIEFOS_SRC)/tools/build/format-log.awk diff --git a/scripts/reliefos/Makefile.apk-dependencies b/scripts/reliefos/Makefile.apk-dependencies index 863bdbe2..2cf1cb4f 100644 --- a/scripts/reliefos/Makefile.apk-dependencies +++ b/scripts/reliefos/Makefile.apk-dependencies @@ -7,6 +7,18 @@ $(UPSTREAM_APK) $(UPSTREAM_APK_ROOT)/.complete &: $(RELIEFOS_SRC)/tools/build/up .PHONY: upstream-apk upstream-apk: $(UPSTREAM_APK) $(UPSTREAM_APK_ROOT)/.complete +# Shadow consumes official libbsd headers and libraries in an isolated build +# root. Do not add this root to the guest overlay or the public musl sysroot. +LIBBSD_DEVELOPMENT_ROOT := $(UPSTREAM_ROOT)/libbsd/root +upstream_libbsd_products := $(addprefix $(LIBBSD_DEVELOPMENT_ROOT)/,usr/include/bsd/stdlib.h usr/include/bsd/sys/queue.h usr/lib/libbsd.so usr/lib/libbsd.so.0 usr/lib/libbsd.so.0.12.2 usr/lib/libbsd.a usr/lib/pkgconfig/libbsd.pc usr/lib/pkgconfig/libbsd-overlay.pc lib/libbsd.so lib/libbsd.so.0 lib/libbsd.a) +$(LIBBSD_DEVELOPMENT_ROOT)/.complete $(upstream_libbsd_products) &: $(RELIEFOS_SRC)/tools/build/libbsd-development.sh $(RELIEFOS_LOCK) $(RELIEFOS_DEPS_TOOL) $(UPSTREAM_APK) $(RELIEFOS_SRC)/resources/licenses/libbsd-LICENSE + $(Q)sh $(RELIEFOS_SRC)/tools/build/libbsd-development.sh $(RELIEFOS_SRC) $(abspath $(RELIEFOS_DEPS_TOOL)) $(RELIEFOS_LOCK) $(RELIEFOS_CACHE) $(abspath $(UPSTREAM_APK)) $(abspath $(LIBBSD_DEVELOPMENT_ROOT)) + $(Q)touch $(upstream_libbsd_products) +$(O_META)/libbsd-development-present.parameters: FORCE $(RELIEFOS_SRC)/tools/build/upstream-verify.sh + $(Q)sh $(RELIEFOS_SRC)/tools/build/upstream-verify.sh $(LIBBSD_DEVELOPMENT_ROOT) $(LIBBSD_DEVELOPMENT_ROOT).files $@ +$(LIBBSD_DEVELOPMENT_ROOT)/.complete $(upstream_libbsd_products): $(O_META)/libbsd-development-present.parameters +.PHONY: upstream-libbsd libbsd-development +upstream-libbsd libbsd-development: $(LIBBSD_DEVELOPMENT_ROOT)/.complete $(upstream_libbsd_products) RUNTIME_DEVELOPMENT_ROOT := $(UPSTREAM_ROOT)/runtime-development RUNTIME_DEP_LIBDIR := $(RUNTIME_DEVELOPMENT_ROOT)/usr/lib @@ -25,8 +37,8 @@ reliefos-upstream: upstream-apk export RUNTIME_DEVELOPMENT_ROOT RUNTIME_DEP_SHARED RUNTIME_DEP_STATIC # Retain public build goal names while their payload comes from verified APKs. -.PHONY: upstream-ncurses upstream-app-sl upstream-app-sqlite -upstream-ncurses upstream-app-sl: upstream-apk +.PHONY: upstream-ncurses upstream-app-sl upstream-app-sqlite upstream-e2fsprogs upstream-dosfstools +upstream-ncurses upstream-app-sl upstream-e2fsprogs upstream-dosfstools: upstream-apk upstream-app-sqlite: upstream-apk runtime-development # Source-based sanitizer tests need host-libc libraries. Musl APK archives must diff --git a/scripts/reliefos/Makefile.rootfs b/scripts/reliefos/Makefile.rootfs index c550b777..bfe9ab50 100644 --- a/scripts/reliefos/Makefile.rootfs +++ b/scripts/reliefos/Makefile.rootfs @@ -10,7 +10,7 @@ ROOTFS_SOURCE_DIRS := $(RELIEFOS_SRC)/system $(RELIEFOS_SRC)/resources/build-art ROOTFS_SOURCE_DIRS += $(RELIEFOS_SRC)/resources/reliefmath $(RELIEFOS_SRC)/resources/licenses/reliefmath ROOTFS_SOURCE_DIRS += $(RELIEFOS_SRC)/userland/fastfetch $(RELIEFOS_SRC)/logo.png $(RELIEFOS_SRC)/test/test.mp3 $(RELIEFOS_SRC)/Documentation/admin-guide/packages.rst $(RELIEFOS_SRC)/configs/apk-ownership.json ROOTFS_SOURCE_DIRS += $(wildcard $(addprefix $(RELIEFOS_SRC)/third_party/,busybox/LICENSE pl_editor/LICENSE)) -ROOTFS_SOURCE_DIRS += $(RELIEFOS_SRC)/tools/build/rpr-config.sh $(addprefix $(RELIEFOS_SRC)/resources/licenses/,sl-LICENSE ncurses-LICENSE sqlite-LICENSE zlib-LICENSE libpng-LICENSE mbedtls3-LICENSE) +ROOTFS_SOURCE_DIRS += $(RELIEFOS_SRC)/tools/build/rpr-config.sh $(addprefix $(RELIEFOS_SRC)/resources/licenses/,sl-LICENSE ncurses-LICENSE sqlite-LICENSE zlib-LICENSE libpng-LICENSE mbedtls3-LICENSE libbsd-LICENSE e2fsprogs-NOTICE) $(O_META)/rootfs-sources.parameters: FORCE $(RELIEFOS_SRC)/tools/build/tree-signature.sh $(Q)sh $(RELIEFOS_SRC)/tools/build/tree-signature.sh $@ $(ROOTFS_SOURCE_DIRS) ROOTFS_UPSTREAM_PRODUCTS = $(foreach package,$(UPSTREAM_PACKAGES),$(UPSTREAM_ROOT)/$(package)/root/.complete $(upstream_$(package)_products)) diff --git a/scripts/reliefos/Makefile.upstream b/scripts/reliefos/Makefile.upstream index 8a2a932d..a99d03d6 100644 --- a/scripts/reliefos/Makefile.upstream +++ b/scripts/reliefos/Makefile.upstream @@ -1,14 +1,11 @@ # Include after third-party.mk, pam.mk and runtime.mk. Each package owns an isolated root. UPSTREAM_ROOT := $(O)/upstream UPSTREAM_SCRIPT := $(RELIEFOS_SRC)/tools/build/upstream.sh -UPSTREAM_PACKAGES := libmd libbsd util-linux sudo shadow e2fsprogs dosfstools exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg +UPSTREAM_PACKAGES := libmd util-linux sudo shadow exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg upstream_libmd_outputs := lib/libmd.so.0 usr/include/md5.h -upstream_libbsd_outputs := lib/libbsd.so.0 usr/include/bsd/stdlib.h upstream_util-linux_outputs := usr/lib/libuuid.a usr/lib/libblkid.a bin/su usr/sbin/fdisk bin/mount bin/lsblk upstream_sudo_outputs := usr/bin/sudo usr/lib/sudo/sudoers.so upstream_shadow_outputs := bin/login usr/sbin/useradd usr/sbin/usermod usr/sbin/userdel -upstream_e2fsprogs_outputs := usr/sbin/mkfs.ext4 usr/sbin/fsck.ext4 usr/sbin/mkfs.ext2 usr/sbin/fsck.ext2 -upstream_dosfstools_outputs := usr/sbin/mkfs.fat usr/sbin/fsck.fat upstream_exfatprogs_outputs := usr/sbin/mkfs.exfat usr/sbin/fsck.exfat COREUTILS_PROGRAMS := $(shell cat $(RELIEFOS_SRC)/userland/coreutils/programs.list) upstream_coreutils_outputs := $(addprefix usr/bin/,$(COREUTILS_PROGRAMS)) usr/libexec/coreutils/libstdbuf.so @@ -20,9 +17,7 @@ upstream_nuked-opl3_script := $(RELIEFOS_SRC)/tools/build/opl3.sh upstream_ffmpeg_outputs := usr/lib/libavformat-reliefplayer.so.62 usr/lib/libavcodec-reliefplayer.so.62 usr/lib/libavutil-reliefplayer.so.60 usr/lib/libswresample-reliefplayer.so.6 usr/lib/libswscale-reliefplayer.so.9 usr/include/libavformat/avformat.h usr/include/libavcodec/avcodec.h usr/include/libavutil/avutil.h usr/include/libswresample/swresample.h usr/include/libswscale/swscale.h upstream_ffmpeg_script := $(RELIEFOS_SRC)/tools/build/ffmpeg.sh $(foreach package,$(UPSTREAM_PACKAGES),$(eval upstream_$(package)_primary := $(upstream_$(package)_outputs))) -upstream_libbsd_deps := libmd upstream_shadow_deps := libmd libbsd -upstream_e2fsprogs_deps := util-linux upstream_exfatprogs_deps := util-linux upstream_alsa-utils_deps := alsa-lib upstream_alsa-lib_patches := $(wildcard $(RELIEFOS_SRC)/patches/alsa-lib/*.patch) diff --git a/tests/build/test-apk-ownership.sh b/tests/build/test-apk-ownership.sh index d01da9f1..c7d0d467 100644 --- a/tests/build/test-apk-ownership.sh +++ b/tests/build/test-apk-ownership.sh @@ -17,8 +17,8 @@ missing = sorted(required - groups.keys()) legacy = sorted(name for name in groups if name.startswith("leonos-")) if missing or legacy or policy.get("current_distributor") != "reliefos-build": raise SystemExit(f"APK ownership identity is not migrated: missing={missing}, legacy={legacy}, distributor={policy.get('current_distributor')}") -if {"sl", "ncurses", "sqlite"} & groups.keys(): - raise SystemExit("official terminal/SQLite packages must not create local APK ownership groups") +if {"sl", "ncurses", "sqlite", "ca-certificates-bundle"} & groups.keys(): + raise SystemExit("official terminal/SQLite/CA packages must not create local APK ownership groups") if policy.get("upstream_components") != {"sl": ["sl"], "ncurses": ["ncurses", "ncurses-terminfo"], "sqlite": ["sqlite", "sqlite-libs"]}: raise SystemExit("terminal/SQLite components must identify their real upstream packages") diff --git a/tests/build/test-apk-stage-selection.sh b/tests/build/test-apk-stage-selection.sh index 01d94dde..3b44a39c 100755 --- a/tests/build/test-apk-stage-selection.sh +++ b/tests/build/test-apk-stage-selection.sh @@ -360,6 +360,15 @@ if ! stage upstream-library; then exit 1 fi expect_grep "$w/upstream-library/apk.log" 'depends:.*so:libfixture.so.1' +mkdir -p "$w/raw/usr/lib" +cp "$w/libfixture.so.1" "$w/raw/usr/lib/libfixture.so.1" +if stage duplicate-library; then + echo 'FAIL - obsolete local library duplicated an official SONAME' >&2 + exit 1 +fi +expect_grep "$w/duplicate-library/stderr" 'local payload duplicates an official APK SONAME' +expect_absent "$w/duplicate-library/managed" +rm "$w/raw/usr/lib/libfixture.so.1" set_marker "reliefos " if stage filtered-library; then diff --git a/tests/build/test-desktop-backend.sh b/tests/build/test-desktop-backend.sh index 40d49fd8..5211e628 100755 --- a/tests/build/test-desktop-backend.sh +++ b/tests/build/test-desktop-backend.sh @@ -111,7 +111,7 @@ mkdir -p "$work/out/upstream/ncurses/root/usr/bin" \ "$work/out/upstream/ncurses/root/usr/share/terminfo" \ "$work/out/upstream/ncurses/root/usr/include" \ "$work/out/upstream/fixture-provider/root/usr/bin" \ - "$work/out/upstream/fixture-provider/root/usr/sbin" \ + "$work/out/upstream/fixture-provider/root/sbin" \ "$work/out/upstream/inactive/root/usr/bin" printf 'ncurses clear\n' > "$work/out/upstream/ncurses/root/usr/bin/clear" ln -s clear "$work/out/upstream/ncurses/root/usr/bin/reset" @@ -119,7 +119,7 @@ printf 'terminal data\n' > "$work/out/upstream/ncurses/root/usr/share/terminfo/f printf 'development header\n' > "$work/out/upstream/ncurses/root/usr/include/curses.h" printf 'selected provider\n' > "$work/out/upstream/fixture-provider/root/usr/bin/hexdump" printf 'external ping provider\n' > "$work/out/upstream/fixture-provider/root/usr/bin/ping" -printf 'storage provider\n' > "$work/out/upstream/fixture-provider/root/usr/sbin/mkfs.ext4" +printf 'storage provider\n' > "$work/out/upstream/fixture-provider/root/sbin/mkfs.ext4" printf 'inactive provider\n' > "$work/out/upstream/inactive/root/usr/bin/tree" printf 'BusyBox fixture\n' > "$work/out/userland/busybox.elf" printf '%s\n' /bin/sh /bin/ash /bin/false /bin/ping /bin/ping6 /bin/hexdump \ @@ -277,13 +277,13 @@ test "$(readlink "$xorg_root/bin/ping6")" = busybox # grow a BusyBox link, even under a different directory. cmp "$work/out/upstream/fixture-provider/root/usr/bin/hexdump" "$xorg_root/usr/bin/hexdump" cmp "$work/out/upstream/fixture-provider/root/usr/bin/ping" "$xorg_root/usr/bin/ping" -cmp "$work/out/upstream/fixture-provider/root/usr/sbin/mkfs.ext4" "$xorg_root/usr/sbin/mkfs.ext4" +cmp "$work/out/upstream/fixture-provider/root/sbin/mkfs.ext4" "$xorg_root/sbin/mkfs.ext4" test ! -e "$xorg_root/bin/hexdump" test ! -e "$xorg_root/bin/ping" -# /sbin/mkfs.ext4 stays the storage compatibility alias to the upstream -# provider; BusyBox must not claim the command. -test -L "$xorg_root/sbin/mkfs.ext4" -test "$(readlink "$xorg_root/sbin/mkfs.ext4")" = ../usr/sbin/mkfs.ext4 +# /sbin is the official provider; old /usr/sbin callers use a one-way alias. +# BusyBox must not claim either entry point. +test ! -L "$xorg_root/sbin/mkfs.ext4" +test "$(readlink "$xorg_root/usr/sbin/mkfs.ext4")" = ../../sbin/mkfs.ext4 # ncurses payloads are installed later from signed APKs, never overlaid. grep -Fx ncurses "$xorg_root/etc/reliefos/apk-components" test ! -e "$xorg_root/usr/share/doc/reliefos/apk-transitions" diff --git a/tests/build/test-libbsd-development.sh b/tests/build/test-libbsd-development.sh new file mode 100755 index 00000000..b04eb1c0 --- /dev/null +++ b/tests/build/test-libbsd-development.sh @@ -0,0 +1,354 @@ +#!/bin/sh +# Offline adapter tests. Python is used only to construct hostile test archives. +set -eu +LC_ALL=C +export LC_ALL +repo=$(CDPATH='' cd -- "$(dirname "$0")/../.." && pwd -P) +tmp_root=${TMPDIR:-$repo/out/tmp} +mkdir -p "$tmp_root" +work=$(mktemp -d "$tmp_root/reliefos-libbsd-development.XXXXXX") +trap 'rm -rf "$work"' 0 +trap 'exit 130' HUP INT TERM +fail() { printf 'libbsd-development test: %s\n' "$*" >&2; exit 1; } +adapter=$repo/tools/build/libbsd-development.sh +src=$work/source +cache=$work/cache +output=$work/out\ with\ spaces/libbsd/root +mkdir -p "$work/bin" "$work/good" "$cache" "$work/digests" \ + "$src/resources/licenses" "$src/system/rootfs/etc/apk/keys" "$work/md/lib" +cp "$repo/resources/licenses/libbsd-LICENSE" "$src/resources/licenses/libbsd-LICENSE" +printf 'fixture lock\n' >"$work/lock" +export FIXTURE_WORK="$work" FIXTURE_SRC="$src" +real_mv=$(command -v mv) +real_tar=$(command -v tar) +real_find=$(command -v find) +export FIXTURE_MV="$real_mv" FIXTURE_TAR="$real_tar" FIXTURE_FIND="$real_find" + +cat >"$work/bin/deps" <<'DATA' +#!/bin/sh +set -eu +[ "$#" = 6 ] && [ "$1" = --lock ] && [ "$2" = "$FIXTURE_WORK/lock" ] && + [ "$3" = --id ] && [ "$5" = --print ] || exit 2 +case $4 in + alpine-libbsd) name=libbsd;; + runtime-dev-libbsd-dev) name=libbsd-dev;; + runtime-dev-libbsd-static) name=libbsd-static;; + *) exit 2;; +esac +case $6 in + url) + if [ "${BAD_URL:-0}" = 1 ]; then printf 'https://fixture.invalid/../bad.apk\n'; exit; fi + printf 'https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/%s-0.12.2-r0.apk\n' "$name";; + sha256) + if [ "${BAD_DIGEST:-0}" = 1 ]; then printf 'bad-digest\n'; exit; fi + cat "$FIXTURE_WORK/digests/$name";; + *) exit 2;; +esac +DATA +cat >"$work/bin/apk" <<'DATA' +#!/bin/sh +set -eu +[ "$#" = 4 ] && [ "$1" = --keys-dir ] && + [ "$2" = "$FIXTURE_SRC/system/rootfs/etc/apk/keys" ] && [ "$3" = verify ] || exit 2 +sha256sum "$4" >>"$FIXTURE_WORK/verifications" +if [ "${FAIL_VERIFY_AFTER:-0}" = "$(wc -l <"$FIXTURE_WORK/verifications" | tr -d ' ')" ]; then exit 9; fi +DATA +cat >"$work/bin/mv" <<'DATA' +#!/bin/sh +set -eu +if [ "$#" = 2 ] && [ "$2" = "${FAIL_PUBLISH_DEST:-}" ] && [ -f "$FIXTURE_WORK/fail-once" ]; then + rm "$FIXTURE_WORK/fail-once" + exit 9 +fi +exec "$FIXTURE_MV" "$@" +DATA +cat >"$work/bin/tar" <<'DATA' +#!/bin/sh +set -eu +if [ "${FAIL_EXTRACT:-0}" = 1 ]; then + for arg do [ "$arg" != -xOzf ] || exit 9; done +fi +exec "$FIXTURE_TAR" "$@" +DATA +cat >"$work/bin/find" <<'DATA' +#!/bin/sh +set -eu +[ "${FAIL_INVENTORY:-0}" != 1 ] || exit 9 +exec "$FIXTURE_FIND" "$@" +DATA +chmod +x "$work/bin/"* + +# The static BSD fixture deliberately needs libmd from a separate local stage. +cc=${CC:-cc} +printf 'int fixture_md(void) { return 17; }\n' >"$work/md.c" +printf 'extern int fixture_md(void); int fixture_bsd(void) { return fixture_md(); }\n' >"$work/bsd.c" +"$cc" -fPIC -c "$work/md.c" -o "$work/md.o" +"$cc" -fPIC -c "$work/bsd.c" -o "$work/bsd.o" +ar rcs "$work/md/lib/libmd.a" "$work/md.o" +"$cc" -shared -Wl,-soname,libmd.so.0 "$work/md.o" -o "$work/md/lib/libmd.so.0.0.0" +ln -s libmd.so.0.0.0 "$work/md/lib/libmd.so.0" +ln -s libmd.so.0 "$work/md/lib/libmd.so" +"$cc" -shared -Wl,-soname,libbsd.so.0 "$work/bsd.o" -L"$work/md/lib" -lmd -o "$work/libbsd.so.0.12.2" +ar rcs "$work/libbsd.a" "$work/bsd.o" + +cat >"$work/packages.py" <<'PY' +import io +import pathlib +import sys +import tarfile + +work = pathlib.Path(sys.argv[1]) +script = b'''/* GNU ld script + * The MD5 functions are provided by the libmd library. */ +OUTPUT_FORMAT(elf64-x86-64) +GROUP(/usr/lib/libbsd.so.0.12.2 AS_NEEDED(-lmd)) +''' +pc = b'''prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libbsd +Description: BSD fixture +Version: 0.12.2 +Libs: -L${libdir} -lbsd +Libs.private: -pthread -lmd +Cflags: -I${includedir} +''' +def regular(name, data): + info = tarfile.TarInfo(name) + info.size = len(data) + info.mode = 0o644 + return info, data + +for name in ('libbsd', 'libbsd-dev', 'libbsd-static'): + members = [regular('.PKGINFO', f'pkgname = {name}\npkgver = 0.12.2-r0\narch = x86_64\n'.encode())] + if name == 'libbsd': + members += [regular('usr/lib/libbsd.so.0.12.2', (work / 'libbsd.so.0.12.2').read_bytes())] + link = tarfile.TarInfo('usr/lib/libbsd.so.0') + link.type = tarfile.SYMTYPE + link.linkname = 'libbsd.so.0.12.2' + members.append((link, b'')) + elif name == 'libbsd-dev': + for header in ('stdlib.h', 'string.h', 'unistd.h', 'sys/queue.h', 'sys/tree.h', 'nested/extra.h'): + members.append(regular('usr/include/bsd/' + header, b'int fixture_bsd(void);\n')) + members += [regular('usr/lib/libbsd.so', script)] + for filename in ('libbsd.pc', 'libbsd-overlay.pc'): + members.append(regular('usr/lib/pkgconfig/' + filename, pc)) + # These unrelated headers/libraries must never reach the build root. + for path in ('usr/include/stdlib.h', 'usr/include/sys/cdefs.h', 'usr/include/linux/types.h', + 'usr/lib/libc.so', 'usr/lib/libmd.a', 'usr/lib/libbsd.la'): + members.append(regular(path, b'not a libbsd product\n')) + else: + members += [regular('usr/lib/libbsd.a', (work / 'libbsd.a').read_bytes())] + with tarfile.open(work / 'good' / f'{name}-0.12.2-r0.apk', 'w:gz', format=tarfile.USTAR_FORMAT) as archive: + for info, data in members: + archive.addfile(info, io.BytesIO(data) if info.isreg() else None) +PY +python3 "$work/packages.py" "$work" + +reseal() { + for name in libbsd libbsd-dev libbsd-static; do + sum=$(sha256sum "$cache/$name-0.12.2-r0.apk") + printf '%s\n' "${sum%% *}" >"$work/digests/$name" + done +} +reset_cache() { + cp "$work/good/"*.apk "$cache/" + reseal + : >"$work/verifications" +} +invoke() { + PATH="$work/bin:$PATH" sh "$adapter" "$src" "$work/bin/deps" "$work/lock" \ + "$cache" "$work/bin/apk" "$output" +} +snapshot() { + (cd "$output" && "$real_find" . -printf '%y %p %l\n' && + "$real_find" . -type f -exec sha256sum {} \;) | sort +} +check_preserved() { + snapshot >"$work/after" + cmp "$work/before" "$work/after" || fail 'failure changed the old root' + cmp "$work/before.files" "$output.files" || fail 'failure changed the old manifest' + [ -z "$("$real_find" "$(dirname "$output")" -maxdepth 1 -name '.root.new.*' -print)" ] || fail 'transaction leaked' +} +expect_failure() { + label=$1 + if invoke >"$work/failure.log" 2>&1; then fail "accepted $label"; fi + check_preserved +} + +reset_cache +invoke +[ "$(wc -l <"$work/verifications" | tr -d ' ')" = 3 ] || fail 'did not verify every package' +cmp "$src/resources/licenses/libbsd-LICENSE" "$output/usr/share/licenses/libbsd/LICENSE" +for library in libbsd.so libbsd.so.0 libbsd.so.0.12.2 libbsd.a; do + [ "$(readlink "$output/lib/$library")" = "../usr/lib/$library" ] || fail "bad compatibility link: $library" + test -s "$output/lib/$library" +done +[ "$(readlink "$output/usr/lib/libbsd.so.0")" = libbsd.so.0.12.2 ] || fail 'bad SONAME link' +[ ! -e "$output/lib/libbsd-ctor.a" ] || fail 'invented a ctor archive' +for path in usr/include/stdlib.h usr/include/sys/cdefs.h usr/include/linux/types.h usr/lib/libc.so usr/lib/libmd.a usr/lib/libbsd.la; do + [ ! -e "$output/$path" ] || fail "selected unrelated input: $path" +done +(cd "$output" && "$real_find" . ! -type d -print | sed 's@^./@@' | sort) >"$work/expected.files" +cmp "$work/expected.files" "$output.files" +grep -Fxq 'usr/include/bsd/nested/extra.h' "$output.files" +grep -Fxq '.complete' "$output.files" +if grep -F '/usr/lib/libbsd.so.0.12.2' "$output/usr/lib/libbsd.so"; then fail 'absolute linker-script path'; fi + +# Copy into shadow-style deps, merge the local libmd stage and move the tree. +combined=$work/deps\ before\ moving +relocated=$work/relocated +mkdir -p "$combined" +cp -a "$output/." "$combined/" +cp -a "$work/md/." "$combined/" +mv "$combined" "$relocated" +cat >"$work/consumer.c" <<'DATA' +#include +int main(void) { return fixture_bsd() != 17; } +DATA +"$cc" -I"$relocated/usr/include" "$work/consumer.c" -L"$relocated/lib" -L"$relocated/usr/lib" \ + -Wl,-rpath-link,"$relocated/lib" -lbsd -o "$work/dynamic" +LD_LIBRARY_PATH="$relocated/lib:$relocated/usr/lib" "$work/dynamic" +"$cc" -I"$relocated/usr/include" "$work/consumer.c" -L"$relocated/lib" -L"$relocated/usr/lib" \ + -Wl,-Bstatic -lbsd -lmd -Wl,-Bdynamic -o "$work/static" +"$work/static" +if "$cc" -I"$relocated/usr/include" "$work/consumer.c" -L"$relocated/lib" -L"$relocated/usr/lib" \ + -Wl,-Bstatic -lbsd -Wl,-Bdynamic -o "$work/no-md" >"$work/no-md.log" 2>&1; then + fail 'static fixture did not require local libmd.a' +fi +for package in libbsd libbsd-overlay; do + pc_flags=$(PKG_CONFIG_PATH='' PKG_CONFIG_LIBDIR="$relocated/usr/lib/pkgconfig" \ + PKG_CONFIG_SYSROOT_DIR="$relocated" pkg-config --cflags --libs --static "$package") + case $pc_flags in *"$relocated/usr/"*) ;; *) fail 'pkg-config lost relocated prefix';; esac + case $pc_flags in *"$output"*|*"$combined"*) fail 'pkg-config retained an old path';; esac +done + +snapshot >"$work/before" +cp "$output.files" "$work/before.files" +reset_cache +printf 'corruption\n' >>"$cache/libbsd-0.12.2-r0.apk" +expect_failure 'checksum mismatch' +[ ! -s "$work/verifications" ] || fail 'verification ran before checksum validation' +reset_cache +FAIL_VERIFY_AFTER=3 expect_failure 'invalid signature in final package' +reset_cache +rm "$cache/libbsd-static-0.12.2-r0.apk" +expect_failure 'missing offline cache' +reset_cache +BAD_URL=1 expect_failure 'unsafe locked URL' +BAD_DIGEST=1 expect_failure 'invalid locked digest' +FAIL_EXTRACT=1 expect_failure 'extraction failure' +FAIL_INVENTORY=1 expect_failure 'inventory generation failure' +for destination in "$output" "$output.files"; do + : >"$work/fail-once" + FAIL_PUBLISH_DEST=$destination expect_failure 'publication failure' +done + +cat >"$work/mutate.py" <<'PY' +import io +import pathlib +import sys +import tarfile + +work = pathlib.Path(sys.argv[1]) +mode = sys.argv[2] +name = 'libbsd-dev-0.12.2-r0.apk' +with tarfile.open(work / 'good' / name) as archive: + members = [(info, archive.extractfile(info).read() if info.isreg() else b'') for info in archive] +if mode == 'missing-header': + members = [(i, d) for i, d in members if i.name != 'usr/include/bsd/stdlib.h'] +elif mode == 'metadata': + for info, data in members: + if info.name == '.PKGINFO': + info.size = len(data.replace(b'0.12.2-r0', b'0.12.1-r0')) + members = [(i, d.replace(b'0.12.2-r0', b'0.12.1-r0') if i.name == '.PKGINFO' else d) for i, d in members] +elif mode == 'script': + members = [(i, d.replace(b'/usr/lib/', b'/tmp/bad/')) for i, d in members] +else: + paths = { + 'absolute': str(work / 'escaped'), + 'traversal': 'usr/include/bsd/../../../escaped', + 'dot': 'usr/include/bsd/./extra.h', + 'duplicate': 'usr/include/bsd/stdlib.h', + 'newline': 'usr/include/bsd/new\nline.h', + 'backslash': 'usr/include/bsd/back\\slash.h', + } + info = tarfile.TarInfo(paths.get(mode, 'usr/include/bsd/evil.h')) + data = b'bad input\n' + if mode in ('absolute-link', 'parent-link', 'dangling-link'): + info.type = tarfile.SYMTYPE + info.linkname = {'absolute-link': str(work / 'escaped'), 'parent-link': '../../../../escaped', 'dangling-link': 'missing.h'}[mode] + data = b'' + elif mode == 'hardlink': + info.type = tarfile.LNKTYPE + info.linkname = 'usr/include/bsd/stdlib.h' + data = b'' + elif mode == 'fifo': + info.type = tarfile.FIFOTYPE + data = b'' + info.size = len(data) + members.append((info, data)) +with tarfile.open(work / 'cache' / name, 'w:gz', format=tarfile.USTAR_FORMAT) as archive: + for info, data in members: + archive.addfile(info, io.BytesIO(data) if info.isreg() else None) +PY +for mode in missing-header metadata script absolute traversal dot duplicate newline backslash \ + absolute-link parent-link dangling-link hardlink fifo; do + reset_cache + python3 "$work/mutate.py" "$work" "$mode" + reseal + expect_failure "$mode archive" + [ ! -e "$work/escaped" ] || fail 'archive wrote outside staging' +done +reset_cache + +# Reject symlink destinations and preserve their targets, even if dangling. +mv "$output" "$work/saved-root" +ln -s "$work/saved-root" "$output" +if invoke >"$work/failure.log" 2>&1; then fail 'accepted symlink root'; fi +rm "$output" +mv "$work/saved-root" "$output" +mv "$output.files" "$work/saved-files" +ln -s "$work/missing-manifest" "$output.files" +if invoke >"$work/failure.log" 2>&1; then fail 'accepted symlink manifest'; fi +rm "$output.files" +mv "$work/saved-files" "$output.files" +check_preserved + +for rejected_output in "$src" "$cache" "$src/resources" "$src/system/rootfs" "$output/.."; do + if PATH="$work/bin:$PATH" sh "$adapter" "$src" "$work/bin/deps" "$work/lock" \ + "$cache" "$work/bin/apk" "$rejected_output" >"$work/failure.log" 2>&1; then + fail "accepted input overlap or aliased destination: $rejected_output" + fi +done +printf 'protected lock\n' >"$work/protected.files" +cp "$work/protected.files" "$work/protected.original" +if PATH="$work/bin:$PATH" sh "$adapter" "$src" "$work/bin/deps" "$work/protected.files" \ + "$cache" "$work/bin/apk" "$work/protected" >"$work/failure.log" 2>&1; then + fail 'accepted manifest/input overlap' +fi +grep -Fq 'manifest overlaps an input' "$work/failure.log" +cmp "$work/protected.original" "$work/protected.files" +check_preserved + +# A deleted non-primary header must invalidate the presence signature, then be +# restored by the next adapter run with the same complete manifest. +signature=$work/presence.sig +printf 'signature\n' >"$signature" +touch -t 200001010000 "$signature" +cp -p "$signature" "$work/original.sig" +sh "$repo/tools/build/upstream-verify.sh" "$output" "$output.files" "$signature" +[ "$signature" -ot "$output/.complete" ] || fail 'intact inventory changed signature' +rm "$output/usr/include/bsd/nested/extra.h" +sh "$repo/tools/build/upstream-verify.sh" "$output" "$output.files" "$signature" +[ "$signature" -nt "$work/original.sig" ] || fail 'deleted header did not invalidate signature' +invoke +test -s "$output/usr/include/bsd/nested/extra.h" +cmp "$work/before.files" "$output.files" + +# Also exercise invocation entirely through relative arguments. +(cd "$work" && PATH="$work/bin:$PATH" sh "$adapter" source bin/deps lock cache bin/apk relative-root) +test -s "$work/relative-root/lib/libbsd.so.0" +printf 'libbsd development: relocation, local-libmd linking, inventory recovery and failure safety passed\n' diff --git a/tests/integration/apk-base-migration.sh b/tests/integration/apk-base-migration.sh new file mode 100644 index 00000000..6237f105 --- /dev/null +++ b/tests/integration/apk-base-migration.sh @@ -0,0 +1,49 @@ +#!/bin/sh +# Run against a disposable signed root, on Linux or inside a ReliefOS guest. +# Formatting is restricted to regular files in a newly created private directory. +set -eu +PATH=/usr/sbin:/usr/bin:/sbin:/bin +export PATH +for package in libbsd libbsd-doc dosfstools dosfstools-doc e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc ca-certificates-bundle; do + apk info -e "$package" +done +test -s /etc/ssl/certs/ca-certificates.crt +apk info --who-owns /etc/ssl/certs/ca-certificates.crt | grep -F 'owned by ca-certificates-bundle-' +for entry in sbin/mkfs.ext4:e2fsprogs sbin/fsck.ext2:e2fsprogs sbin/mkfs.fat:dosfstools usr/lib/libbsd.so.0:libbsd usr/lib/libext2fs.so.2:e2fsprogs-libs; do + path=${entry%:*} owner=${entry#*:} + apk info --who-owns "/$path" | grep -F "owned by $owner-" +done +apk info --who-owns /lib/libmd.so.0 | grep -F 'owned by reliefos-auth-support-libraries-' +apk info --who-owns /usr/lib/libblkid.so.1 | grep -F 'owned by reliefos-storage-util-linux-' +apk info --who-owns /usr/lib/libuuid.so.1 | grep -F 'owned by reliefos-storage-util-linux-' +test ! -e /lib/libbsd.so.0 +test ! -e /usr/include/bsd +test ! -e /usr/include/ext2fs +test -s /usr/share/licenses/libbsd/COPYING +test -s /usr/share/licenses/e2fsprogs/NOTICE +test -s /usr/share/doc/dosfstools/COPYING +for command in mkfs.ext2 mkfs.ext3 mkfs.ext4 fsck.ext2 fsck.ext3 fsck.ext4 mkfs.fat fsck.fat mkfs.vfat fsck.vfat mkfs.msdos fsck.msdos mkfs.fat32 fsck.fat32 mke2fs e2fsck; do + test -x "/sbin/$command" + test "$(readlink "/usr/sbin/$command")" = "../../sbin/$command" +done +for command in chattr lsattr; do + test -x "/bin/$command" + test "$(readlink "/usr/bin/$command")" = "../../bin/$command" +done +work=$(mktemp -d /tmp/apk-base-migration.XXXXXX) +trap 'rm -rf "$work"' 0 +trap 'exit 130' HUP INT TERM +for filesystem in ext2 ext4; do + image=$work/$filesystem.img + truncate -s 64M "$image" + "/usr/sbin/mkfs.$filesystem" -F -q "$image" + test "$(blkid -p -s TYPE -o value "$image")" = "$filesystem" + "/usr/sbin/fsck.$filesystem" -fn "$image" +done +image=$work/fat.img +truncate -s 64M "$image" +/usr/sbin/mkfs.fat32 -F 32 -n APK_TEST "$image" +test "$(blkid -p -s TYPE -o value "$image")" = vfat +test "$(blkid -p -s LABEL -o value "$image")" = APK_TEST +/usr/sbin/fsck.vfat -n "$image" +printf '%s\n' 'PASS: official APK ownership, local dependencies, aliases and ext2/ext4/FAT format/check' diff --git a/tests/integration/upstream-incremental.sh b/tests/integration/upstream-incremental.sh index b6bcd825..52256a6a 100755 --- a/tests/integration/upstream-incremental.sh +++ b/tests/integration/upstream-incremental.sh @@ -8,9 +8,10 @@ out=$(CDPATH= cd -- "$out" && pwd) work=$(mktemp -d "$out/meta/upstream-incremental.XXXXXX") trap 'rm -rf "$work"' EXIT snapshot() { - for pkg in libmd libbsd util-linux sudo shadow e2fsprogs dosfstools exfatprogs ncurses; do + for pkg in libmd libbsd util-linux sudo shadow exfatprogs; do find "$out/upstream/$pkg/root" -type f -printf '%p %T@ %s\n' done + find "$out/upstream/apk" "$out/upstream/runtime-development" -type f -printf '%p %T@ %s\n' find "$out/userland" -type f -printf '%p %T@ %s\n' if [ -d "$out/resources" ]; then find "$out/resources" -type f -printf '%p %T@ %s\n'; fi } @@ -22,7 +23,9 @@ snapshot > "$work/after.unsorted" LC_ALL=C sort "$work/after.unsorted" > "$work/after" cmp "$work/before" "$work/after" # Exercise the complete install manifest, beyond the primary ELF outputs. -secondary=$out/upstream/dosfstools/root/usr/share/doc/dosfstools/README +set -- "$out/upstream/apk/packages/dosfstools-doc-"[0-9]*.apk +test "$#" = 1 +secondary=$1 test -f "$secondary" rm "$secondary" make -C "$src" O="$make_out" upstream-dosfstools -j8 > "$work/restore.log" 2>&1 || { cat "$work/restore.log" >&2; exit 1; } diff --git a/tests/integration/upstream-products.sh b/tests/integration/upstream-products.sh index 6662a3d7..4071e879 100755 --- a/tests/integration/upstream-products.sh +++ b/tests/integration/upstream-products.sh @@ -2,21 +2,23 @@ # Validate real freshly built ELF outputs (never execute target programs). set -eu root=${1:?usage: upstream-products.sh UPSTREAM_ROOT} -for entry in libmd/lib/libmd.so.0 libbsd/lib/libbsd.so.0 util-linux/bin/su util-linux/bin/mount util-linux/bin/lsblk util-linux/usr/sbin/fdisk sudo/usr/bin/sudo sudo/usr/lib/sudo/sudoers.so shadow/bin/login shadow/usr/sbin/useradd shadow/usr/sbin/usermod shadow/usr/sbin/userdel e2fsprogs/usr/sbin/mkfs.ext4 e2fsprogs/usr/sbin/fsck.ext4 e2fsprogs/usr/sbin/mkfs.ext2 e2fsprogs/usr/sbin/fsck.ext2 dosfstools/usr/sbin/mkfs.fat dosfstools/usr/sbin/fsck.fat exfatprogs/usr/sbin/mkfs.exfat exfatprogs/usr/sbin/fsck.exfat; do +apps=${2:-$root/../userland} +for entry in libmd/lib/libmd.so.0 libbsd/usr/lib/libbsd.so.0 util-linux/bin/su util-linux/bin/mount util-linux/bin/lsblk util-linux/usr/sbin/fdisk sudo/usr/bin/sudo sudo/usr/lib/sudo/sudoers.so shadow/bin/login shadow/usr/sbin/useradd shadow/usr/sbin/usermod shadow/usr/sbin/userdel exfatprogs/usr/sbin/mkfs.exfat exfatprogs/usr/sbin/fsck.exfat; do pkg=${entry%%/*}; path=$root/$pkg/root/${entry#*/} test -f "$path" readelf -h "$path" | grep -q 'Advanced Micro Devices X86-64' - case $pkg in e2fsprogs|dosfstools|exfatprogs) + case $pkg in exfatprogs) if readelf -l -d "$path" | grep -E 'INTERP|\(NEEDED\)'; then echo "not static: $path" >&2; exit 1; fi ;; esac done -for archive in libncursesw.a libtinfow.a; do - test -s "$root/ncurses/root/usr/lib/$archive" - ar t "$root/ncurses/root/usr/lib/$archive" | grep -q '\.o$' +src=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) +for package in libbsd libbsd-doc dosfstools dosfstools-doc e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc ncurses ncurses-terminfo; do + set -- "$root/apk/packages/$package-"[0-9]*.apk + test "$#" = 1 && test -s "$1" + "$root/apk/apk.static" --keys-dir "$src/system/rootfs/etc/apk/keys" verify "$1" done "$root/apk/apk.static" --version printf '%s\n' 'upstream production ELF/archive checks: PASS' -apps=${2:-$root/userland} for app in busybox pleditor; do test -f "$apps/$app.elf" readelf -h "$apps/$app.elf" | grep -q 'Advanced Micro Devices X86-64' @@ -26,7 +28,6 @@ development=$root/runtime-development/usr/lib for library in libsqlite3.so.0 libz.so.1 libpng16.so.16 libmbedtls.so.21 libmbedx509.so.7 libmbedcrypto.so.16; do readelf -d "$development/$library" | grep -q '(SONAME)' done -src=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) sh "$src/tools/build/busybox-check.sh" "$root/busybox/build/.config" "$apps/busybox.links" if readelf -l -d "$apps/busybox.elf" | grep -E 'INTERP|\(NEEDED\)'; then echo "BusyBox is not static: $apps/busybox.elf" >&2; exit 1 diff --git a/tools/build/apk-stage.sh b/tools/build/apk-stage.sh index 86710b38..54cc4085 100644 --- a/tools/build/apk-stage.sh +++ b/tools/build/apk-stage.sh @@ -287,7 +287,7 @@ version=$(printf '%s' "$version" | sed "s/-r[0-9]*$/.${content_number}-r0/") package_name() { - case $1 in reliefos-*|ca-certificates-bundle) printf '%s\n' "$1";; *) printf 'reliefos-%s\n' "$1";; esac + case $1 in reliefos-*) printf '%s\n' "$1";; *) printf 'reliefos-%s\n' "$1";; esac } # Copy exactly the classified payload. Quoting and tab-delimited reads preserve @@ -335,6 +335,12 @@ while IFS= read -r group; do done done <"$scratch/groups" LC_ALL=C sort -u "$scratch/providers" -o "$scratch/providers" +if awk -F '\t' 'FILENAME == ARGV[1] {upstream[$0]=1; next} $1 in upstream {print $0}' \ + "$scratch/upstream-sonames" "$scratch/providers" | grep . >"$scratch/overlapping-sonames"; then + echo 'local payload duplicates an official APK SONAME; remove the obsolete overlay:' >&2 + cat "$scratch/overlapping-sonames" >&2 + exit 1 +fi if cut -f1 "$scratch/providers" | uniq -d | grep . >"$scratch/duplicate-sonames"; then echo 'multiple local APK providers for ELF SONAME:' >&2 cat "$scratch/duplicate-sonames" >&2 @@ -367,7 +373,15 @@ while IFS= read -r group; do fi provides=$(awk -F '\t' -v package="$package" '$2 == package { printf " so:%s=0", $1 }' "$scratch/providers") if [ "$package" = reliefos-musl ] && [ -f "$tree/lib/ld-musl-x86_64.so.1" ]; then - provides="$provides so:libc.musl-x86_64.so.1=1" + # libbsd also requires the musl package by name. This package owns the + # real musl loader/libc; report its verified upstream version rather + # than the independent ReliefOS package generation. + musl_version=$("$deps" --lock "$lock" --id musl --print version) + case $musl_version in ''|*[!0-9.]*) echo 'invalid locked musl version' >&2; exit 1;; esac + cmp -s "$tree/lib/ld-musl-x86_64.so.1" "$tree/lib/libc.so" || { echo 'musl loader/libc mismatch' >&2; exit 1; } + "$tree/lib/ld-musl-x86_64.so.1" --version >"$scratch/musl-version" 2>&1 || : + grep -Fxq "Version $musl_version" "$scratch/musl-version" || { echo 'musl binary version differs from lock' >&2; exit 1; } + provides="$provides musl=$musl_version-r0 so:libc.musl-x86_64.so.1=1" fi if [ "$package" = reliefos-busybox ] && [ -x "$tree/bin/busybox" ] && [ -e "$tree/bin/sh" ]; then for applet in init ifup ifdown udhcpc ntpd; do @@ -381,8 +395,19 @@ while IFS= read -r group; do reliefos-apk-tools) dependencies="$dependencies reliefos-busybox" ;; reliefos-busybox) dependencies="$dependencies reliefos-coreutils" ;; reliefos-coreutils) dependencies="$dependencies !coreutils !coreutils-single" ;; + # These local groups retain libmd/exFAT and compatibility aliases. + # Their real dependencies pull the migrated tools into older systems + # in the same signed transaction that upgrades the former file owner. + reliefos-auth-support-libraries) dependencies="$dependencies libbsd libbsd-doc" ;; + reliefos-storage-filesystems) dependencies="$dependencies e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc dosfstools dosfstools-doc" ;; reliefos-kernel) dependencies="$dependencies reliefos-grub=$version" ;; - reliefos-trust) dependencies="$dependencies ca-certificates-bundle" ;; + # Upgrade old console images whose former local CA package contained + # only a directory. Require the real pinned release or a newer bundle, + # while allowing administrators to install future security updates. + reliefos-trust) + ca_version=$("$deps" --lock "$lock" --id alpine-ca-certificates-bundle --print version) + dependencies="$dependencies ca-certificates-bundle>=$ca_version" + ;; reliefos-fastfetch) dependencies="$dependencies !fastfetch" ;; reliefos-xdm-config) # The local server command uses the ReliefOS tty wrapper and Xorg diff --git a/tools/build/libbsd-development.sh b/tools/build/libbsd-development.sh new file mode 100755 index 00000000..0082fcb1 --- /dev/null +++ b/tools/build/libbsd-development.sh @@ -0,0 +1,188 @@ +#!/bin/sh +# Offline, build-only libbsd root. Never overlay this root on the guest/sysroot. +set -eu +LC_ALL=C +export LC_ALL +die() { printf 'libbsd-development: %s\n' "$*" >&2; exit 1; } +[ "$#" = 6 ] || { printf 'usage: libbsd-development.sh SRC DEPS LOCK CACHE APK ROOT\n' >&2; exit 2; } +src=$(CDPATH='' cd -- "$1" && pwd -P) +deps=$(CDPATH='' cd -- "$(dirname "$2")" && pwd -P)/$(basename "$2") +lock=$(CDPATH='' cd -- "$(dirname "$3")" && pwd -P)/$(basename "$3") +cache=$(CDPATH='' cd -- "$4" && pwd -P) +apk=$(CDPATH='' cd -- "$(dirname "$5")" && pwd -P)/$(basename "$5") +root_name=$(basename "$6") +case $root_name in ''|.|..|/) die 'expected a dedicated output directory';; esac +mkdir -p "$(dirname "$6")" +root_parent=$(CDPATH='' cd -- "$(dirname "$6")" && pwd -P) +root=$root_parent/$root_name +for input in "$src" "$deps" "$lock" "$cache" "$apk" \ + "$src/resources/licenses/libbsd-LICENSE" "$src/system/rootfs/etc/apk/keys"; do + case $input in "$root"|"$root"/*) die "output overlaps an input: $input";; esac + [ "$input" != "$root.files" ] || die "manifest overlaps an input: $input" +done +case $root in "$cache"/*) die 'output is inside the download cache';; esac +if [ -L "$root" ] || { [ -e "$root" ] && [ ! -d "$root" ]; }; then + die "development root is not a real directory: $root" +fi +if [ -L "$root.files" ] || { [ -e "$root.files" ] && [ ! -f "$root.files" ]; }; then + die "manifest is not a regular file: $root.files" +fi +[ -s "$src/resources/licenses/libbsd-LICENSE" ] || die 'missing libbsd license resource' + +transaction=$(mktemp -d "$root_parent/.${root_name}.new.XXXXXX") +stage=$transaction/root +installed=no +manifest_installed=no +committed=no +cleanup() { + status=$? + trap - 0 HUP INT TERM + if [ "$committed" = no ]; then + if [ "$manifest_installed" = yes ]; then rm -f "$root.files" || status=1; fi + if [ "$installed" = yes ]; then rm -rf "$root" || status=1; fi + if [ -e "$transaction/previous-root" ]; then + mv "$transaction/previous-root" "$root" || status=1 + fi + if [ -e "$transaction/previous-files" ]; then + mv "$transaction/previous-files" "$root.files" || status=1 + fi + fi + # Preserve the backup if restoring it failed. + if [ -e "$transaction/previous-root" ] || [ -e "$transaction/previous-files" ]; then + if [ "$committed" = no ]; then + printf 'libbsd-development: retained backup: %s\n' "$transaction" >&2 + exit 1 + fi + fi + rm -rf "$transaction" || status=1 + exit "$status" +} +trap cleanup 0 +trap 'exit 130' HUP INT TERM +mkdir -p "$stage/usr/share/reliefos/sdk/apk" + +for id in alpine-libbsd runtime-dev-libbsd-dev runtime-dev-libbsd-static; do + case $id in + alpine-libbsd) package=libbsd;; + runtime-dev-libbsd-dev) package=libbsd-dev;; + runtime-dev-libbsd-static) package=libbsd-static;; + esac + url=$("$deps" --lock "$lock" --id "$id" --print url) + digest=$("$deps" --lock "$lock" --id "$id" --print sha256) + [ "$url" = "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/$package-0.12.2-r0.apk" ] || die "unexpected locked URL for $id" + [ "${#digest}" = 64 ] || die "invalid locked digest for $id" + case $digest in *[!0-9a-f]*) die "invalid locked digest for $id";; esac + archive=$cache/${url##*/} + [ -f "$archive" ] || die "missing $archive; run make fetch" + # Snapshot the original bytes before verification to avoid cache races. + cp "$archive" "$transaction/input.apk" + archive=$transaction/input.apk + actual=$(sha256sum "$archive") + [ "${actual%% *}" = "$digest" ] || die "checksum mismatch: $id" + "$apk" --keys-dir "$src/system/rootfs/etc/apk/keys" verify "$archive" + + # GNU tar escapes unusual names. Reject those, aliases, duplicate members, + # hardlinks and special files before writing even a selected payload file. + tar --ignore-zeros --warning=no-unknown-keyword --numeric-owner \ + --quoting-style=escape -tvzf "$archive" >"$transaction/list" + awk ' + function safe(path, n,a,i) { + if (path !~ /^[A-Za-z0-9_+@.\/-]+$/ || path ~ /^\//) return 0 + n=split(path,a,"/") + for (i=1;i<=n;i++) if (a[i]=="" || a[i]=="." || a[i]=="..") return 0 + return 1 + } + { + type=substr($1,1,1); name=$6 + if (type=="d") sub(/\/$/,"",name) + if (!safe(name) || seen[name]++ || (type!="-" && type!="d" && type!="l")) exit 1 + if (type=="l") { + # Official libbsd links only to a sibling, never an ancestor. + if (NF!=8 || $7!="->" || $8 !~ /^[A-Za-z0-9_+@.-]+$/ || $8=="." || $8=="..") exit 1 + } else if (NF!=6) exit 1 + print type, name, (type=="l" ? $8 : "-") + count++ + } + END {if (!count) exit 1} + ' "$transaction/list" >"$transaction/members" || die "unsafe archive members: $id" + + while read -r type member target; do + [ "$type" != d ] || continue + selected=no + case $id:$member in + *:.PKGINFO) selected=yes; destination=usr/share/reliefos/sdk/apk/$id.PKGINFO;; + alpine-libbsd:usr/lib/libbsd.so.0|alpine-libbsd:usr/lib/libbsd.so.0.12.2|\ + runtime-dev-libbsd-dev:usr/include/bsd/*|runtime-dev-libbsd-dev:usr/lib/libbsd.so|\ + runtime-dev-libbsd-dev:usr/lib/pkgconfig/libbsd.pc|runtime-dev-libbsd-dev:usr/lib/pkgconfig/libbsd-overlay.pc|\ + runtime-dev-libbsd-static:usr/lib/libbsd.a) selected=yes; destination=$member;; + esac + [ "$selected" = yes ] || continue + [ ! -e "$stage/$destination" ] && [ ! -L "$stage/$destination" ] || die "duplicate product: $destination" + mkdir -p "$stage/$(dirname "$destination")" + if [ "$type" = l ]; then + [ "$id:$member:$target" = 'alpine-libbsd:usr/lib/libbsd.so.0:libbsd.so.0.12.2' ] || die "unexpected product symlink: $member" + ln -s "$target" "$stage/$destination" + else + # Stdout extraction cannot follow archive links or apply owners, + # modes, devices or directory metadata from the input archive. + tar --ignore-zeros --warning=no-unknown-keyword --occurrence=1 \ + -xOzf "$archive" -- "$member" >"$stage/$destination" + fi + done <"$transaction/members" + awk -v package="$package" ' + $0=="pkgname = "package {name++} + /^pkgname = / {names++} + $0=="pkgver = 0.12.2-r0" {version++} + /^pkgver = / {versions++} + $0=="arch = x86_64" {arch++} + /^arch = / {arches++} + END {exit !(name==1 && names==1 && version==1 && versions==1 && arch==1 && arches==1)} + ' "$stage/usr/share/reliefos/sdk/apk/$id.PKGINFO" || die "unexpected package metadata: $id" +done + +for product in usr/include/bsd/stdlib.h usr/include/bsd/string.h usr/include/bsd/unistd.h \ + usr/include/bsd/sys/queue.h usr/lib/libbsd.so.0 usr/lib/libbsd.so.0.12.2 \ + usr/lib/libbsd.so usr/lib/libbsd.a usr/lib/pkgconfig/libbsd.pc usr/lib/pkgconfig/libbsd-overlay.pc; do + [ -s "$stage/$product" ] || die "missing product: $product" +done +[ -L "$stage/usr/lib/libbsd.so.0" ] || die 'missing runtime SONAME symlink' + +# This pinned development APK contains a linker script, not a .so symlink. +# Check the complete input before removing its absolute target-library path. +cat >"$transaction/linker-script" <<'DATA' +/* GNU ld script + * The MD5 functions are provided by the libmd library. */ +OUTPUT_FORMAT(elf64-x86-64) +GROUP(/usr/lib/libbsd.so.0.12.2 AS_NEEDED(-lmd)) +DATA +cmp -s "$transaction/linker-script" "$stage/usr/lib/libbsd.so" || die 'unexpected libbsd linker script' +sed 's@GROUP(/usr/lib/@GROUP(@' "$transaction/linker-script" >"$stage/usr/lib/libbsd.so" +for pc in libbsd libbsd-overlay; do + [ "$(sed -n '/^prefix=/p' "$stage/usr/lib/pkgconfig/$pc.pc")" = 'prefix=/usr' ] || die "unexpected $pc.pc prefix" + # Keep pcfiledir literal: pkg-config expands it at the relocated destination. + # shellcheck disable=SC2016 + sed 's@^prefix=/usr$@prefix=${pcfiledir}/../..@' "$stage/usr/lib/pkgconfig/$pc.pc" >"$transaction/pc" + mv "$transaction/pc" "$stage/usr/lib/pkgconfig/$pc.pc" +done + +# Consumers search both deps/lib and deps/usr/lib. All aliases stay within this +# build root, including after it is copied beside the local libmd 1.3.0 stage. +# Alpine does not ship libbsd-ctor.a; do not invent an empty archive for it. +mkdir -p "$stage/lib" "$stage/usr/share/licenses/libbsd" +for library in libbsd.so libbsd.so.0 libbsd.so.0.12.2 libbsd.a; do + ln -s "../usr/lib/$library" "$stage/lib/$library" +done +cp "$src/resources/licenses/libbsd-LICENSE" "$stage/usr/share/licenses/libbsd/LICENSE" +printf '%s\n' 'libbsd 0.12.2-r0 build-only' >"$stage/.complete" +(cd "$stage" && find . ! -type d -print) >"$transaction/paths" +sed 's@^./@@' "$transaction/paths" >"$transaction/relative-paths" +sort "$transaction/relative-paths" >"$transaction/root.files" + +# Prepare both artifacts before publication, and roll back both on any failure. +if [ -e "$root" ]; then mv "$root" "$transaction/previous-root"; fi +if [ -e "$root.files" ]; then mv "$root.files" "$transaction/previous-files"; fi +installed=yes +mv "$stage" "$root" +manifest_installed=yes +mv "$transaction/root.files" "$root.files" +committed=yes diff --git a/tools/build/rootfs-stage.sh b/tools/build/rootfs-stage.sh index b6597ed5..5f312c5f 100644 --- a/tools/build/rootfs-stage.sh +++ b/tools/build/rootfs-stage.sh @@ -19,7 +19,7 @@ link() { record l "$2" "/$1" 0777 "${3:-reliefos-base}" "${4:-unique}"; } enabled() { awk -F '\t' -v id="$1" '$1==id && $4==1 {found=1} END {exit !found}' "$metadata"; } # Every enabled upstream root is passed by the build graph. The default keeps # standalone callers compatible with the complete product package set. -rootfs_upstream_packages=${ROOTFS_UPSTREAM_PACKAGES:-'libmd libbsd util-linux sudo shadow e2fsprogs dosfstools exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg'} +rootfs_upstream_packages=${ROOTFS_UPSTREAM_PACKAGES:-'libmd util-linux sudo shadow exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg'} for package in $rootfs_upstream_packages; do if [ "$package" = ffmpeg ]; then if enabled reliefplayer; then @@ -35,6 +35,10 @@ for package in $rootfs_upstream_packages; do continue fi case $package in + libbsd|e2fsprogs|dosfstools) + echo "rootfs-stage: $package is supplied by official APKs; remove its local overlay" >&2 + exit 1 + ;; ''|*[!A-Za-z0-9._-]*) echo "rootfs-stage: invalid upstream package id: $package" >&2 exit 2 @@ -252,6 +256,8 @@ file "$work/data/apk-components" etc/reliefos/apk-components for library in zlib libpng mbedtls3; do file "$src/resources/licenses/$library-LICENSE" "usr/share/licenses/reliefos-runtime-dependencies/$library-LICENSE" done +file "$src/resources/licenses/libbsd-LICENSE" usr/share/licenses/libbsd/COPYING +file "$src/resources/licenses/e2fsprogs-NOTICE" usr/share/licenses/e2fsprogs/NOTICE for name in simsun.ttc system.psf; do file "$src/system/fonts/$name" "usr/share/fonts/reliefos/$name"; done file "$src/system/fonts/times.ttf" usr/share/fonts/reliefos/times-new-roman.ttf @@ -262,13 +268,20 @@ for app in leonmmcoset xiaobai; do done # Compatibility links are explicit overrides of upstream aliases. link usr/bin/su ../../bin/su authentication override -for command in fdisk sfdisk runuser fsck blkid mkfs.ext4 fsck.ext4 mkfs.ext2 fsck.ext2 mkfs.fat fsck.fat mkfs.exfat fsck.exfat leonos-grub-installer; do link "sbin/$command" "../usr/sbin/$command" storage override; done +for command in fdisk sfdisk runuser fsck blkid mkfs.exfat fsck.exfat leonos-grub-installer; do link "sbin/$command" "../usr/sbin/$command" storage override; done link sbin/umount ../bin/umount storage override +# Official filesystem APKs own /sbin. Preserve older /usr/sbin callers with +# one-way aliases, without replacing the official executables or their links. +for command in e2fsck mke2fs dosfsck dosfslabel fatlabel mkdosfs; do + link "usr/sbin/$command" "../../sbin/$command" storage +done +for command in chattr lsattr; do link "usr/bin/$command" "../../bin/$command" storage; done for verb in mkfs fsck; do - for suffix in vfat fat32; do - link "usr/sbin/$verb.$suffix" "$verb.fat" storage override - link "sbin/$verb.$suffix" "../usr/sbin/$verb.$suffix" storage override + for suffix in ext2 ext3 ext4 fat vfat msdos; do + link "usr/sbin/$verb.$suffix" "../../sbin/$verb.$suffix" storage done + link "sbin/$verb.fat32" "$verb.fat" storage + link "usr/sbin/$verb.fat32" "../../sbin/$verb.fat32" storage done if enabled busybox; then file "$out/userland/busybox.elf" bin/busybox 0755 busybox diff --git a/tools/build/upstream.sh b/tools/build/upstream.sh index de5172cf..b63d451f 100755 --- a/tools/build/upstream.sh +++ b/tools/build/upstream.sh @@ -33,7 +33,7 @@ if [ "$pkg" = coreutils ]; then fi resource=$("$cc" -print-resource-dir) CC="$cc --target=$target --sysroot=$musl --gcc-toolchain=/nonexistent -fuse-ld=lld --rtlib=compiler-rt --unwindlib=none -nostdinc -isystem $musl/include -isystem $resource/include -idirafter $auth/usr/include -L$musl/lib" -case $pkg in libbsd|shadow) CC="$cc --target=$target --sysroot=$musl --gcc-toolchain=/nonexistent -fuse-ld=lld --rtlib=compiler-rt --unwindlib=none -nostdinc -idirafter $musl/include -isystem $resource/include -idirafter $auth/usr/include -L$musl/lib" ;; esac +case $pkg in shadow) CC="$cc --target=$target --sysroot=$musl --gcc-toolchain=/nonexistent -fuse-ld=lld --rtlib=compiler-rt --unwindlib=none -nostdinc -idirafter $musl/include -isystem $resource/include -idirafter $auth/usr/include -L$musl/lib" ;; esac AR=llvm-ar RANLIB=llvm-ranlib STRIP=llvm-strip BUILD_CC=cc CFLAGS='-O2 -std=gnu17 -mno-avx -mno-avx2' CPPFLAGS="-I$auth/usr/include -I$pam/usr/include" @@ -42,7 +42,7 @@ LIBS= PKG_CONFIG_PATH= PKG_CONFIG_LIBDIR="$auth/lib/pkgconfig:$auth/usr/lib/pkgc export CC AR RANLIB STRIP BUILD_CC CFLAGS CPPFLAGS LDFLAGS LIBS PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR set -- --host="$target" --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib case $pkg in -libmd|libbsd) set -- "$@" --libdir=/lib ;; +libmd) set -- "$@" --libdir=/lib ;; sudo) set -- "$@" --with-pam --with-pam-login --with-secure-path=/usr/sbin:/usr/bin:/sbin:/bin --with-rundir=/run/sudo --with-vardir=/var/lib/sudo --libexecdir=/usr/lib ;; shadow) set -- "$@" --bindir=/bin --sbindir=/sbin --with-libpam --with-yescrypt --without-su --disable-logind ;; util-linux) CPPFLAGS="$CPPFLAGS -include linux/openat2.h"; export CPPFLAGS @@ -55,9 +55,6 @@ util-linux) CPPFLAGS="$CPPFLAGS -include linux/openat2.h"; export CPPFLAGS ' "$source/misc-utils/lsblk-properties.c" > "$source/misc-utils/lsblk-properties.c.new" mv "$source/misc-utils/lsblk-properties.c.new" "$source/misc-utils/lsblk-properties.c" set -- "$@" --sbindir=/usr/sbin --disable-all-programs --enable-su --enable-runuser --enable-libuuid --enable-libfdisk --enable-libsmartcols --enable-fdisks=check --enable-libblkid --enable-libmount --enable-mount --enable-blkid --enable-lsblk --enable-fsck --without-python --without-systemd --without-systemdsystemunitdir --disable-makeinstall-chown ;; -e2fsprogs) LDFLAGS="-static -L$auth/usr/lib"; export LDFLAGS - set -- "$@" --sbindir=/usr/sbin --with-root-prefix=/usr --disable-libuuid --disable-libblkid --disable-elf-shlibs --disable-fsck --disable-uuidd --disable-nls --disable-fuse2fs --without-libarchive --with-udev-rules-dir=no --with-systemd-unit-dir=no --with-crond-dir=no ;; -dosfstools) LDFLAGS="-static -L$auth/usr/lib"; export LDFLAGS; set -- "$@" --sbindir=/usr/sbin --enable-compat-symlinks ;; exfatprogs) LDFLAGS="-static -L$auth/usr/lib"; export LDFLAGS; set -- "$@" --sbindir=/usr/sbin --disable-shared --enable-static ;; coreutils) # The optional dispatched CRC backend pulls compiler-rt's precompiled @@ -98,7 +95,6 @@ if [ "$pkg" = alsa-lib ]; then rm "$tmp/usr/lib/libasound.la" "$tmp/usr/lib/libatopology.la" fi case $pkg in -libbsd) sed 's@GROUP(/lib/@GROUP(@' "$tmp/lib/libbsd.so" > "$tmp/lib/libbsd.so.new"; mv "$tmp/lib/libbsd.so.new" "$tmp/lib/libbsd.so"; rm "$tmp/lib/libbsd.la" ;; libmd) rm "$tmp/lib/libmd.la" ;; coreutils) sh "$source/build-aux/gen-lists-of-programs.sh" --list-progs > "$work/upstream-programs" diff --git a/tools/storage_tools.py b/tools/storage_tools.py index 78df4d7c..95d61a44 100644 --- a/tools/storage_tools.py +++ b/tools/storage_tools.py @@ -3,20 +3,27 @@ import shutil FORMATTER_COMMANDS = tuple(f"usr/sbin/{verb}.{fs}" - for fs in ("ext2", "fat", "exfat") for verb in ("mkfs", "fsck")) + for fs in ("ext2", "ext4", "fat", "exfat") for verb in ("mkfs", "fsck")) UTIL_LINUX_COMMANDS = ("usr/sbin/fdisk", "usr/sbin/sfdisk", "usr/sbin/runuser", "usr/sbin/fsck", "usr/sbin/blkid", "bin/mount", "bin/umount", "bin/lsblk") UTIL_LINUX_LIBRARIES = tuple(f"usr/lib/lib{name}.so.1" for name in ("fdisk", "smartcols", "uuid", "blkid", "mount")) COMPAT_LINKS = {"sbin/" + Path(path).name: "../" + path - for path in (*FORMATTER_COMMANDS, *UTIL_LINUX_COMMANDS) if path.startswith("usr/sbin/")} -COMPAT_LINKS.update({"sbin/umount": "../bin/umount", "usr/sbin/mkfs.vfat": "mkfs.fat", - "usr/sbin/mkfs.fat32": "mkfs.fat", "usr/sbin/fsck.vfat": "fsck.fat", - "usr/sbin/fsck.fat32": "fsck.fat", + for path in UTIL_LINUX_COMMANDS if path.startswith("usr/sbin/")} +COMPAT_LINKS.update({"sbin/umount": "../bin/umount", "sbin/leonos-grub-installer": "../usr/sbin/leonos-grub-installer"}) -for name in ("mkfs.fat32", "mkfs.vfat", "fsck.fat32", "fsck.vfat"): - COMPAT_LINKS[f"sbin/{name}"] = f"../usr/sbin/{name}" +for verb in ("mkfs", "fsck"): + COMPAT_LINKS[f"sbin/{verb}.exfat"] = f"../usr/sbin/{verb}.exfat" + for filesystem in ("ext2", "ext3", "ext4", "fat", "vfat", "msdos"): + name = f"{verb}.{filesystem}" + COMPAT_LINKS[f"usr/sbin/{name}"] = f"../../sbin/{name}" + COMPAT_LINKS[f"sbin/{verb}.fat32"] = f"{verb}.fat" + COMPAT_LINKS[f"usr/sbin/{verb}.fat32"] = f"../../sbin/{verb}.fat32" +for name in ("e2fsck", "mke2fs", "dosfsck", "dosfslabel", "fatlabel", "mkdosfs"): + COMPAT_LINKS[f"usr/sbin/{name}"] = f"../../sbin/{name}" +for name in ("chattr", "lsattr"): + COMPAT_LINKS[f"usr/bin/{name}"] = f"../../bin/{name}" def stage_filesystems(source: Path, destination: Path) -> None: diff --git a/tools/test_installer_accounts_qemu.py b/tools/test_installer_accounts_qemu.py index 74988e42..23cee61b 100644 --- a/tools/test_installer_accounts_qemu.py +++ b/tools/test_installer_accounts_qemu.py @@ -64,7 +64,7 @@ def key(self, key): def text(self, text): punctuation = {";": "semicolon", "(": "shift-9", ")": "shift-0", - ">": "shift-dot", "$": "shift-4", "?": "shift-slash", + "<": "shift-comma", ">": "shift-dot", "$": "shift-4", "?": "shift-slash", "'": "apostrophe", '"': "shift-apostrophe", "!": "shift-1"} for character in text: self.key(punctuation.get(character, text_keys(character)[0])) diff --git a/tools/test_installer_update_packages.py b/tools/test_installer_update_packages.py index bb7d43c7..c8d41593 100644 --- a/tools/test_installer_update_packages.py +++ b/tools/test_installer_update_packages.py @@ -75,10 +75,18 @@ def apk(cls, *arguments): check=True, capture_output=True, text=True) @classmethod - def package(cls, name, version, repository, dependencies=()): + def package(cls, name, version, repository, dependencies=(), payload=None, symlinks=None): files = cls.work / (name + "-" + version) (files / "usr/share" / name).mkdir(parents=True, exist_ok=True) (files / "usr/share" / name / "version").write_text(version + "\n") + for relative, text in (payload or {}).items(): + path = files / relative + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(text) + for relative, destination in (symlinks or {}).items(): + path = files / relative + path.parent.mkdir(parents=True, exist_ok=True) + path.symlink_to(destination) arguments = ["mkpkg", "--files", files, "--output", cls.base / repository / (name + "-" + version + ".apk"), "--info", "name:" + name, "--info", "version:" + version, @@ -174,6 +182,81 @@ def test_apply_and_retry_preserve_user_files_world_and_repository_access(self): self.assertEqual((target / "usr/share/reliefos-fixture/version").read_text(), "2.0-r0\n") self.assertFalse((target / "run/reliefos-kernel-activation.defer").exists()) + def test_filesystem_and_bsd_split_transfers_owners_and_preserves_configuration(self): + old, new = self.runner / "oldrepo", self.runner / "newrepo" + target = self.runner / "target" + self.package("reliefos-auth-support-libraries", "4.0-r0", old, payload={ + "lib/libbsd.so.0": "old BSD library\n", "lib/libmd.so.0": "local MD library\n"}) + self.package("reliefos-storage-filesystems", "4.0-r0", old, payload={ + "usr/sbin/mkfs.ext4": "old formatter\n", "usr/sbin/mkfs.exfat": "local exFAT\n"}, + symlinks={"sbin/mkfs.ext4": "../usr/sbin/mkfs.ext4"}) + # Older rootfs fallback ownership also put configuration and extra + # tools in base; all old owners must join the same normal upgrade. + self.package("reliefos-base", "4.0-r0", old, payload={ + "usr/lib/libext2fs.so.2": "old ext library\n", "etc/mke2fs.conf": "old defaults\n"}) + self.package("reliefos-base", "5.0-r0", new) + self.package("libbsd", "0.12.2-r0", new, payload={"usr/lib/libbsd.so.0": "official BSD library\n"}) + self.package("e2fsprogs", "1.47.4-r0", new, payload={ + "sbin/mkfs.ext4": "official formatter\n", "usr/lib/libext2fs.so.2": "official ext library\n", + "etc/mke2fs.conf": "new defaults\n"}) + self.package("reliefos-auth-support-libraries", "5.0-r0", new, ["libbsd"], + payload={"lib/libmd.so.0": "local MD library\n"}) + self.package("reliefos-storage-filesystems", "5.0-r0", new, ["e2fsprogs"], + payload={"usr/sbin/mkfs.exfat": "local exFAT\n"}, + symlinks={"usr/sbin/mkfs.ext4": "../../sbin/mkfs.ext4"}) + self.index(old) + self.index(new) + repositories = self.runner / "old.repositories" + repositories.write_text("ndx " + str(old / "packages.adb") + "\n") + self.apk("--root", target, "--repositories-file", repositories, + "--no-network", "--no-scripts", "add", "reliefos-auth-support-libraries", + "reliefos-storage-filesystems", "reliefos-base") + (target / "etc/mke2fs.conf").write_text("administrator defaults\n") + checked = self.check() + self.assertEqual(checked.returncode, 0, checked.stdout + checked.stderr) + for _ in range(2): + result = self.transaction("--apply") + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertFalse((target / "lib/libbsd.so.0").exists()) + self.assertEqual((target / "sbin/mkfs.ext4").read_text(), "official formatter\n") + self.assertFalse((target / "sbin/mkfs.ext4").is_symlink()) + self.assertEqual(os.readlink(target / "usr/sbin/mkfs.ext4"), "../../sbin/mkfs.ext4") + self.assertEqual((target / "etc/mke2fs.conf").read_text(), "administrator defaults\n") + self.assertEqual((target / "lib/libmd.so.0").read_text(), "local MD library\n") + self.assertEqual((target / "usr/sbin/mkfs.exfat").read_text(), "local exFAT\n") + for path, owner in (("sbin/mkfs.ext4", "e2fsprogs"), + ("usr/lib/libext2fs.so.2", "e2fsprogs"), + ("usr/lib/libbsd.so.0", "libbsd")): + output = self.apk("--root", target, "info", "--who-owns", "/" + path).stdout + self.assertIn("owned by " + owner + "-", output) + + def test_old_console_ca_placeholder_is_replaced_by_real_bundle(self): + old, new = self.runner / "oldrepo", self.runner / "newrepo" + target = self.runner / "target" + self.package("ca-certificates-bundle", "4.0-r0", old) + self.package("reliefos-trust", "4.0-r0", old, ["ca-certificates-bundle"]) + self.package("ca-certificates-bundle", "20261020-r0", new, payload={ + "etc/ssl/certs/ca-certificates.crt": "official bundle fixture\n"}) + self.package("reliefos-trust", "5.0-r0", new, + ["ca-certificates-bundle>=20261020-r0"]) + self.index(old) + self.index(new) + repositories = self.runner / "old.repositories" + repositories.write_text("ndx " + str(old / "packages.adb") + "\n") + self.apk("--root", target, "--repositories-file", repositories, + "--no-network", "--no-scripts", "add", "reliefos-trust") + self.assertFalse((target / "etc/ssl/certs/ca-certificates.crt").exists()) + checked = self.check() + self.assertEqual(checked.returncode, 0, checked.stdout + checked.stderr) + for _ in range(2): + result = self.transaction("--apply") + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual((target / "etc/ssl/certs/ca-certificates.crt").read_text(), + "official bundle fixture\n") + owner = self.apk("--root", target, "info", "--who-owns", + "/etc/ssl/certs/ca-certificates.crt").stdout + self.assertIn("owned by ca-certificates-bundle-20261020-r0", owner) + def cache_events(self, result): events = [] for line in result.stdout.splitlines(): diff --git a/tools/test_storage_payload.py b/tools/test_storage_payload.py index 6211bf85..f88ca267 100644 --- a/tools/test_storage_payload.py +++ b/tools/test_storage_payload.py @@ -15,7 +15,7 @@ def test_repeated_staging_preserves_read_only_package_modes(self): with tempfile.TemporaryDirectory(prefix="storage-stage-") as temporary: source, target = Path(temporary) / "source", Path(temporary) / "stage" (source / "usr/sbin").mkdir(parents=True) - for fs in ("ext2", "fat", "exfat"): + for fs in ("ext2", "ext4", "fat", "exfat"): for verb in ("mkfs", "fsck"): (source / "usr/sbin" / f"{verb}.{fs}").write_bytes(b"official fixture") archive = source / "usr/lib/libext2fs.a" From 4ce058d67a6f4532cdbff8cfd902c26b4f205047 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sat, 14 Nov 2026 19:16:49 +0800 Subject: [PATCH 2/5] feat(packages): migrate util-linux to official Alpine APKs Replace locally built util-linux commands, libraries and manuals with pinned signed Alpine APKs. Isolate official development inputs for exfatprogs, transfer package ownership during upgrades, and retain existing shadow tools and PAM policy. Use upstream apk usermode for rootless staging and restore numeric owners and special permissions from the real package database when generating images. Document the original lsblk FSVER limitation in Chinese, English and Japanese. Validation: rootfs and installer builds; native QEMU UEFI/BIOS GPT, FAT/ext, mount and su/runuser checks; 26 offline update regressions; incremental recovery and packaging fixtures. Full make test remains blocked by the pre-existing settings/reliefsettings duplicate artwork failure. --- Documentation/admin-guide/packages.rst | 16 +- .../en/LC_MESSAGES/admin-guide/packages.po | 15 +- .../ja/LC_MESSAGES/admin-guide/packages.po | 13 +- NOTICE | 15 +- configs/apk-ownership.json | 10 +- configs/auth-upstream.json | 8 - configs/dependencies.lock.json | 373 +++++++++++++++++- resources/licenses/libeconf-LICENSE | 19 + .../licenses/util-linux-README.licensing | 31 ++ resources/licenses/utmps-COPYING | 13 + scripts/reliefos/Makefile.apk | 6 +- scripts/reliefos/Makefile.apk-dependencies | 12 + scripts/reliefos/Makefile.images | 12 +- scripts/reliefos/Makefile.rootfs | 2 +- scripts/reliefos/Makefile.upstream | 3 +- tests/build/test-apk-permissions.sh | 72 ++++ tests/build/test-desktop-backend.sh | 8 +- tests/build/test-util-linux-development.sh | 152 +++++++ tests/integration/apk-base-migration.sh | 4 +- tests/integration/apk-util-linux-migration.sh | 52 +++ tests/integration/upstream-incremental.sh | 8 + tests/integration/upstream-products.sh | 4 +- tools/apk_ownership.py | 4 +- tools/build/apk-permissions.sh | 42 ++ tools/build/apk-stage.sh | 33 +- tools/build/images.sh | 7 +- tools/build/rootfs-stage.sh | 13 +- tools/build/upstream.sh | 20 +- tools/build/util-linux-development.sh | 154 ++++++++ tools/host/apk/reliefos-apk-own.c | 12 - tools/storage_tools.py | 3 +- tools/test_installer_update_packages.py | 80 +++- tools/test_lsblk_filesystems_qemu.py | 7 +- 33 files changed, 1116 insertions(+), 107 deletions(-) create mode 100644 resources/licenses/libeconf-LICENSE create mode 100644 resources/licenses/util-linux-README.licensing create mode 100644 resources/licenses/utmps-COPYING create mode 100644 tests/build/test-apk-permissions.sh create mode 100644 tests/build/test-util-linux-development.sh create mode 100644 tests/integration/apk-util-linux-migration.sh create mode 100644 tools/build/apk-permissions.sh create mode 100644 tools/build/util-linux-development.sh diff --git a/Documentation/admin-guide/packages.rst b/Documentation/admin-guide/packages.rst index cbbb30a0..b8fabc98 100644 --- a/Documentation/admin-guide/packages.rst +++ b/Documentation/admin-guide/packages.rst @@ -32,7 +32,7 @@ sl、ncurses、zlib、libpng、SQLite、mbedTLS 3 由签名 Alpine APK 提供。 ``apk info --who-owns /usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` 查询。 离线更新器在预检时将旧包装包的 world 请求转换为官方包,保留其他包和配置; 正式事务自动卸载旧包,完成后清除离线缓存中的旧包装包归档。 -新的自有包使用第 5 代版本前缀,保证从第 2、3、4 代包按正常版本顺序升级。 +新的自有包使用第 6 代版本前缀,保证从第 2、3、4、5 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 SQLite VFS 或厂商内部符号的外部程序需要重新编译。 @@ -42,6 +42,20 @@ ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口 APK 依赖安装已迁移的官方包,升级事务同时转移旧文件的所有权,不强制覆盖文件。 shadow 构建使用独立提取的 libbsd 开发文件,不把 Alpine 的 Linux 头文件混入 SDK。 +util-linux 2.42.4 的命令、运行库和手册由锁定的官方 Alpine edge APK 提供。 +分区和文件系统工具保留官方 ``/sbin`` 路径,mount、umount、lsblk 保留 ``/bin`` 路径; +旧入口通过单向兼容链接转发。exfatprogs 的开发依赖从官方 APK 单独提取,运行镜像不包含 +这份开发根。现有 shadow login、newgrp、nologin 和 PAM 策略由本地认证包明确接管重叠文件, +官方包保留 su、runuser 的文件归属和权限。 + +liblastlog2 依赖 SQLite 运行库,因此桌面和控制台基础系统均保留 sqlite-libs; +SQLite 命令仍由组件开关控制。 + +官方 lsblk 2.42.4-r3 的直接探测路径未请求文件系统版本,因此 ``FSVER`` 列可能为空。 +本版保留该原版行为;读取真实版本可使用:: + + sudo blkid -p -s VERSION -o value /dev/sda2 + RPR 本地发布树继续包含完整的签名索引、原始上游 APK 和自有包,构建 ``rpr-pages`` 不等于部署到线上。运行库因新增 ELF NEEDED 而得到真实 APK 依赖,不能只复制新的 ``libreliefos.so.2`` 而遗漏配套库。 diff --git a/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po b/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po index e6d0edb9..e153858c 100644 --- a/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po +++ b/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po @@ -55,7 +55,7 @@ msgid "" "系统直接请求官方命令、终端工具/数据和 SQLite 命令/运行库,不再生成本地包装包。 文件所有权可通过 ``apk info --who-owns " "/usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` 查询。 " "离线更新器在预检时将旧包装包的 world 请求转换为官方包,保留其他包和配置; 正式事务自动卸载旧包,完成后清除离线缓存中的旧包装包归档。 " -"新的自有包使用第 5 代版本前缀,保证从第 2、3、4 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " +"新的自有包使用第 6 代版本前缀,保证从第 2、3、4、5 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " "SQLite VFS 或厂商内部符号的外部程序需要重新编译。" msgstr "" "sl, ncurses, zlib, libpng, SQLite, and mbedTLS 3 are supplied by signed " @@ -67,14 +67,23 @@ msgstr "" "to official packages while preserving other packages and configuration. The " "actual transaction automatically removes old packages; afterward it clears " "their wrapper archives from the offline cache. New project-owned packages " -"use a fifth-generation version prefix to upgrade normally from second-, " -"third-, and fourth-generation packages. The old ``sqlite.so.3`` ABI has been removed. " +"use a sixth-generation version prefix to upgrade normally from second-, " +"third-, fourth-, and fifth-generation packages. The old ``sqlite.so.3`` ABI has been removed. " "External programs depending on the old custom SQLite VFS or vendor-internal " "symbols must be rebuilt." msgid "libbsd、dosfstools、e2fsprogs 及其运行库和文档也直接使用锁定的官方 Alpine APK。 ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口由兼容链接转发。 本地认证支持包继续提供 libmd,本地文件系统包继续提供 exfatprogs;它们通过真实的 APK 依赖安装已迁移的官方包,升级事务同时转移旧文件的所有权,不强制覆盖文件。 shadow 构建使用独立提取的 libbsd 开发文件,不把 Alpine 的 Linux 头文件混入 SDK。" msgstr "libbsd, dosfstools, e2fsprogs, and their runtime libraries and documentation also come directly from pinned official Alpine APKs. The ext2/3/4 and FAT tools retain their official ``/sbin`` paths; compatibility links forward older ``/usr/sbin`` entry points. The local authentication support package still supplies libmd, and the local filesystem package still supplies exfatprogs. Real APK dependencies install the migrated official packages, transferring ownership of old files in the same upgrade transaction without forced overwrites. Shadow builds use separately extracted libbsd development files, keeping Alpine Linux headers out of the SDK." +msgid "util-linux 2.42.4 的命令、运行库和手册由锁定的官方 Alpine edge APK 提供。 分区和文件系统工具保留官方 ``/sbin`` 路径,mount、umount、lsblk 保留 ``/bin`` 路径; 旧入口通过单向兼容链接转发。exfatprogs 的开发依赖从官方 APK 单独提取,运行镜像不包含 这份开发根。现有 shadow login、newgrp、nologin 和 PAM 策略由本地认证包明确接管重叠文件, 官方包保留 su、runuser 的文件归属和权限。" +msgstr "The util-linux 2.42.4 commands, runtime libraries, and manuals come from pinned official Alpine edge APKs. Partition and filesystem tools retain their official ``/sbin`` paths; mount, umount, and lsblk retain their ``/bin`` paths. One-way compatibility links forward older entry points. Development dependencies for exfatprogs are extracted separately from official APKs; this development root is excluded from runtime images. The local authentication package explicitly owns overlapping files for the existing shadow login, newgrp, nologin, and PAM policy. Official packages retain ownership and permissions of su and runuser." + +msgid "liblastlog2 依赖 SQLite 运行库,因此桌面和控制台基础系统均保留 sqlite-libs; SQLite 命令仍由组件开关控制。" +msgstr "liblastlog2 depends on the SQLite runtime library, so both desktop and console base systems retain sqlite-libs. The SQLite command remains controlled by its component option." + +msgid "官方 lsblk 2.42.4-r3 的直接探测路径未请求文件系统版本,因此 ``FSVER`` 列可能为空。 本版保留该原版行为;读取真实版本可使用::" +msgstr "The direct probing path in official lsblk 2.42.4-r3 does not request the filesystem version, so the ``FSVER`` column may be empty. This release preserves that upstream behavior. To read the actual version, use::" + msgid "" "RPR 本地发布树继续包含完整的签名索引、原始上游 APK 和自有包,构建 ``rpr-pages`` 不等于部署到线上。运行库因新增 ELF " "NEEDED 而得到真实 APK 依赖,不能只复制新的 ``libreliefos.so.2`` 而遗漏配套库。" diff --git a/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po b/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po index 02b2fe26..b5031e8f 100644 --- a/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po +++ b/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po @@ -51,7 +51,7 @@ msgid "" "系统直接请求官方命令、终端工具/数据和 SQLite 命令/运行库,不再生成本地包装包。 文件所有权可通过 ``apk info --who-owns " "/usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` 查询。 " "离线更新器在预检时将旧包装包的 world 请求转换为官方包,保留其他包和配置; 正式事务自动卸载旧包,完成后清除离线缓存中的旧包装包归档。 " -"新的自有包使用第 5 代版本前缀,保证从第 2、3、4 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " +"新的自有包使用第 6 代版本前缀,保证从第 2、3、4、5 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " "SQLite VFS 或厂商内部符号的外部程序需要重新编译。" msgstr "" "sl、ncurses、zlib、libpng、SQLite、mbedTLS 3 は署名済み Alpine APK " @@ -60,12 +60,21 @@ msgstr "" "/usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` " "で照会できます。オフライン更新器は事前検査で旧ラッパーパッケージの world " "要求を公式パッケージに変換し、他のパッケージと設定は保持します。正式な処理では旧パッケージを自動削除し、完了後にオフラインキャッシュから旧ラッパーのアーカイブを除去します。新しい自有パッケージは第" -" 5 世代のバージョン接頭辞を使い、第 2・第 3・第 4 世代から通常のバージョン順に更新できます。旧 ``sqlite.so.3`` ABI " +" 6 世代のバージョン接頭辞を使い、第 2・第 3・第 4・第 5 世代から通常のバージョン順に更新できます。旧 ``sqlite.so.3`` ABI " "は削除済みです。旧独自 SQLite VFS やベンダー内部シンボルに依存する外部プログラムは再コンパイルが必要です。" msgid "libbsd、dosfstools、e2fsprogs 及其运行库和文档也直接使用锁定的官方 Alpine APK。 ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口由兼容链接转发。 本地认证支持包继续提供 libmd,本地文件系统包继续提供 exfatprogs;它们通过真实的 APK 依赖安装已迁移的官方包,升级事务同时转移旧文件的所有权,不强制覆盖文件。 shadow 构建使用独立提取的 libbsd 开发文件,不把 Alpine 的 Linux 头文件混入 SDK。" msgstr "libbsd、dosfstools、e2fsprogs とその実行時ライブラリおよび文書も、固定した公式 Alpine APK を直接使用します。ext2/3/4 と FAT のツールは公式の ``/sbin`` パスを維持し、従来の ``/usr/sbin`` 入口は互換リンクで転送します。ローカル認証支援パッケージは引き続き libmd を、ローカルファイルシステムパッケージは exfatprogs を提供します。実際の APK 依存関係により移行済みの公式パッケージを導入し、同じ更新処理で旧ファイルの所有権を移転するため、強制上書きは行いません。shadow のビルドには別途展開した libbsd 開発ファイルを使い、Alpine の Linux ヘッダーを SDK に混在させません。" +msgid "util-linux 2.42.4 的命令、运行库和手册由锁定的官方 Alpine edge APK 提供。 分区和文件系统工具保留官方 ``/sbin`` 路径,mount、umount、lsblk 保留 ``/bin`` 路径; 旧入口通过单向兼容链接转发。exfatprogs 的开发依赖从官方 APK 单独提取,运行镜像不包含 这份开发根。现有 shadow login、newgrp、nologin 和 PAM 策略由本地认证包明确接管重叠文件, 官方包保留 su、runuser 的文件归属和权限。" +msgstr "util-linux 2.42.4 のコマンド、実行時ライブラリ、マニュアルは固定した公式 Alpine edge APK が提供します。パーティションとファイルシステムのツールは公式の ``/sbin`` パスを、mount、umount、lsblk は ``/bin`` パスを維持します。従来の入口は一方向の互換リンクで転送します。exfatprogs の開発依存ファイルは公式 APK から別途展開し、その開発用ルートは実行時イメージに含めません。既存の shadow login、newgrp、nologin と PAM 設定の重複ファイルは、ローカル認証パッケージが明示的に所有します。su と runuser の所有関係および権限は公式パッケージが維持します。" + +msgid "liblastlog2 依赖 SQLite 运行库,因此桌面和控制台基础系统均保留 sqlite-libs; SQLite 命令仍由组件开关控制。" +msgstr "liblastlog2 は SQLite のランタイムライブラリに依存するため、デスクトップとコンソールの基本システムはいずれも sqlite-libs を保持します。SQLite コマンドの有効・無効は、引き続きコンポーネントの設定で制御します。" + +msgid "官方 lsblk 2.42.4-r3 的直接探测路径未请求文件系统版本,因此 ``FSVER`` 列可能为空。 本版保留该原版行为;读取真实版本可使用::" +msgstr "公式 lsblk 2.42.4-r3 の直接検出経路はファイルシステムのバージョンを要求しないため、``FSVER`` 列が空になる場合があります。本版ではこの上流の動作を維持します。実際のバージョンを読むには次を使います::" + msgid "" "RPR 本地发布树继续包含完整的签名索引、原始上游 APK 和自有包,构建 ``rpr-pages`` 不等于部署到线上。运行库因新增 ELF " "NEEDED 而得到真实 APK 依赖,不能只复制新的 ``libreliefos.so.2`` 而遗漏配套库。" diff --git a/NOTICE b/NOTICE index 40479503..57cdd8d1 100644 --- a/NOTICE +++ b/NOTICE @@ -36,9 +36,18 @@ Runtime, libraries, and applications * sudo 1.9.17p2: ISC and upstream file-specific terms; see LICENSE.md. * Linux-PAM 1.7.2: upstream BSD/GPL alternatives and file-specific terms; see Copyright and the recorded platform patch in patches/linux-pam/. -* util-linux 2.41.6 (su/runuser and storage utilities/libraries): upstream - GPL/LGPL and file-specific terms; - see README.licensing. +* util-linux 2.42.4 (su/runuser and storage utilities/libraries): unmodified + signed official Alpine APKs. See resources/licenses/util-linux-README.licensing + for upstream GPL/LGPL/BSD/MIT and file-specific terms. Archive hashes, + recipe commits and package licenses are in configs/dependencies.lock.json. + blkid/uuid development inputs are isolated for building exfatprogs. +* libeconf 0.8.4: MIT, Copyright (c) 2019 SUSE LLC. See + resources/licenses/libeconf-LICENSE (upstream v0.8.4 LICENSE). +* utmps 0.1.3.4 and skalibs 2.16.0.0 runtime libraries: ISC. See + resources/licenses/utmps-COPYING (the upstream 0.1.3.4 release) and + /usr/share/licenses/skalibs/COPYING from the signed skalibs-doc APK. + All three dependencies use original signed Alpine APKs with recipe commits, + versions and archive hashes in configs/dependencies.lock.json. * e2fsprogs 1.47.4 and dosfstools 4.2: unmodified signed Alpine APKs, including their split runtime libraries and documentation. Versions, archive hashes, recipe commits and package licenses are recorded in diff --git a/configs/apk-ownership.json b/configs/apk-ownership.json index ae9d76fc..966d1442 100644 --- a/configs/apk-ownership.json +++ b/configs/apk-ownership.json @@ -205,9 +205,9 @@ "destination": "alpine-after-validation", "components": ["sudo", "su"], "library_stems": ["lib/libpam", "lib/libpam_misc", "lib/libpamc", "lib/libcrypt", "usr/lib/libsubid"], - "paths": ["bin/su", "usr/bin/sudo", "usr/bin/sudoedit", "usr/bin/passwd", "sbin/unix_chkpwd", "lib/security", "usr/lib/security", "usr/lib/sudo", "etc/pam.d", "etc/security", "etc/sudoers", "etc/sudoers.d", "etc/sudo.conf", "lib/libpam.so.0", "lib/libpam_misc.so.0", "lib/libpamc.so.0", "lib/libcrypt.so.2"], + "paths": ["bin/login", "usr/bin/newgrp", "sbin/nologin", "usr/bin/sudo", "usr/bin/sudoedit", "usr/bin/passwd", "sbin/unix_chkpwd", "lib/security", "usr/lib/security", "usr/lib/sudo", "etc/pam.d", "etc/security", "etc/sudoers", "etc/sudoers.d", "etc/sudo.conf", "lib/libpam.so.0", "lib/libpam_misc.so.0", "lib/libpamc.so.0", "lib/libcrypt.so.2"], "alpine_candidates": ["linux-pam", "shadow", "sudo", "libxcrypt"], - "reason": "PAM patches and pam_leonos_password need real local packaging; preserve policy, setuid modes and login semantics before any upstream replacement." + "reason": "PAM patches and shadow login/newgrp/nologin retain their real local owner. The signed authentication package replaces the overlapping util-linux-login files and su-l policy, while official APKs own su/runuser and their modes." }, "auth-support-libraries": { "destination": "alpine-after-validation", @@ -220,9 +220,9 @@ "storage-util-linux": { "destination": "alpine-after-validation", "components": [], - "library_stems": ["usr/lib/libfdisk", "usr/lib/libsmartcols", "usr/lib/libuuid", "usr/lib/libblkid", "usr/lib/libmount"], - "alpine_candidates": ["util-linux"], - "reason": "Includes split libraries and command packages; resolve actual repository file ownership before choosing subpackages. Installer relies on these tools." + "paths": ["usr/sbin/fdisk", "usr/sbin/sfdisk", "usr/sbin/runuser", "usr/sbin/fsck", "usr/sbin/blkid", "usr/bin/mount", "usr/bin/umount", "usr/bin/lsblk", "sbin/umount"], + "alpine_candidates": [], + "reason": "Compatibility aliases depend on the official util-linux command, library and documentation packages. No locally built util-linux executables, libraries, headers or static archives enter the runtime." }, "storage-filesystems": { "destination": "alpine-after-validation", diff --git a/configs/auth-upstream.json b/configs/auth-upstream.json index c48e315c..ac2e43c5 100644 --- a/configs/auth-upstream.json +++ b/configs/auth-upstream.json @@ -38,13 +38,5 @@ "directory": "Linux-PAM-1.7.2", "license_file": "Copyright", "checksum_source": "https://api.github.com/repos/linux-pam/linux-pam/releases/tags/v1.7.2" - }, - "util-linux": { - "version": "2.41.6", - "url": "https://www.kernel.org/pub/linux/utils/util-linux/v2.41/util-linux-2.41.6.tar.xz", - "sha256": "e596083744e746be7d2823b62b43f4418dd7bf56303b4dc09e6fe8112fe3d7ed", - "directory": "util-linux-2.41.6", - "license_file": "README.licensing", - "checksum_source": "https://www.kernel.org/pub/linux/utils/util-linux/v2.41/sha256sums.asc" } } diff --git a/configs/dependencies.lock.json b/configs/dependencies.lock.json index 7e270514..a86c783e 100644 --- a/configs/dependencies.lock.json +++ b/configs/dependencies.lock.json @@ -999,14 +999,14 @@ { "id": "alpine-libeconf", "kind": "apk", - "version": "0.8.3-r0", - "url": "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/libeconf-0.8.3-r0.apk", - "sha256": "2a791c7957961f830cf31b04f35f814a63afcf633badc9052425ff1cf2f64380", - "directory": "libeconf-0.8.3-r0", + "version": "0.8.4-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libeconf-0.8.4-r0.apk", + "sha256": "285cc8268c2426030be8d5a47bcc6f695e14af22fc94733927fcebf47ce1b838", + "directory": "libeconf-0.8.4-r0", "script": "tools/build/upstream-apk.sh", "target": "apk-root", - "feature": "xorg", - "note": "Alpine v3.24 main x86_64 APKINDEX license = MIT; embedded APK signature is verified by apk-tools", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 96066c3b6d2992dd2b72db6492c4e65d7f17520f; .PKGINFO license = MIT; SHA-256 and embedded official signature verified", "license_in_source": ".PKGINFO" }, { @@ -2862,18 +2862,6 @@ "target": "kernel", "license": "resources/licenses/unifont-LICENSE" }, - { - "id": "util-linux", - "kind": "tarball", - "version": "2.42.4", - "url": "https://www.kernel.org/pub/linux/utils/util-linux/v2.42/util-linux-2.42.4.tar.xz", - "sha256": "fbd62a100ab7bb8746ba0661255c3c48185b1e9021507c624da01fbc696330ec", - "directory": "util-linux-2.42.4", - "license_in_source": "README.licensing", - "checksum_source": "https://www.kernel.org/pub/linux/utils/util-linux/v2.42/sha256sums.asc", - "script": "tools/build/upstream.sh", - "target": "auth-upstream" - }, { "id": "alsa-lib", "kind": "tarball", @@ -3023,10 +3011,309 @@ "directory": "sqlite-libs-3.53.4-r0", "script": "tools/build/upstream-apk.sh", "target": "apk-root", - "feature": "component:sqlite", + "feature": "base", "note": "Alpine v3.24 main x86_64; official APK signature verified before use; license = blessing.", "license_in_source": ".PKGINFO" }, + { + "id": "alpine-blkid", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/blkid-2.42.4-r3.apk", + "sha256": "0adf6efc69b207da87160664428a4f203648d418145957231e70be423c1ae27f", + "directory": "blkid-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = LGPL-1.0-only; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-libblkid", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libblkid-2.42.4-r3.apk", + "sha256": "8d8dba04a09fb82112933432d3e254b6a11a4f12022da3845eb4a50772a7e03a", + "directory": "libblkid-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = LGPL-2.1-or-later; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-libeconf-doc", + "kind": "apk", + "version": "0.8.4-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libeconf-doc-0.8.4-r0.apk", + "sha256": "ce7a0327a043c1aefe8c3e9cb15cb6f35fa8d6a10fb0664fe44b33ba4b3a94d7", + "directory": "libeconf-doc-0.8.4-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 96066c3b6d2992dd2b72db6492c4e65d7f17520f; .PKGINFO license = MIT; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-libfdisk", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libfdisk-2.42.4-r3.apk", + "sha256": "7255533d062bc91cf24dab24557a46d976e1a9a1cf084ee44c2da2461e94dd3c", + "directory": "libfdisk-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = LGPL-2.1-or-later; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-liblastlog2", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/liblastlog2-2.42.4-r3.apk", + "sha256": "53ffbafcb1982923bd02654d3653b70235dda9dca9e7cca65d52cb917adb7560", + "directory": "liblastlog2-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = BSD-2-Clause; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-libmount", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libmount-2.42.4-r3.apk", + "sha256": "a00a33f48275be8fc56011524c9ea0451be7de8d146d908a1d94dd7068ca2d23", + "directory": "libmount-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = LGPL-2.1-or-later; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-libsmartcols", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libsmartcols-2.42.4-r3.apk", + "sha256": "e5a7c506437741b3040c0bd136b0f8d72fcdc329f70cf982ca20aef9a9f4c5c5", + "directory": "libsmartcols-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = LGPL-2.1-or-later; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-libuuid", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libuuid-2.42.4-r3.apk", + "sha256": "d1a8276a8f57514f5a35dc8fca7b6ecea109ce5f6e228ebd6278eca5aa8ec561", + "directory": "libuuid-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = BSD-3-Clause; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-lsblk", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/lsblk-2.42.4-r3.apk", + "sha256": "f11dbb70e1b0b985c28f153698a00b7e8e66c48180579670555814e2303be40b", + "directory": "lsblk-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-2.0-or-later; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-mount", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/mount-2.42.4-r3.apk", + "sha256": "70b045c3b0b3ff933a2ea4efe1d3615bb48c8a729a860042b213ea853f70e908", + "directory": "mount-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-runuser", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/runuser-2.42.4-r3.apk", + "sha256": "ca2f99318920134d5f6e66b7f7ec8212f9cae34d4427be5528fb330a270c4122", + "directory": "runuser-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-2.0-or-later; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-setarch", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/setarch-2.42.4-r3.apk", + "sha256": "60b586db352bfa084ed71bf01bc25a37c68e23796318dd3437c0769fd3432beb", + "directory": "setarch-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-sfdisk", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/sfdisk-2.42.4-r3.apk", + "sha256": "73457f7b01089a0b30046441326610224177baeb7c9978f95ce58cacb3217267", + "directory": "sfdisk-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-1.0-or-later; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-skalibs-doc", + "kind": "apk", + "version": "2.16.0.0-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/skalibs-doc-2.16.0.0-r0.apk", + "sha256": "096454981c3a1f0fe3f6388c009bfdb87581eb95713119c31f0e07bfebd8ebae", + "directory": "skalibs-doc-2.16.0.0-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit b37afefa12a610b37018c8e62e5f52bd57951932; .PKGINFO license = ISC; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-skalibs-libs", + "kind": "apk", + "version": "2.16.0.0-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/skalibs-libs-2.16.0.0-r0.apk", + "sha256": "b4b6f7995ace8e7601651a35a3619255122e4809cfc52d6eef89630b28b6491c", + "directory": "skalibs-libs-2.16.0.0-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit b37afefa12a610b37018c8e62e5f52bd57951932; .PKGINFO license = ISC; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-umount", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/umount-2.42.4-r3.apk", + "sha256": "f21dfd9ca22d9a87fd8609fd9a9df2695c3c6ae32ab5457cb843b38b7efba956", + "directory": "umount-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-util-linux", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/util-linux-2.42.4-r3.apk", + "sha256": "06ac2674efb6a25fa969cc2c94b17d9e2c6d26b85c9169f4ceb431765b0ea8cf", + "directory": "util-linux-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-util-linux-doc", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/util-linux-doc-2.42.4-r3.apk", + "sha256": "49eaa5f6a029c1bf379f7c95dedfc632e1ab4b82342915b4fc45fc2dea8b3e9e", + "directory": "util-linux-doc-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-util-linux-login", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/util-linux-login-2.42.4-r3.apk", + "sha256": "b7d718c37142d19706e210e73ddc852faa4b22c281016d95536826cd4e985a6b", + "directory": "util-linux-login-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-2.0-or-later AND BSD-1-Clause; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-util-linux-login-doc", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/util-linux-login-doc-2.42.4-r3.apk", + "sha256": "9655f1054d36fa836d82398c9474f61990a30bcbbc15c66c65dea9a0ddd5132b", + "directory": "util-linux-login-doc-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-util-linux-misc", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/util-linux-misc-2.42.4-r3.apk", + "sha256": "31ecafb1e72ce8dec849c8825578c93bac72716e95852a68484b5b497f05a5d4", + "directory": "util-linux-misc-2.42.4-r3", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-utmps-doc", + "kind": "apk", + "version": "0.1.3.4-r1", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/utmps-doc-0.1.3.4-r1.apk", + "sha256": "d1135378c97af568983ade95c29a41fa0e7f6013eaa046505af89faf3f320a4a", + "directory": "utmps-doc-0.1.3.4-r1", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 70e2e5769c11eff1784e7dc16be166c23f0c13e2; .PKGINFO license = ISC; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-utmps-libs", + "kind": "apk", + "version": "0.1.3.4-r1", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/utmps-libs-0.1.3.4-r1.apk", + "sha256": "84a4cf01527cc6101ab9a20fb22f4667d7b0f25e00d93b139a5713cf04cac94d", + "directory": "utmps-libs-0.1.3.4-r1", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit 70e2e5769c11eff1784e7dc16be166c23f0c13e2; .PKGINFO license = ISC; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, { "id": "runtime-dev-libbsd-dev", "kind": "apk", @@ -3180,6 +3467,54 @@ "target": "host-runtime-development", "license_in_source": "README.txt", "note": "Host-only native libraries for ASan/UBSan source tests; never used in target runtime, SDK, APKs or release images." + }, + { + "id": "runtime-dev-libeconf-dev", + "kind": "apk", + "version": "0.8.4-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libeconf-dev-0.8.4-r0.apk", + "sha256": "12acf8f366acb25585b35dbba4d823ff9022410113e3ff341e335dd2d4eb07b8", + "directory": "libeconf-dev-0.8.4-r0", + "script": "tools/build/util-linux-development.sh", + "target": "util-linux-development", + "note": "Official Alpine edge main x86_64 APK; recipe commit 96066c3b6d2992dd2b72db6492c4e65d7f17520f; .PKGINFO license = MIT; SHA-256 and embedded official signature verified; isolated build-only development input", + "license_in_source": ".PKGINFO" + }, + { + "id": "runtime-dev-libeconf-static", + "kind": "apk", + "version": "0.8.4-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libeconf-static-0.8.4-r0.apk", + "sha256": "7e384475de03196e7deb6dae776a4fd51ad7fc8d937304e24c97881e8c966f8a", + "directory": "libeconf-static-0.8.4-r0", + "script": "tools/build/util-linux-development.sh", + "target": "util-linux-development", + "note": "Official Alpine edge main x86_64 APK; recipe commit 96066c3b6d2992dd2b72db6492c4e65d7f17520f; .PKGINFO license = MIT; SHA-256 and embedded official signature verified; isolated build-only development input", + "license_in_source": ".PKGINFO" + }, + { + "id": "runtime-dev-util-linux-dev", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/util-linux-dev-2.42.4-r3.apk", + "sha256": "f3ca0b9e1cc1984e3a5b9938f5d547b4c769e77fa1134b6fc31f00e7af540c39", + "directory": "util-linux-dev-2.42.4-r3", + "script": "tools/build/util-linux-development.sh", + "target": "util-linux-development", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain; SHA-256 and embedded official signature verified; isolated build-only development input", + "license_in_source": ".PKGINFO" + }, + { + "id": "runtime-dev-util-linux-static", + "kind": "apk", + "version": "2.42.4-r3", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/util-linux-static-2.42.4-r3.apk", + "sha256": "82829be3f9fe1ce770b138806c3faeb0bff7c72b72a9b5389e887c96a11a0c19", + "directory": "util-linux-static-2.42.4-r3", + "script": "tools/build/util-linux-development.sh", + "target": "util-linux-development", + "note": "Official Alpine edge main x86_64 APK; recipe commit 087ea48145e24307010ba91f403c5ff8f402568c; .PKGINFO license = GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain; SHA-256 and embedded official signature verified; isolated build-only development input", + "license_in_source": ".PKGINFO" } ] } diff --git a/resources/licenses/libeconf-LICENSE b/resources/licenses/libeconf-LICENSE new file mode 100644 index 00000000..a35ef53a --- /dev/null +++ b/resources/licenses/libeconf-LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2019 SUSE LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/resources/licenses/util-linux-README.licensing b/resources/licenses/util-linux-README.licensing new file mode 100644 index 00000000..cbfa6090 --- /dev/null +++ b/resources/licenses/util-linux-README.licensing @@ -0,0 +1,31 @@ + +The project util-linux doesn't use the same license for all of the code. +There is code under: + + * GPL-1.0-or-later - GNU General Public License version 1, or any later version + + * GPL-2.0-only - GNU General Public License version 2 + + * GPL-2.0-or-later - GNU General Public License version 2, or any later version + + * GPL-3.0-or-later - GNU General Public License version 3, or any later version + + * LGPL-2.1-or-later - GNU Lesser General Public License 2.1 or any later version + + * MIT - MIT License + + * BSD-2-Clause - Simplified BSD License + + * BSD-3-Clause - BSD 3-Clause "New" or "Revised" License + + * BSD-4-Clause-UC - BSD 4-Clause University of California-Specific + + * EUPL-1.2 - European Union Public Licence version 1.2 + + * Public Domain + +Please, check the source code for more details. A license is usually at the start +of each source file. + +The ./COPYING file (GPL-2.0-or-later) is the default license for code without +an explicitly defined license. diff --git a/resources/licenses/utmps-COPYING b/resources/licenses/utmps-COPYING new file mode 100644 index 00000000..9b497a10 --- /dev/null +++ b/resources/licenses/utmps-COPYING @@ -0,0 +1,13 @@ +Copyright (c) 2018-2026 Laurent Bercot + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/scripts/reliefos/Makefile.apk b/scripts/reliefos/Makefile.apk index 50ad3d86..6cff80f3 100644 --- a/scripts/reliefos/Makefile.apk +++ b/scripts/reliefos/Makefile.apk @@ -8,10 +8,10 @@ APK_REPOSITORY := $(APK_WORK)/repository APK_MANIFEST := $(APK_WORK)/manifest.json APK_OWNERSHIP := $(APK_WORK)/ownership.tsv APK_SIGNING_KEY ?= $(HOME)/.local/share/leonos/apk-signing/key.pem -# Generation 5 transfers libbsd and ext/FAT tools to official Alpine owners. -# This sorts after generation 4 even for development builds at the same commit. +# Generation 6 transfers the util-linux suite to official Alpine owners. +# This sorts after generation 5 even for development builds at the same commit. # Published releases must still use an increasing SOURCE_DATE_EPOCH. -APK_BUILD_VERSION ?= 5.$(SOURCE_DATE_EPOCH)-r0 +APK_BUILD_VERSION ?= 6.$(SOURCE_DATE_EPOCH)-r0 APK_STAGE_SCRIPT := $(RELIEFOS_SRC)/tools/build/apk-stage.sh APK_STAGE_INPUTS := $(RELIEFOS_SRC)/tools/build/apk-layout.sh $(RELIEFOS_LAYOUT_TOOL) $(RELIEFOS_LOCK) $(RELIEFOS_DEPS_TOOL) BUILD_LOG_INPUTS := $(RELIEFOS_SHELL_LOG) $(RELIEFOS_SRC)/tools/build/run-logged.sh $(RELIEFOS_SRC)/tools/build/format-log.awk diff --git a/scripts/reliefos/Makefile.apk-dependencies b/scripts/reliefos/Makefile.apk-dependencies index 2cf1cb4f..a7049cfb 100644 --- a/scripts/reliefos/Makefile.apk-dependencies +++ b/scripts/reliefos/Makefile.apk-dependencies @@ -20,6 +20,18 @@ $(LIBBSD_DEVELOPMENT_ROOT)/.complete $(upstream_libbsd_products): $(O_META)/libb .PHONY: upstream-libbsd libbsd-development upstream-libbsd libbsd-development: $(LIBBSD_DEVELOPMENT_ROOT)/.complete $(upstream_libbsd_products) +UTIL_LINUX_DEVELOPMENT_ROOT := $(UPSTREAM_ROOT)/util-linux/root +upstream_util-linux_products := $(addprefix $(UTIL_LINUX_DEVELOPMENT_ROOT)/,usr/include/blkid/blkid.h usr/include/uuid/uuid.h usr/include/libeconf.h usr/lib/libblkid.a usr/lib/libuuid.a usr/lib/libeconf.a usr/lib/libblkid.so usr/lib/libuuid.so usr/lib/libeconf.so usr/lib/pkgconfig/blkid.pc usr/lib/pkgconfig/uuid.pc usr/lib/pkgconfig/libeconf.pc) +$(UTIL_LINUX_DEVELOPMENT_ROOT)/.complete $(upstream_util-linux_products) &: $(RELIEFOS_SRC)/tools/build/util-linux-development.sh $(RELIEFOS_SRC)/scripts/reliefos/Makefile.apk-dependencies $(RELIEFOS_LOCK) $(RELIEFOS_DEPS_TOOL) $(UPSTREAM_APK) $(RELIEFOS_SRC)/resources/licenses/util-linux-README.licensing + $(Q)sh $(RELIEFOS_SRC)/tools/build/util-linux-development.sh $(RELIEFOS_SRC) $(abspath $(RELIEFOS_DEPS_TOOL)) $(RELIEFOS_LOCK) $(RELIEFOS_CACHE) $(abspath $(UPSTREAM_APK)) $(abspath $(UTIL_LINUX_DEVELOPMENT_ROOT)) + $(Q)touch $(upstream_util-linux_products) +$(O_META)/util-linux-development-present.parameters: FORCE $(RELIEFOS_SRC)/tools/build/upstream-verify.sh + $(Q)sh $(RELIEFOS_SRC)/tools/build/upstream-verify.sh $(UTIL_LINUX_DEVELOPMENT_ROOT) $(UTIL_LINUX_DEVELOPMENT_ROOT).files $@ +$(UTIL_LINUX_DEVELOPMENT_ROOT)/.complete $(upstream_util-linux_products): $(O_META)/util-linux-development-present.parameters +.PHONY: upstream-util-linux util-linux-development +upstream-util-linux: upstream-apk util-linux-development +util-linux-development: $(UTIL_LINUX_DEVELOPMENT_ROOT)/.complete $(upstream_util-linux_products) + RUNTIME_DEVELOPMENT_ROOT := $(UPSTREAM_ROOT)/runtime-development RUNTIME_DEP_LIBDIR := $(RUNTIME_DEVELOPMENT_ROOT)/usr/lib RUNTIME_DEP_SHARED := $(addprefix $(RUNTIME_DEP_LIBDIR)/,libpng.so libz.so libmbedtls.so libmbedx509.so libmbedcrypto.so) diff --git a/scripts/reliefos/Makefile.images b/scripts/reliefos/Makefile.images index ef025f87..6f58d965 100644 --- a/scripts/reliefos/Makefile.images +++ b/scripts/reliefos/Makefile.images @@ -79,13 +79,13 @@ LIVE_ISO := $(O_IMAGES)/reliefos-live.iso INSTALLER_ISO := $(O_IMAGES)/reliefos-installer.iso $(LIVE_ISO) $(INSTALLER_ISO): $(BUILD_LOG_INPUTS) $(INSTALLER_STAGE_STAMP): $(USERLAND_DIR)/installer.elf -$(ROOT_EXT2): $(O_STAGE)/live-root.complete $(RELIEFOS_EXT2_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(O_META)/images.parameters +$(ROOT_EXT2): $(O_STAGE)/live-root.complete $(RELIEFOS_EXT2_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(RELIEFOS_SRC)/tools/build/apk-permissions.sh $(O_META)/images.parameters $(Q)RELIEFOS_EXT2_TIME=$(RELIEFOS_EXT2_TIME) sh $(RELIEFOS_SRC)/tools/build/images.sh ext2 $(LIVE_ROOT_STAGE) $@ $(SOURCE_DATE_EPOCH) $(LIVE_ROOT_UUID) -$(DISK_ROOT_EXT2): $(O_STAGE)/disk-root.complete $(RELIEFOS_EXT2_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(O_META)/images.parameters +$(DISK_ROOT_EXT2): $(O_STAGE)/disk-root.complete $(RELIEFOS_EXT2_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(RELIEFOS_SRC)/tools/build/apk-permissions.sh $(O_META)/images.parameters $(Q)RELIEFOS_EXT2_TIME=$(RELIEFOS_EXT2_TIME) sh $(RELIEFOS_SRC)/tools/build/images.sh ext2 $(DISK_ROOT_STAGE) $@ $(SOURCE_DATE_EPOCH) $(DISK_ROOT_UUID) -$(ROOT_EXT4): $(O_STAGE)/live-root.complete $(RELIEFOS_EXT4_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(O_META)/images.parameters +$(ROOT_EXT4): $(O_STAGE)/live-root.complete $(RELIEFOS_EXT4_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(RELIEFOS_SRC)/tools/build/apk-permissions.sh $(O_META)/images.parameters $(Q)RELIEFOS_EXT4_TIME=$(RELIEFOS_EXT4_TIME) sh $(RELIEFOS_SRC)/tools/build/images.sh ext4 $(LIVE_ROOT_STAGE) $@ $(SOURCE_DATE_EPOCH) $(LIVE_ROOT_UUID) -$(DISK_ROOT_EXT4): $(O_STAGE)/disk-root.complete $(RELIEFOS_EXT4_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(O_META)/images.parameters +$(DISK_ROOT_EXT4): $(O_STAGE)/disk-root.complete $(RELIEFOS_EXT4_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(RELIEFOS_SRC)/tools/build/apk-permissions.sh $(O_META)/images.parameters $(Q)RELIEFOS_EXT4_TIME=$(RELIEFOS_EXT4_TIME) sh $(RELIEFOS_SRC)/tools/build/images.sh ext4 $(DISK_ROOT_STAGE) $@ $(SOURCE_DATE_EPOCH) $(DISK_ROOT_UUID) RELIEFOS_DEDUP_TOOL := $(RELIEFOS_HOST_BIN)/reliefos-dedup tools: $(RELIEFOS_DEDUP_TOOL) @@ -95,9 +95,9 @@ $(INSTALLER_STAGE_STAMP): $(ROOTFS_RAW_STAMP) $(ESP_STAMP) $(USERLAND_DIR)/insta $(Q)APK_TOOL=$(abspath $(UPSTREAM_APK)) APK_UPSTREAM=$(abspath $(UPSTREAM_APK_ROOT)) APK_OWN_TOOL=$(abspath $(RELIEFOS_APK_OWN)) APK_KEY='$(APK_SIGNING_KEY)' APK_VERSION='$(APK_BUILD_VERSION)' sh $(RELIEFOS_SRC)/tools/build/run-logged.sh $(O_LOGS)/installer-stage.log sh $(RELIEFOS_SRC)/tools/build/installer-stage.sh $(RELIEFOS_SRC) $(abspath $(O)) $(abspath $(ROOTFS_RAW)) $(abspath $(ESP_STAGE)) $(abspath $(INSTALLER_ROOT)) $(SOURCE_DATE_EPOCH) $(Q)touch $@ $(Q)sh $(RELIEFOS_SRC)/tools/build/stage-inventory.sh write $(INSTALLER_ROOT) $(O_META)/installer.files -$(INSTALLER_EXT2): $(INSTALLER_STAGE_STAMP) $(RELIEFOS_EXT2_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(O_META)/images.parameters +$(INSTALLER_EXT2): $(INSTALLER_STAGE_STAMP) $(RELIEFOS_EXT2_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(RELIEFOS_SRC)/tools/build/apk-permissions.sh $(O_META)/images.parameters $(Q)IMAGE_MIN_MIB=$(or $(CONFIG_INSTALLER_ROOT_SIZE_MIB),400) RELIEFOS_EXT2_TIME=$(RELIEFOS_EXT2_TIME) sh $(RELIEFOS_SRC)/tools/build/images.sh ext2 $(INSTALLER_ROOT) $@ $(SOURCE_DATE_EPOCH) 9e1f6d46-3f41-42d2-9917-9a21a2134401 -$(INSTALLER_EXT4): $(INSTALLER_STAGE_STAMP) $(RELIEFOS_EXT4_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(O_META)/images.parameters +$(INSTALLER_EXT4): $(INSTALLER_STAGE_STAMP) $(RELIEFOS_EXT4_TIME) $(RELIEFOS_SRC)/tools/build/images.sh $(RELIEFOS_SRC)/tools/build/apk-permissions.sh $(O_META)/images.parameters $(Q)IMAGE_MIN_MIB=$(or $(CONFIG_INSTALLER_ROOT_SIZE_MIB),400) RELIEFOS_EXT4_TIME=$(RELIEFOS_EXT4_TIME) sh $(RELIEFOS_SRC)/tools/build/images.sh ext4 $(INSTALLER_ROOT) $@ $(SOURCE_DATE_EPOCH) 9e1f6d46-3f41-42d2-9917-9a21a2134401 $(DISK_RAW) $(DISK_VMDK) &: $(DISK_ROOT_EXT4) $(ESP_STAMP) $(RELIEFOS_SRC)/tools/build/disk.sh $(RELIEFOS_IMAGE_IDENTITY) $(RELIEFOS_SRC)/boot/grub/bios-modules.list $(GRUB_BIOS_INPUTS) $(GRUB_BIOS_REQUIRED_INPUTS) $(GRUB_HOST_TOOLS) $(O_META)/images.parameters $(Q)RELIEFOS_IMAGE_INSTANCE=$(RELIEFOS_IMAGE_INSTANCE_QUOTED) IMAGE_MIN_MIB=$(or $(CONFIG_IMAGE_SIZE_MIB),1024) sh $(RELIEFOS_SRC)/tools/build/disk.sh $(ESP_STAGE) $(DISK_ROOT_EXT4) $(DISK_RAW) $(DISK_VMDK) $(SOURCE_DATE_EPOCH) $(GRUB_BIOS_DIR) $(GRUB_MKIMAGE) $(GRUB_BIOS_SETUP) diff --git a/scripts/reliefos/Makefile.rootfs b/scripts/reliefos/Makefile.rootfs index bfe9ab50..261b6e0c 100644 --- a/scripts/reliefos/Makefile.rootfs +++ b/scripts/reliefos/Makefile.rootfs @@ -10,7 +10,7 @@ ROOTFS_SOURCE_DIRS := $(RELIEFOS_SRC)/system $(RELIEFOS_SRC)/resources/build-art ROOTFS_SOURCE_DIRS += $(RELIEFOS_SRC)/resources/reliefmath $(RELIEFOS_SRC)/resources/licenses/reliefmath ROOTFS_SOURCE_DIRS += $(RELIEFOS_SRC)/userland/fastfetch $(RELIEFOS_SRC)/logo.png $(RELIEFOS_SRC)/test/test.mp3 $(RELIEFOS_SRC)/Documentation/admin-guide/packages.rst $(RELIEFOS_SRC)/configs/apk-ownership.json ROOTFS_SOURCE_DIRS += $(wildcard $(addprefix $(RELIEFOS_SRC)/third_party/,busybox/LICENSE pl_editor/LICENSE)) -ROOTFS_SOURCE_DIRS += $(RELIEFOS_SRC)/tools/build/rpr-config.sh $(addprefix $(RELIEFOS_SRC)/resources/licenses/,sl-LICENSE ncurses-LICENSE sqlite-LICENSE zlib-LICENSE libpng-LICENSE mbedtls3-LICENSE libbsd-LICENSE e2fsprogs-NOTICE) +ROOTFS_SOURCE_DIRS += $(RELIEFOS_SRC)/tools/build/rpr-config.sh $(addprefix $(RELIEFOS_SRC)/resources/licenses/,sl-LICENSE ncurses-LICENSE sqlite-LICENSE zlib-LICENSE libpng-LICENSE mbedtls3-LICENSE libbsd-LICENSE e2fsprogs-NOTICE util-linux-README.licensing libeconf-LICENSE utmps-COPYING) $(O_META)/rootfs-sources.parameters: FORCE $(RELIEFOS_SRC)/tools/build/tree-signature.sh $(Q)sh $(RELIEFOS_SRC)/tools/build/tree-signature.sh $@ $(ROOTFS_SOURCE_DIRS) ROOTFS_UPSTREAM_PRODUCTS = $(foreach package,$(UPSTREAM_PACKAGES),$(UPSTREAM_ROOT)/$(package)/root/.complete $(upstream_$(package)_products)) diff --git a/scripts/reliefos/Makefile.upstream b/scripts/reliefos/Makefile.upstream index a99d03d6..7ecc0bfc 100644 --- a/scripts/reliefos/Makefile.upstream +++ b/scripts/reliefos/Makefile.upstream @@ -1,9 +1,8 @@ # Include after third-party.mk, pam.mk and runtime.mk. Each package owns an isolated root. UPSTREAM_ROOT := $(O)/upstream UPSTREAM_SCRIPT := $(RELIEFOS_SRC)/tools/build/upstream.sh -UPSTREAM_PACKAGES := libmd util-linux sudo shadow exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg +UPSTREAM_PACKAGES := libmd sudo shadow exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg upstream_libmd_outputs := lib/libmd.so.0 usr/include/md5.h -upstream_util-linux_outputs := usr/lib/libuuid.a usr/lib/libblkid.a bin/su usr/sbin/fdisk bin/mount bin/lsblk upstream_sudo_outputs := usr/bin/sudo usr/lib/sudo/sudoers.so upstream_shadow_outputs := bin/login usr/sbin/useradd usr/sbin/usermod usr/sbin/userdel upstream_exfatprogs_outputs := usr/sbin/mkfs.exfat usr/sbin/fsck.exfat diff --git a/tests/build/test-apk-permissions.sh b/tests/build/test-apk-permissions.sh new file mode 100644 index 00000000..9a7ae381 --- /dev/null +++ b/tests/build/test-apk-permissions.sh @@ -0,0 +1,72 @@ +#!/bin/sh +set -eu +repo=$(CDPATH='' cd -- "$(dirname "$0")/../.." && pwd -P) +work=$(mktemp -d) +trap 'rm -rf "$work"' 0 +trap 'exit 130' HUP INT TERM +mkdir -p "$work/root/usr/bin" "$work/root/lib/apk/db" \ + "$work/root/install/root/usr/bin" "$work/root/install/root/lib/apk/db" "$work/outside" +for root in "$work/root" "$work/root/install/root"; do + printf 'fixture\n' >"$root/usr/bin/wall utility" + printf 'fixture\n' >"$root/usr/bin/su" + mkdir "$root/restricted" + cat >"$root/lib/apk/db/installed" <<'DB' +P:util-linux-misc +V:2.42.4-r3 +F:usr +F:usr/bin +R:wall utility +a:0:5:2755 +Z:fixture +R:su +a:0:0:4755 +Z:fixture +F:restricted +M:0:0:550 + +DB +done +# shellcheck disable=SC2016 # Variables are evaluated inside the fakeroot shell. +FAKEROOTDONTTRYCHOWN=1 fakeroot -- sh -eu -c ' + sh "$1/tools/build/apk-permissions.sh" "$2/root" + for root in "$2/root" "$2/root/install/root"; do + test "$(stat -c "%u:%g:%a" "$root/usr/bin/wall utility")" = 0:5:2755 + test "$(stat -c "%u:%g:%a" "$root/usr/bin/su")" = 0:0:4755 + test "$(stat -c "%u:%g:%a" "$root/restricted")" = 0:0:550 + done +' sh "$repo" "$work" +# Verify the real ext4 output, not only fakeroot stat results. +for root in "$work/root" "$work/root/install/root"; do + chmod 755 "$root/usr/bin/su" "$root/usr/bin/wall utility" + chmod 750 "$root/restricted" +done +${HOSTCC:-cc} -std=c11 -O2 -Wall -Wextra -Werror \ + "$repo/tools/host/images/reliefos-ext2-time.c" -lext2fs -lcom_err -o "$work/time" +RELIEFOS_EXT4_TIME=$work/time sh "$repo/tools/build/images.sh" ext4 "$work/root" \ + "$work/root.ext4" 1700000000 5c13543b-732c-4f81-8652-621124484420 >"$work/image.log" 2>&1 +for prefix in '' /install/root; do + # debugfs requires quoting for filenames containing spaces. + debugfs -R "stat \"$prefix/usr/bin/wall utility\"" "$work/root.ext4" >"$work/stat" 2>/dev/null + grep -Eq 'User: +0 +Group: +5' "$work/stat" + grep -q '2755' "$work/stat" + debugfs -R "stat $prefix/usr/bin/su" "$work/root.ext4" >"$work/stat" 2>/dev/null + grep -q '4755' "$work/stat" +done +test "$(stat -c %a "$work/root/usr/bin/su")" = 755 +cp "$work/root/lib/apk/db/installed" "$work/good" +for acl in '0:5:889' 'root:5:2755' '0:5' '0:5:2755:extra'; do + sed "s@a:0:5:2755@a:$acl@" "$work/good" >"$work/root/lib/apk/db/installed" + if FAKEROOTDONTTRYCHOWN=1 fakeroot -- sh "$repo/tools/build/apk-permissions.sh" "$work/root"; then + echo 'invalid ACL accepted' >&2; exit 1 + fi +done +sed 's@R:wall utility@R:../outside@' "$work/good" >"$work/root/lib/apk/db/installed" +if FAKEROOTDONTTRYCHOWN=1 fakeroot -- sh "$repo/tools/build/apk-permissions.sh" "$work/root"; then + echo 'traversal accepted' >&2; exit 1 +fi +ln -s "$work/outside" "$work/root/redirect" +sed 's@F:usr/bin@F:redirect@' "$work/good" >"$work/root/lib/apk/db/installed" +if FAKEROOTDONTTRYCHOWN=1 fakeroot -- sh "$repo/tools/build/apk-permissions.sh" "$work/root"; then + echo 'escaping parent accepted' >&2; exit 1 +fi +printf 'APK permissions: numeric ACLs, setgid, nested payloads and invalid paths passed\n' diff --git a/tests/build/test-desktop-backend.sh b/tests/build/test-desktop-backend.sh index 5211e628..81f27ac1 100755 --- a/tests/build/test-desktop-backend.sh +++ b/tests/build/test-desktop-backend.sh @@ -33,7 +33,6 @@ cp logo.png "$work/src/logo.png" mkdir -p "$work/out/upstream/sudo/root/usr/bin" \ "$work/out/upstream/shadow/root/usr/bin" \ - "$work/out/upstream/util-linux/root/bin" \ "$work/out/pam/root/sbin" \ "$work/out/sysroot/musl/lib" \ "$work/out/sysroot/musl/share/licenses/musl" \ @@ -43,7 +42,6 @@ mkdir -p "$work/out/upstream/sudo/root/usr/bin" \ "$work/out/userland" printf '%s\n' fixture > "$work/out/upstream/sudo/root/usr/bin/sudo" printf '%s\n' fixture > "$work/out/upstream/shadow/root/usr/bin/passwd" -printf '%s\n' fixture > "$work/out/upstream/util-linux/root/bin/su" printf '%s\n' fixture > "$work/out/pam/root/sbin/unix_chkpwd" printf '%s\n' fixture > "$work/out/sysroot/musl/lib/libc.so" printf '%s\n' fixture > "$work/out/sysroot/musl/lib/libmimalloc.so.3" @@ -136,7 +134,7 @@ cat > "$work/rootfs.config" < "$work/metadata-no-player" -ROOTFS_UPSTREAM_PACKAGES='sudo shadow util-linux fixture-provider ffmpeg netsurf' \ +ROOTFS_UPSTREAM_PACKAGES='sudo shadow fixture-provider ffmpeg netsurf' \ sh "$repo_root/tools/build/rootfs-stage.sh" "$work/src" "$work/out" \ "$work/rootfs.config" "$work/metadata-no-player" "$work/stage" "$work/layout" \ "$work/root-no-player" "$work/no-player-manifest.json" 1700000000 @@ -204,7 +202,7 @@ done # Removing the selected app from component metadata excludes every private # product while leaving the shared system CJK font in the composed root. awk -F '\t' '$1!="reliefmath"' "$work/metadata" > "$work/metadata-no-reliefmath" -ROOTFS_UPSTREAM_PACKAGES='sudo shadow util-linux fixture-provider' \ +ROOTFS_UPSTREAM_PACKAGES='sudo shadow fixture-provider' \ sh "$repo_root/tools/build/rootfs-stage.sh" "$work/src" "$work/out" \ "$work/rootfs.config" "$work/metadata-no-reliefmath" "$work/stage" "$work/layout" \ "$work/root-no-reliefmath" "$work/no-reliefmath-manifest.json" 1700000000 diff --git a/tests/build/test-util-linux-development.sh b/tests/build/test-util-linux-development.sh new file mode 100644 index 00000000..1d86628f --- /dev/null +++ b/tests/build/test-util-linux-development.sh @@ -0,0 +1,152 @@ +#!/bin/sh +# Offline adapter publication/integrity tests; no downloads or target execution. +set -eu +LC_ALL=C +export LC_ALL +repo=$(CDPATH='' cd -- "$(dirname "$0")/../.." && pwd -P) +mkdir -p "${TMPDIR:-$repo/out/tmp}" +work=$(mktemp -d "${TMPDIR:-$repo/out/tmp}/util-linux-development.XXXXXX") +trap 'rm -rf "$work"' 0 +trap 'exit 130' HUP INT TERM +export FIXTURE_WORK="$work" +mkdir -p "$work/source/resources/licenses" "$work/source/system/rootfs/etc/apk/keys" \ + "$work/bin" "$work/cache" "$work/good" "$work/digests" +cp "$repo/resources/licenses/util-linux-README.licensing" "$work/source/resources/licenses/" +printf 'fixture\n' >"$work/lock" +real_mv=$(command -v mv) +export FIXTURE_MV="$real_mv" +cat >"$work/bin/deps" <<'SH' +#!/bin/sh +set -eu +[ "$#" = 6 ] && [ "$1" = --lock ] && [ "$3" = --id ] && [ "$5" = --print ] +case $4 in alpine-*) name=${4#alpine-};; runtime-dev-*) name=${4#runtime-dev-};; *) exit 2;; esac +case $6 in + url) printf 'https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/%s-1.0-r0.apk\n' "$name";; + sha256) cat "$FIXTURE_WORK/digests/$name";; + version) printf '1.0-r0\n';; + *) exit 2;; +esac +SH +cat >"$work/bin/apk" <<'SH' +#!/bin/sh +set -eu +[ "$#" = 4 ] && [ "$1" = --keys-dir ] && [ "$3" = verify ] +printf 'verified\n' >>"$FIXTURE_WORK/verifications" +[ "${FAIL_VERIFY:-0}" != 1 ] +SH +cat >"$work/bin/mv" <<'SH' +#!/bin/sh +set -eu +if [ "$#" = 2 ] && [ "$2" = "${FAIL_DEST:-}" ] && [ -f "$FIXTURE_WORK/fail-once" ]; then + rm "$FIXTURE_WORK/fail-once" + exit 9 +fi +exec "$FIXTURE_MV" "$@" +SH +chmod +x "$work/bin/"* +python3 - "$work" <<'PY' +import io +from pathlib import Path +import sys +import tarfile + +work = Path(sys.argv[1]) +packages = {name: {} for name in ('libblkid', 'libuuid', 'libeconf', 'util-linux-dev', + 'util-linux-static', 'libeconf-dev', 'libeconf-static')} +for lib, package in (('blkid', 'util-linux'), ('uuid', 'util-linux'), ('econf', 'libeconf')): + packages['lib' + lib]['usr/lib/lib' + lib + '.so.1'] = b'fixture library\n' + packages[package + '-dev']['usr/lib/lib' + lib + '.so'] = ('link', 'lib' + lib + '.so.1') + packages[package + '-dev']['usr/lib/pkgconfig/' + ('libeconf' if lib == 'econf' else lib) + '.pc'] = ( + 'prefix=/usr\nexec_prefix=/usr\nlibdir=/usr/lib\nincludedir=/usr/include\n' + f'Name: {lib}\nDescription: fixture\nVersion: 1.0\n' + f'Libs: -L${{libdir}} -l{lib}\nCflags: -I${{includedir}}\n').encode() + packages[package + '-static']['usr/lib/lib' + lib + '.a'] = b'fixture archive\n' +packages['util-linux-dev'].update({ + 'usr/include/blkid/blkid.h': b'fixture header\n', + 'usr/include/blkid/nested/extra.h': b'fixture nested header\n', + 'usr/include/uuid/uuid.h': b'fixture header\n', + 'usr/include/linux/types.h': b'unrelated header\n', + 'usr/lib/libfdisk.a': b'unrelated static archive\n'}) +packages['libeconf-dev']['usr/include/libeconf.h'] = b'fixture header\n' +for name, payload in packages.items(): + payload['.PKGINFO'] = f'pkgname = {name}\npkgver = 1.0-r0\narch = x86_64\n'.encode() + with tarfile.open(work / 'good' / f'{name}-1.0-r0.apk', 'w:gz') as archive: + for path, data in payload.items(): + member = tarfile.TarInfo(path) + if isinstance(data, tuple): + member.type, member.linkname = tarfile.SYMTYPE, data[1] + archive.addfile(member) + else: + member.size = len(data) + archive.addfile(member, io.BytesIO(data)) +PY +reset_cache() { + cp "$work/good/"*.apk "$work/cache/" + for archive in "$work/cache/"*.apk; do + name=${archive##*/}; name=${name%-1.0-r0.apk} + sum=$(sha256sum "$archive") + printf '%s\n' "${sum%% *}" >"$work/digests/$name" + done + : >"$work/verifications" +} +output=$work/out\ with\ spaces/root +invoke() { + PATH="$work/bin:$PATH" sh "$repo/tools/build/util-linux-development.sh" \ + "$work/source" "$work/bin/deps" "$work/lock" "$work/cache" "$work/bin/apk" "$output" +} +snapshot() { + (cd "$output" && find . -printf '%y %p %l\n' && find . -type f -exec sha256sum {} \;) | sort +} +expect_failure() { + if invoke >"$work/failure.log" 2>&1; then echo 'accepted invalid input/publication' >&2; exit 1; fi + snapshot >"$work/after" + cmp "$work/before" "$work/after" + cmp "$work/before.files" "$output.files" + test -z "$(find "$(dirname "$output")" -maxdepth 1 -name '.root.new.*' -print)" +} +reset_cache +invoke +test "$(wc -l <"$work/verifications" | tr -d ' ')" = 7 +test -s "$output/usr/include/blkid/nested/extra.h" +test ! -e "$output/usr/include/linux/types.h" +test ! -e "$output/usr/lib/libfdisk.a" +test ! -e "$output/bin" +(cd "$output" && find . ! -type d -print | sed 's@^./@@' | sort) >"$work/expected.files" +cmp "$work/expected.files" "$output.files" +cp -a "$output" "$work/relocated" +for module in blkid uuid libeconf; do + libdir=$(PKG_CONFIG_PATH='' PKG_CONFIG_LIBDIR="$work/relocated/usr/lib/pkgconfig" pkg-config --variable=libdir "$module") + test "$(CDPATH='' cd -- "$libdir" && pwd -P)" = "$work/relocated/usr/lib" +done +snapshot >"$work/before" +cp "$output.files" "$work/before.files" +: >"$work/verifications" +printf 'corrupt\n' >>"$work/cache/libblkid-1.0-r0.apk" +expect_failure +test ! -s "$work/verifications" +reset_cache +FAIL_VERIFY=1 expect_failure +reset_cache +rm "$work/cache/libeconf-static-1.0-r0.apk" +expect_failure +reset_cache +for destination in "$output" "$output.files"; do + touch "$work/fail-once" + FAIL_DEST=$destination expect_failure +done +# A missing non-primary input must invalidate the inventory and be restored. +touch -t 200001010000 "$work/presence" +cp -p "$work/presence" "$work/old-presence" +rm "$output/usr/include/blkid/nested/extra.h" +sh "$repo/tools/build/upstream-verify.sh" "$output" "$output.files" "$work/presence" +test "$work/presence" -nt "$work/old-presence" +invoke +test -s "$output/usr/include/blkid/nested/extra.h" +snapshot >"$work/after" +cmp "$work/before" "$work/after" +for rejected in "$work/source/resources/licenses" "$work/cache" "$output/.."; do + if PATH="$work/bin:$PATH" sh "$repo/tools/build/util-linux-development.sh" \ + "$work/source" "$work/bin/deps" "$work/lock" "$work/cache" "$work/bin/apk" "$rejected" \ + >"$work/failure.log" 2>&1; then echo "accepted input overlap: $rejected" >&2; exit 1; fi +done +printf 'util-linux development: isolated inputs, relocation, signatures, rollback and inventory recovery passed\n' diff --git a/tests/integration/apk-base-migration.sh b/tests/integration/apk-base-migration.sh index 6237f105..b346d6b4 100644 --- a/tests/integration/apk-base-migration.sh +++ b/tests/integration/apk-base-migration.sh @@ -14,8 +14,8 @@ for entry in sbin/mkfs.ext4:e2fsprogs sbin/fsck.ext2:e2fsprogs sbin/mkfs.fat:dos apk info --who-owns "/$path" | grep -F "owned by $owner-" done apk info --who-owns /lib/libmd.so.0 | grep -F 'owned by reliefos-auth-support-libraries-' -apk info --who-owns /usr/lib/libblkid.so.1 | grep -F 'owned by reliefos-storage-util-linux-' -apk info --who-owns /usr/lib/libuuid.so.1 | grep -F 'owned by reliefos-storage-util-linux-' +apk info --who-owns /usr/lib/libblkid.so.1 | grep -F 'owned by libblkid-' +apk info --who-owns /usr/lib/libuuid.so.1 | grep -F 'owned by libuuid-' test ! -e /lib/libbsd.so.0 test ! -e /usr/include/bsd test ! -e /usr/include/ext2fs diff --git a/tests/integration/apk-util-linux-migration.sh b/tests/integration/apk-util-linux-migration.sh new file mode 100644 index 00000000..24189070 --- /dev/null +++ b/tests/integration/apk-util-linux-migration.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# Run as root in a disposable signed root or ReliefOS guest. Only regular +# files in a new private directory are partitioned here; no device is written. +set -eu +PATH=/usr/sbin:/usr/bin:/sbin:/bin +export PATH +test "$(id -u)" = 0 +for package in util-linux util-linux-misc util-linux-login runuser lsblk sfdisk blkid \ + mount umount setarch libblkid libuuid libmount libfdisk libsmartcols liblastlog2 \ + libeconf utmps-libs skalibs-libs util-linux-doc util-linux-login-doc; do + apk info -e "$package" +done +for entry in bin/mount:mount bin/umount:umount bin/lsblk:lsblk sbin/sfdisk:sfdisk \ + sbin/blkid:blkid sbin/fdisk:util-linux-misc bin/su:util-linux-login sbin/runuser:runuser \ + bin/login:reliefos-authentication usr/bin/newgrp:reliefos-authentication \ + sbin/nologin:reliefos-authentication etc/pam.d/su-l:reliefos-authentication \ + usr/lib/libblkid.so.1:libblkid usr/lib/libuuid.so.1:libuuid; do + path=${entry%:*} owner=${entry#*:} + apk info --who-owns "/$path" | grep -F "owned by $owner-" +done +for command in fdisk sfdisk runuser fsck blkid; do + test "$(readlink "/usr/sbin/$command")" = "../../sbin/$command" + test -x "/sbin/$command" +done +for command in mount umount lsblk; do + test "$(readlink "/usr/bin/$command")" = "../../bin/$command" + test -x "/bin/$command" +done +test "$(stat -c %a /bin/su)" = 4755 +test "$(stat -c %u /bin/su)" = 0 +# The source archive/database must retain the original root:5 setgid wall. +test "$(stat -c '%u:%g:%a' /usr/bin/wall)" = 0:5:2755 +for path in usr/include/blkid usr/include/uuid usr/include/libeconf.h usr/lib/libblkid.a \ + usr/lib/libuuid.a usr/lib/libeconf.a; do test ! -e "/$path"; done +for command in fdisk sfdisk lsblk blkid mount umount su runuser; do + "$command" --version | grep -F 'util-linux' +done +work=$(mktemp -d /tmp/apk-util-linux.XXXXXX) +trap 'rm -rf "$work"' 0 +trap 'exit 130' HUP INT TERM +truncate -s 64M "$work/gpt.img" +printf 'label: gpt\n,24M,U\n,,L\n' | sfdisk --no-reread --no-tell-kernel "$work/gpt.img" +sfdisk --verify "$work/gpt.img" +sfdisk --json "$work/gpt.img" >"$work/partitions.json" +grep -Fi 'C12A7328-F81F-11D2-BA4B-00A0C93EC93B' "$work/partitions.json" +grep -Fi '0FC63DAF-8483-4772-8E79-3D69D8477DE4' "$work/partitions.json" +fdisk -l "$work/gpt.img" +test "$(runuser -u nobody -- id -u)" = "$(id -u nobody)" +test "$(su -s /bin/sh nobody -c 'id -u')" = "$(id -u nobody)" +# An unprivileged runuser must fail, without relying on a password prompt. +runuser -u nobody -- /bin/sh -c 'if runuser -u root -- id; then exit 1; fi' +printf '%s\n' 'PASS: official util-linux packages, ownership, aliases, GPT files and PAM identities' diff --git a/tests/integration/upstream-incremental.sh b/tests/integration/upstream-incremental.sh index 52256a6a..7852375e 100755 --- a/tests/integration/upstream-incremental.sh +++ b/tests/integration/upstream-incremental.sh @@ -30,4 +30,12 @@ test -f "$secondary" rm "$secondary" make -C "$src" O="$make_out" upstream-dosfstools -j8 > "$work/restore.log" 2>&1 || { cat "$work/restore.log" >&2; exit 1; } test -f "$secondary" +# Development inputs are isolated too, and every selected member must be +# recovered even when it is not one of the Make rule's primary headers. +secondary=$out/upstream/util-linux/root/usr/include/libeconf_ext.h +test -s "$secondary" +expected=$(sha256sum "$secondary") +rm "$secondary" +make -C "$src" O="$make_out" util-linux-development -j8 > "$work/restore-util-linux.log" 2>&1 || { cat "$work/restore-util-linux.log" >&2; exit 1; } +test "$(sha256sum "$secondary")" = "$expected" printf '%s\n' 'upstream no-op mtimes and secondary-output restoration: PASS' diff --git a/tests/integration/upstream-products.sh b/tests/integration/upstream-products.sh index 4071e879..78a966b5 100755 --- a/tests/integration/upstream-products.sh +++ b/tests/integration/upstream-products.sh @@ -3,7 +3,7 @@ set -eu root=${1:?usage: upstream-products.sh UPSTREAM_ROOT} apps=${2:-$root/../userland} -for entry in libmd/lib/libmd.so.0 libbsd/usr/lib/libbsd.so.0 util-linux/bin/su util-linux/bin/mount util-linux/bin/lsblk util-linux/usr/sbin/fdisk sudo/usr/bin/sudo sudo/usr/lib/sudo/sudoers.so shadow/bin/login shadow/usr/sbin/useradd shadow/usr/sbin/usermod shadow/usr/sbin/userdel exfatprogs/usr/sbin/mkfs.exfat exfatprogs/usr/sbin/fsck.exfat; do +for entry in libmd/lib/libmd.so.0 libbsd/usr/lib/libbsd.so.0 sudo/usr/bin/sudo sudo/usr/lib/sudo/sudoers.so shadow/bin/login shadow/usr/sbin/useradd shadow/usr/sbin/usermod shadow/usr/sbin/userdel exfatprogs/usr/sbin/mkfs.exfat exfatprogs/usr/sbin/fsck.exfat; do pkg=${entry%%/*}; path=$root/$pkg/root/${entry#*/} test -f "$path" readelf -h "$path" | grep -q 'Advanced Micro Devices X86-64' @@ -12,7 +12,7 @@ for entry in libmd/lib/libmd.so.0 libbsd/usr/lib/libbsd.so.0 util-linux/bin/su u esac done src=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) -for package in libbsd libbsd-doc dosfstools dosfstools-doc e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc ncurses ncurses-terminfo; do +for package in libbsd libbsd-doc dosfstools dosfstools-doc e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc ncurses ncurses-terminfo util-linux util-linux-misc util-linux-login runuser blkid lsblk sfdisk mount umount libblkid libuuid libmount libfdisk libsmartcols; do set -- "$root/apk/packages/$package-"[0-9]*.apk test "$#" = 1 && test -s "$1" "$root/apk/apk.static" --keys-dir "$src/system/rootfs/etc/apk/keys" verify "$1" diff --git a/tools/apk_ownership.py b/tools/apk_ownership.py index b7bd5219..b87635ce 100644 --- a/tools/apk_ownership.py +++ b/tools/apk_ownership.py @@ -16,7 +16,7 @@ import tomli as tomllib import reliefos_layout as layout -from storage_tools import FORMATTER_COMMANDS, UTIL_LINUX_COMMANDS, UTIL_LINUX_LIBRARIES +from storage_tools import FORMATTER_COMMANDS ROOT = Path(__file__).resolve().parents[1] @@ -63,8 +63,6 @@ def claim(path, group): claim(stem + suffix, group) if set(owners) & set(upstream) or set(owners) | set(upstream) != expected: raise ValueError(f"component policy mismatch: {sorted((set(owners) | set(upstream)) ^ expected)}") - for path in (*UTIL_LINUX_COMMANDS, *UTIL_LINUX_LIBRARIES): - claim(path, "storage-util-linux") for path in FORMATTER_COMMANDS: claim(path, "storage-filesystems") return policy, rules diff --git a/tools/build/apk-permissions.sh b/tools/build/apk-permissions.sh new file mode 100644 index 00000000..24016383 --- /dev/null +++ b/tools/build/apk-permissions.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# Called under fakeroot by images.sh. Restore numeric owners, special mode +# bits and restricted directories affected by rootless APK extraction. +set -eu +[ "$#" = 1 ] || exit 2 +root=$(CDPATH='' cd -- "$1" && pwd -P) +work=$(mktemp -d) +trap 'rm -rf "$work"' 0 +trap 'exit 130' HUP INT TERM +for tree in "$root" "$root/install/root" "$root/install/root-console"; do + database=$tree/lib/apk/db/installed + [ -f "$database" ] || continue + [ ! -L "$database" ] || { echo 'symlink APK database' >&2; exit 1; } + awk ' + function emit(path,acl,isdir, n,a,i) { + n=split(acl,a,":") + if (n!=3 || a[1]!~/^[0-9]+$/ || a[2]!~/^[0-9]+$/ || a[3]!~/^[0-7]+$/) exit 1 + if (a[1]==0 && a[2]==0 && a[3]+0<1000 && + (!isdir || substr(a[3],length(a[3])-2,1) ~ /^[37]$/)) return + if (path ~ /^\// || path ~ /[\t\r]/) exit 1 + n=split(path,p,"/") + for (i=1;i<=n;i++) if (p[i]=="" || p[i]=="." || p[i]=="..") exit 1 + printf "%s\t%s\t%s\t%s\n",a[1],a[2],a[3],path + } + function flush() {if (file!="") emit((directory!="" ? directory "/" : "") file,acl,0); file=""} + /^F:/ {flush(); directory=substr($0,3); next} + /^M:/ {emit(directory,substr($0,3),1); next} + /^R:/ {flush(); file=substr($0,3); acl="0:0:644"; next} + /^a:/ {acl=substr($0,3); next} + /^$/ {flush(); directory=""} + END {flush()} + ' "$database" >"$work/acl" + while IFS="$(printf '\t')" read -r uid gid mode path; do + # Resolve parents as well: no archive link may redirect chown/chmod + # outside this private image tree, even for an otherwise valid path. + parent=$(CDPATH='' cd -- "$(dirname "$tree/$path")" && pwd -P) + case $parent in "$root"|"$root"/*) ;; *) echo "escaping APK path: $path" >&2; exit 1;; esac + test -e "$tree/$path" || test -L "$tree/$path" + chown -h "$uid:$gid" "$tree/$path" + if [ ! -L "$tree/$path" ]; then chmod "$mode" "$tree/$path"; fi + done <"$work/acl" +done diff --git a/tools/build/apk-stage.sh b/tools/build/apk-stage.sh index 54cc4085..992f1338 100644 --- a/tools/build/apk-stage.sh +++ b/tools/build/apk-stage.sh @@ -27,8 +27,8 @@ done # Package triggers must execute chrooted inside the target root: they invoke # target-root tools by bare name or absolute path and write caches to -# compiled-in absolute paths. fakeroot cannot chroot, so without user -# namespaces the transaction would run trigger scripts against the host. +# compiled-in absolute paths. apk's upstream usermode performs its own +# namespace/chroot setup, while retaining numeric owners in its real database. unshare -Ur true >/dev/null 2>&1 || { echo 'APK staging requires user namespaces (unshare -Ur): package triggers must run chrooted inside the target root' >&2; exit 1; } @@ -172,8 +172,8 @@ fi # Files from pinned official archives retain their upstream signatures and # package ownership. The verified APK archive member list is the authority for -# their file paths; metadata members are not root payload. Only the five XDM -# policy files are retained for the signed reliefos-xdm-config replacement. +# their file paths; metadata members are not root payload. Product XDM/PAM +# policy and existing shadow tools have explicit signed local replacements. while IFS= read -r archive; do cp "$archive" "$repository/" tar --ignore-zeros -xOf "$archive" .PKGINFO >"$scratch/upstream-pkginfo" 2>/dev/null @@ -187,6 +187,14 @@ while IFS= read -r archive; do case $path in ''|.*|*/) continue;; esac case $path in /*|*../*|../*|*" "*) echo "unsafe upstream APK path: $path" >&2; exit 1;; esac case $backend:$upstream_name:$path in + *:util-linux-login:bin/login|*:util-linux-login:usr/bin/newgrp|\ + *:util-linux-login:sbin/nologin|*:util-linux-login:etc/pam.d/su-l) + [ -f "$tree/$path" ] && [ ! -L "$tree/$path" ] || { + echo "missing regular shadow/PAM product file: $path" >&2 + exit 1 + } + continue + ;; xorg:xdm:etc/X11/xdm/xdm-config|xorg:xdm:etc/X11/xdm/Xservers|\ xorg:xdm:etc/X11/xdm/Xresources|xorg:xdm:usr/lib/X11/xdm/Xsession|\ xorg:xdm:usr/lib/X11/xdm/Xsetup_0) @@ -349,10 +357,16 @@ fi run_apk() { - if [ "$1" = mkpkg ]; then apk_log=$work/logs/$package.log - else apk_log=$work/logs/install.log + if [ "$1" = mkpkg ]; then + sh "$src/tools/build/run-logged.sh" --tag APK "$work/logs/$package.log" unshare -Ur "$apk" "$@" + elif [ "$(id -u)" = 0 ]; then + sh "$src/tools/build/run-logged.sh" --tag APK "$work/logs/install.log" "$apk" "$@" + else + # A single-ID namespace cannot chown official root:tty files (wall). + # Usermode is apk's supported rootless extraction mode, not a forced + # transaction. images.sh restores the database ACLs under fakeroot. + sh "$src/tools/build/run-logged.sh" --tag APK "$work/logs/install.log" "$apk" --usermode "$@" fi - sh "$src/tools/build/run-logged.sh" --tag APK "$apk_log" unshare -Ur "$apk" "$@" } : >"$scratch/local-packages" @@ -399,6 +413,8 @@ while IFS= read -r group; do # Their real dependencies pull the migrated tools into older systems # in the same signed transaction that upgrades the former file owner. reliefos-auth-support-libraries) dependencies="$dependencies libbsd libbsd-doc" ;; + reliefos-authentication) dependencies="$dependencies util-linux-login" ;; + reliefos-storage-util-linux) dependencies="$dependencies util-linux util-linux-misc util-linux-login runuser blkid lsblk sfdisk mount umount libblkid libfdisk libmount libsmartcols libuuid util-linux-doc util-linux-login-doc" ;; reliefos-storage-filesystems) dependencies="$dependencies e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc dosfstools dosfstools-doc" ;; reliefos-kernel) dependencies="$dependencies reliefos-grub=$version" ;; # Upgrade old console images whose former local CA package contained @@ -419,6 +435,9 @@ while IFS= read -r group; do replaces= case $package in reliefos-*) replaces="leonos-${package#reliefos-}";; esac [ "$package" != reliefos-xdm-config ] || replaces="$replaces xdm" + # util-linux bundles su with shadow-owned login/newgrp/nologin and su-l + # policy. The official su and runuser payloads keep their original owners. + [ "$package" != reliefos-authentication ] || replaces="$replaces util-linux-login" # Old images recorded the transferred command paths as BusyBox files. # APK must hand those paths to GNU in the same transaction that upgrades # BusyBox; an overwrite/force flag would conceal a packaging conflict. diff --git a/tools/build/images.sh b/tools/build/images.sh index f83b5abd..f5316100 100644 --- a/tools/build/images.sh +++ b/tools/build/images.sh @@ -3,6 +3,7 @@ set -eu [ "$#" -ge 1 ] || exit 2 mode=$1; shift +build_dir=$(CDPATH='' cd -- "$(dirname "$0")" && pwd -P) case $mode in ext2) [ "$#" = 4 ] || exit 2 @@ -26,13 +27,14 @@ ext2) # fakeroot intercepts chown/stat; real host privileges are unnecessary. E2FSPROGS_FAKE_TIME="$epoch" FAKEROOTDONTTRYCHOWN=1 fakeroot -- sh -eu -c ' find "$1" -exec chown -h 0:0 {} + + sh "$5" "$1" if [ -f "$1/etc/reliefos/test-image" ]; then test "$(cat "$1/etc/reliefos/test-image")" = leonos-standalone-test-v1 test ! -L "$1/home/test" find "$1/home/test" -exec chown -h 1000:1000 {} + fi mke2fs -q -t ext2 -F -b 4096 -I 128 -O none,filetype,sparse_super,large_file -m 0 -E root_owner=0:0,hash_seed="$4" -U "$4" -N "$3" -d "$1" "$2" - ' sh "$work/root" "$work/root.ext2" "$inodes" "$uuid" + ' sh "$work/root" "$work/root.ext2" "$inodes" "$uuid" "$build_dir/apk-permissions.sh" reliefos_ext2_time=${RELIEFOS_EXT2_TIME:-${LEONOS_EXT2_TIME:-}} : "${reliefos_ext2_time:?ext2 timestamp tool required}" "$reliefos_ext2_time" "$work/root.ext2" "$epoch" @@ -59,13 +61,14 @@ ext4) truncate -s "${mib}M" "$work/root.ext4" E2FSPROGS_FAKE_TIME="$epoch" FAKEROOTDONTTRYCHOWN=1 fakeroot -- sh -eu -c ' find "$1" -exec chown -h 0:0 {} + + sh "$5" "$1" if [ -f "$1/etc/reliefos/test-image" ]; then test "$(cat "$1/etc/reliefos/test-image")" = leonos-standalone-test-v1 test ! -L "$1/home/test" find "$1/home/test" -exec chown -h 1000:1000 {} + fi mke2fs -q -t ext4 -F -b 4096 -I 256 -O none,filetype,extents,dir_index,metadata_csum,64bit,flex_bg,has_journal,large_file,huge_file,extra_isize -m 0 -E root_owner=0:0,hash_seed="$4" -U "$4" -N "$3" -d "$1" "$2" - ' sh "$work/root" "$work/root.ext4" "$inodes" "$uuid" + ' sh "$work/root" "$work/root.ext4" "$inodes" "$uuid" "$build_dir/apk-permissions.sh" reliefos_ext4_time=${RELIEFOS_EXT4_TIME:-${RELIEFOS_EXT2_TIME:-${LEONOS_EXT2_TIME:-}}} : "${reliefos_ext4_time:?ext4 timestamp tool required}" "$reliefos_ext4_time" "$work/root.ext4" "$epoch" diff --git a/tools/build/rootfs-stage.sh b/tools/build/rootfs-stage.sh index 5f312c5f..9702811c 100644 --- a/tools/build/rootfs-stage.sh +++ b/tools/build/rootfs-stage.sh @@ -19,7 +19,7 @@ link() { record l "$2" "/$1" 0777 "${3:-reliefos-base}" "${4:-unique}"; } enabled() { awk -F '\t' -v id="$1" '$1==id && $4==1 {found=1} END {exit !found}' "$metadata"; } # Every enabled upstream root is passed by the build graph. The default keeps # standalone callers compatible with the complete product package set. -rootfs_upstream_packages=${ROOTFS_UPSTREAM_PACKAGES:-'libmd util-linux sudo shadow exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg'} +rootfs_upstream_packages=${ROOTFS_UPSTREAM_PACKAGES:-'libmd sudo shadow exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg'} for package in $rootfs_upstream_packages; do if [ "$package" = ffmpeg ]; then if enabled reliefplayer; then @@ -35,7 +35,7 @@ for package in $rootfs_upstream_packages; do continue fi case $package in - libbsd|e2fsprogs|dosfstools) + libbsd|e2fsprogs|dosfstools|util-linux) echo "rootfs-stage: $package is supplied by official APKs; remove its local overlay" >&2 exit 1 ;; @@ -103,7 +103,7 @@ done for name in shadow gshadow; do file "$src/system/rootfs/etc/$name" "etc/$name" 0600 product-policy override; done file "$src/system/rootfs/etc/sudoers" etc/sudoers 0440 product-policy override # Regular program modes remain explicit even when copied from a tool's stage. -for spec in 'sudo usr/bin/sudo' 'shadow usr/bin/passwd' 'util-linux bin/su'; do +for spec in 'sudo usr/bin/sudo' 'shadow usr/bin/passwd'; do set -- $spec; file "$out/upstream/$1/root/$2" "$2" 4755 authentication override done file "$out/pam/root/sbin/unix_chkpwd" sbin/unix_chkpwd 4755 authentication override @@ -258,6 +258,9 @@ for library in zlib libpng mbedtls3; do done file "$src/resources/licenses/libbsd-LICENSE" usr/share/licenses/libbsd/COPYING file "$src/resources/licenses/e2fsprogs-NOTICE" usr/share/licenses/e2fsprogs/NOTICE +file "$src/resources/licenses/util-linux-README.licensing" usr/share/licenses/util-linux/README.licensing +file "$src/resources/licenses/libeconf-LICENSE" usr/share/licenses/libeconf/LICENSE +file "$src/resources/licenses/utmps-COPYING" usr/share/licenses/utmps/COPYING for name in simsun.ttc system.psf; do file "$src/system/fonts/$name" "usr/share/fonts/reliefos/$name"; done file "$src/system/fonts/times.ttf" usr/share/fonts/reliefos/times-new-roman.ttf @@ -268,7 +271,9 @@ for app in leonmmcoset xiaobai; do done # Compatibility links are explicit overrides of upstream aliases. link usr/bin/su ../../bin/su authentication override -for command in fdisk sfdisk runuser fsck blkid mkfs.exfat fsck.exfat leonos-grub-installer; do link "sbin/$command" "../usr/sbin/$command" storage override; done +for command in mkfs.exfat fsck.exfat leonos-grub-installer; do link "sbin/$command" "../usr/sbin/$command" storage override; done +for command in fdisk sfdisk runuser fsck blkid; do link "usr/sbin/$command" "../../sbin/$command" storage; done +for command in mount umount lsblk; do link "usr/bin/$command" "../../bin/$command" storage; done link sbin/umount ../bin/umount storage override # Official filesystem APKs own /sbin. Preserve older /usr/sbin callers with # one-way aliases, without replacing the official executables or their links. diff --git a/tools/build/upstream.sh b/tools/build/upstream.sh index b63d451f..3940eba4 100755 --- a/tools/build/upstream.sh +++ b/tools/build/upstream.sh @@ -45,17 +45,13 @@ case $pkg in libmd) set -- "$@" --libdir=/lib ;; sudo) set -- "$@" --with-pam --with-pam-login --with-secure-path=/usr/sbin:/usr/bin:/sbin:/bin --with-rundir=/run/sudo --with-vardir=/var/lib/sudo --libexecdir=/usr/lib ;; shadow) set -- "$@" --bindir=/bin --sbindir=/sbin --with-libpam --with-yescrypt --without-su --disable-logind ;; -util-linux) CPPFLAGS="$CPPFLAGS -include linux/openat2.h"; export CPPFLAGS - # Without libudev, lsblk probes the device directly. Upstream's flags omit - # VERSION even though -f requests FSVER; request it from the real superblock. - awk ' - /BLKID_SUBLKS_TYPE\);/ {sub(/BLKID_SUBLKS_TYPE\);/, "BLKID_SUBLKS_TYPE | BLKID_SUBLKS_VERSION);"); changed++} - {print} - END {if (changed != 1) exit 1} - ' "$source/misc-utils/lsblk-properties.c" > "$source/misc-utils/lsblk-properties.c.new" - mv "$source/misc-utils/lsblk-properties.c.new" "$source/misc-utils/lsblk-properties.c" - set -- "$@" --sbindir=/usr/sbin --disable-all-programs --enable-su --enable-runuser --enable-libuuid --enable-libfdisk --enable-libsmartcols --enable-fdisks=check --enable-libblkid --enable-libmount --enable-mount --enable-blkid --enable-lsblk --enable-fsck --without-python --without-systemd --without-systemdsystemunitdir --disable-makeinstall-chown ;; -exfatprogs) LDFLAGS="-static -L$auth/usr/lib"; export LDFLAGS; set -- "$@" --sbindir=/usr/sbin --disable-shared --enable-static ;; +exfatprogs) + LDFLAGS="-static -L$auth/usr/lib" + # Alpine's static blkid archive uses libeconf. Request the real private + # dependency explicitly; its blkid.pc does not list libeconf. + BLKID_LIBS=$(pkg-config --static --libs blkid libeconf) + export LDFLAGS BLKID_LIBS + set -- "$@" --sbindir=/usr/sbin --disable-shared --enable-static ;; coreutils) # The optional dispatched CRC backend pulls compiler-rt's precompiled # cpu_model constructor into every single-binary invocation. Its host ISA @@ -76,7 +72,7 @@ tmp=$(mktemp -d "$stage.new.XXXXXX") trap 'rm -rf "$tmp"' EXIT cd "$work/build" "$source/configure" "$@" -if [ "$pkg" = exfatprogs ]; then make "LDFLAGS=$LDFLAGS -all-static" "BLKID_LIBS=$auth/usr/lib/libblkid.a"; else make; fi +if [ "$pkg" = exfatprogs ]; then make "LDFLAGS=$LDFLAGS -all-static" "BLKID_LIBS=$BLKID_LIBS"; else make; fi if [ "$pkg" = sudo ]; then make install "DESTDIR=$tmp" INSTALL_OWNER=; else make install "DESTDIR=$tmp"; fi # alsa-lib 1.2.14 forbids shared/static in one configure (upstream INSTALL). # Use two private builds of the same verified source; publish just the static diff --git a/tools/build/util-linux-development.sh b/tools/build/util-linux-development.sh new file mode 100644 index 00000000..686e929d --- /dev/null +++ b/tools/build/util-linux-development.sh @@ -0,0 +1,154 @@ +#!/bin/sh +# Verified build-only blkid/uuid inputs for exfatprogs; never a guest overlay. +set -eu +LC_ALL=C +export LC_ALL +die() { printf 'util-linux-development: %s\n' "$*" >&2; exit 1; } +[ "$#" = 6 ] || { echo 'usage: util-linux-development.sh SRC DEPS LOCK CACHE APK ROOT' >&2; exit 2; } +src=$(CDPATH='' cd -- "$1" && pwd -P) +deps=$(CDPATH='' cd -- "$(dirname "$2")" && pwd -P)/$(basename "$2") +lock=$(CDPATH='' cd -- "$(dirname "$3")" && pwd -P)/$(basename "$3") +cache=$(CDPATH='' cd -- "$4" && pwd -P) +apk=$(CDPATH='' cd -- "$(dirname "$5")" && pwd -P)/$(basename "$5") +name=$(basename "$6") +case $name in ''|.|..|/) die 'expected a dedicated output directory';; esac +mkdir -p "$(dirname "$6")" +parent=$(CDPATH='' cd -- "$(dirname "$6")" && pwd -P) +root=$parent/$name +for input in "$src" "$deps" "$lock" "$cache" "$apk" \ + "$src/resources/licenses/util-linux-README.licensing" "$src/system/rootfs/etc/apk/keys"; do + case $input in "$root"|"$root"/*|"$root.files") die "output overlaps input: $input";; esac +done +case $root in "$cache"/*) die 'output is inside the download cache';; esac +for output in "$root" "$root.files"; do [ ! -L "$output" ] || die "symlink output: $output"; done +[ ! -e "$root" ] || [ -d "$root" ] || die 'output is not a directory' +[ ! -e "$root.files" ] || [ -f "$root.files" ] || die 'inventory is not a regular file' +[ -s "$src/resources/licenses/util-linux-README.licensing" ] || die 'missing util-linux license resource' +transaction=$(mktemp -d "$parent/.${name}.new.XXXXXX") +stage=$transaction/root +installed=no manifest_installed=no committed=no +cleanup() { + status=$? + trap - 0 HUP INT TERM + if [ "$committed" = no ]; then + if [ "$manifest_installed" = yes ]; then rm -f "$root.files" || status=1; fi + if [ "$installed" = yes ]; then rm -rf "$root" || status=1; fi + if [ -e "$transaction/previous-root" ]; then mv "$transaction/previous-root" "$root" || status=1; fi + if [ -e "$transaction/previous-files" ]; then mv "$transaction/previous-files" "$root.files" || status=1; fi + if [ -e "$transaction/previous-root" ] || [ -e "$transaction/previous-files" ]; then + echo "util-linux-development: retained backup: $transaction" >&2 + exit 1 + fi + fi + rm -rf "$transaction" || status=1 + exit "$status" +} +trap cleanup 0 +trap 'exit 130' HUP INT TERM +mkdir -p "$stage/usr/share/reliefos/sdk/apk" +for id in alpine-libblkid alpine-libuuid alpine-libeconf \ + runtime-dev-util-linux-dev runtime-dev-util-linux-static \ + runtime-dev-libeconf-dev runtime-dev-libeconf-static; do + case $id in alpine-*) package=${id#alpine-};; runtime-dev-*) package=${id#runtime-dev-};; esac + url=$("$deps" --lock "$lock" --id "$id" --print url) + digest=$("$deps" --lock "$lock" --id "$id" --print sha256) + version=$("$deps" --lock "$lock" --id "$id" --print version) + [ "$url" = "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/$package-$version.apk" ] || die "unexpected URL: $id" + [ "${#digest}" = 64 ] || die "invalid digest: $id" + case $digest in *[!0-9a-f]*) die "invalid digest: $id";; esac + archive=$cache/${url##*/} + [ -f "$archive" ] || die "missing $archive; run make fetch" + cp "$archive" "$transaction/input.apk" + archive=$transaction/input.apk + actual=$(sha256sum "$archive") + [ "${actual%% *}" = "$digest" ] || die "checksum mismatch: $id" + "$apk" --keys-dir "$src/system/rootfs/etc/apk/keys" verify "$archive" + tar --ignore-zeros --warning=no-unknown-keyword --numeric-owner \ + --quoting-style=escape -tvzf "$archive" >"$transaction/list" + awk ' + function safe(path,n,a,i) { + if (path !~ /^[A-Za-z0-9_+@.\/-]+$/ || path ~ /^\//) return 0 + n=split(path,a,"/") + for (i=1;i<=n;i++) if (a[i]=="" || a[i]=="." || a[i]=="..") return 0 + return 1 + } + { + type=substr($1,1,1); name=$6 + if (type=="d") sub(/\/$/,"",name) + if (!safe(name) || seen[name]++ || (type!="-" && type!="d" && type!="l")) exit 1 + if (type=="l") { + if (NF!=8 || $7!="->" || $8 !~ /^[A-Za-z0-9_+@.-]+$/ || $8=="." || $8=="..") exit 1 + } else if (NF!=6) exit 1 + print type, name, (type=="l" ? $8 : "-"); count++ + } + END {if (!count) exit 1} + ' "$transaction/list" >"$transaction/members" || die "unsafe archive: $id" + while read -r type member target; do + [ "$type" != d ] || continue + case $id:$member in + *:.PKGINFO) destination=usr/share/reliefos/sdk/apk/$id.PKGINFO;; + alpine-libblkid:usr/lib/libblkid.so*|alpine-libuuid:usr/lib/libuuid.so*|alpine-libeconf:usr/lib/libeconf.so*|\ + runtime-dev-util-linux-dev:usr/include/blkid/*|runtime-dev-util-linux-dev:usr/include/uuid/*|\ + runtime-dev-util-linux-dev:usr/lib/libblkid.so|runtime-dev-util-linux-dev:usr/lib/libuuid.so|\ + runtime-dev-util-linux-dev:usr/lib/pkgconfig/blkid.pc|runtime-dev-util-linux-dev:usr/lib/pkgconfig/uuid.pc|\ + runtime-dev-util-linux-static:usr/lib/libblkid.a|runtime-dev-util-linux-static:usr/lib/libuuid.a|\ + runtime-dev-libeconf-dev:usr/include/libeconf*.h|runtime-dev-libeconf-dev:usr/lib/libeconf.so|\ + runtime-dev-libeconf-dev:usr/lib/pkgconfig/libeconf.pc|runtime-dev-libeconf-static:usr/lib/libeconf.a) + destination=$member;; + *) continue;; + esac + [ ! -e "$stage/$destination" ] && [ ! -L "$stage/$destination" ] || die "duplicate product: $destination" + mkdir -p "$stage/$(dirname "$destination")" + if [ "$type" = l ]; then + case ${member##*/}:$target in + libblkid.so*:libblkid.so*|libuuid.so*:libuuid.so*|libeconf.so*:libeconf.so*) ;; + *) die "unexpected library link: $member";; + esac + ln -s "$target" "$stage/$destination" + else + tar --ignore-zeros --warning=no-unknown-keyword --occurrence=1 \ + -xOzf "$archive" -- "$member" >"$stage/$destination" + fi + done <"$transaction/members" + awk -v package="$package" -v version="$version" ' + $0=="pkgname = "package {name++} /^pkgname = / {names++} + $0=="pkgver = "version {ver++} /^pkgver = / {versions++} + $0=="arch = x86_64" {arch++} /^arch = / {arches++} + END {exit !(name==1 && names==1 && ver==1 && versions==1 && arch==1 && arches==1)} + ' "$stage/usr/share/reliefos/sdk/apk/$id.PKGINFO" || die "unexpected package metadata: $id" +done +find "$stage" -type l -print >"$transaction/links" +while IFS= read -r link; do + [ -f "$link" ] || die "dangling or non-file product link: $link" +done <"$transaction/links" +for header in blkid/blkid.h uuid/uuid.h libeconf.h; do + [ -s "$stage/usr/include/$header" ] || die "missing header: $header" +done +for lib in blkid uuid econf; do + [ -s "$stage/usr/lib/lib$lib.a" ] && [ -s "$stage/usr/lib/lib$lib.so" ] || die "missing library: $lib" +done +for pc in blkid uuid libeconf; do + [ -s "$stage/usr/lib/pkgconfig/$pc.pc" ] || die "missing pkg-config input: $pc" + # Keep all four paths relocatable, including util-linux's absolute fields. + awk ' + /^prefix=/ {print "prefix=${pcfiledir}/../.."; next} + /^exec_prefix=/ {print "exec_prefix=${prefix}"; next} + /^libdir=/ {print "libdir=${prefix}/lib"; next} + /^includedir=/ {print "includedir=${prefix}/include"; next} + {print} + ' "$stage/usr/lib/pkgconfig/$pc.pc" >"$transaction/pc" + mv "$transaction/pc" "$stage/usr/lib/pkgconfig/$pc.pc" +done +mkdir -p "$stage/usr/share/licenses/util-linux" +cp "$src/resources/licenses/util-linux-README.licensing" "$stage/usr/share/licenses/util-linux/README.licensing" +printf '%s\n' 'official util-linux development inputs (build-only)' >"$stage/.complete" +(cd "$stage" && find . ! -type d -print) >"$transaction/paths" +sed 's@^./@@' "$transaction/paths" >"$transaction/relative" +sort "$transaction/relative" >"$transaction/root.files" +if [ -e "$root" ]; then mv "$root" "$transaction/previous-root"; fi +if [ -e "$root.files" ]; then mv "$root.files" "$transaction/previous-files"; fi +installed=yes +mv "$stage" "$root" +manifest_installed=yes +mv "$transaction/root.files" "$root.files" +committed=yes diff --git a/tools/host/apk/reliefos-apk-own.c b/tools/host/apk/reliefos-apk-own.c index 4c15aacf..7ef74c0d 100644 --- a/tools/host/apk/reliefos-apk-own.c +++ b/tools/host/apk/reliefos-apk-own.c @@ -189,14 +189,6 @@ static int load_rules(struct state *state, const char *policy_path, json_value * {"reliefos-apps", "usr/share/licenses/pleditor"}, {"busybox", "bin/busybox"}, {"busybox", "bin/sh"}, {"busybox", "usr/share/licenses/busybox"} }; - static const char *const util_commands[] = { - "usr/sbin/fdisk", "usr/sbin/sfdisk", "usr/sbin/runuser", "usr/sbin/fsck", - "usr/sbin/blkid", "bin/mount", "bin/umount", "bin/lsblk" - }; - static const char *const util_libraries[] = { - "usr/lib/libfdisk.so.1", "usr/lib/libsmartcols.so.1", "usr/lib/libuuid.so.1", - "usr/lib/libblkid.so.1", "usr/lib/libmount.so.1" - }; static const char *const filesystem_commands[] = { "usr/sbin/mkfs.ext4", "usr/sbin/fsck.ext4", "usr/sbin/mkfs.ext2", "usr/sbin/fsck.ext2", "usr/sbin/mkfs.fat", "usr/sbin/fsck.fat", "usr/sbin/mkfs.exfat", "usr/sbin/fsck.exfat" @@ -204,10 +196,6 @@ static int load_rules(struct state *state, const char *policy_path, json_value * size_t item; for (item = 0; item < sizeof(tool_paths) / sizeof(tool_paths[0]); item++) if (add_rule(state, tool_paths[item].path, tool_paths[item].group) != 0) return -1; - for (item = 0; item < sizeof(util_commands) / sizeof(util_commands[0]); item++) - if (add_rule(state, util_commands[item], "storage-util-linux") != 0) return -1; - for (item = 0; item < sizeof(util_libraries) / sizeof(util_libraries[0]); item++) - if (add_rule(state, util_libraries[item], "storage-util-linux") != 0) return -1; for (item = 0; item < sizeof(filesystem_commands) / sizeof(filesystem_commands[0]); item++) if (add_rule(state, filesystem_commands[item], "storage-filesystems") != 0) return -1; } diff --git a/tools/storage_tools.py b/tools/storage_tools.py index 95d61a44..beb37424 100644 --- a/tools/storage_tools.py +++ b/tools/storage_tools.py @@ -9,8 +9,9 @@ UTIL_LINUX_LIBRARIES = tuple(f"usr/lib/lib{name}.so.1" for name in ("fdisk", "smartcols", "uuid", "blkid", "mount")) -COMPAT_LINKS = {"sbin/" + Path(path).name: "../" + path +COMPAT_LINKS = {path: "../../sbin/" + Path(path).name for path in UTIL_LINUX_COMMANDS if path.startswith("usr/sbin/")} +COMPAT_LINKS.update({f"usr/bin/{name}": f"../../bin/{name}" for name in ("mount", "umount", "lsblk")}) COMPAT_LINKS.update({"sbin/umount": "../bin/umount", "sbin/leonos-grub-installer": "../usr/sbin/leonos-grub-installer"}) for verb in ("mkfs", "fsck"): diff --git a/tools/test_installer_update_packages.py b/tools/test_installer_update_packages.py index c8d41593..564d9941 100644 --- a/tools/test_installer_update_packages.py +++ b/tools/test_installer_update_packages.py @@ -75,7 +75,8 @@ def apk(cls, *arguments): check=True, capture_output=True, text=True) @classmethod - def package(cls, name, version, repository, dependencies=(), payload=None, symlinks=None): + def package(cls, name, version, repository, dependencies=(), payload=None, symlinks=None, + replaces=(), modes=None): files = cls.work / (name + "-" + version) (files / "usr/share" / name).mkdir(parents=True, exist_ok=True) (files / "usr/share" / name / "version").write_text(version + "\n") @@ -87,12 +88,16 @@ def package(cls, name, version, repository, dependencies=(), payload=None, symli path = files / relative path.parent.mkdir(parents=True, exist_ok=True) path.symlink_to(destination) + for relative, mode in (modes or {}).items(): + (files / relative).chmod(mode) arguments = ["mkpkg", "--files", files, "--output", cls.base / repository / (name + "-" + version + ".apk"), "--info", "name:" + name, "--info", "version:" + version, "--info", "arch:x86_64", "--sign-key", cls.key] - for dependency in dependencies: - arguments.extend(["--info", "depends:" + dependency]) + if dependencies: + arguments.extend(["--info", "depends:" + " ".join(dependencies)]) + if replaces: + arguments.extend(["--info", "replaces:" + " ".join(replaces)]) cls.apk(*arguments) @classmethod @@ -230,6 +235,75 @@ def test_filesystem_and_bsd_split_transfers_owners_and_preserves_configuration(s output = self.apk("--root", target, "info", "--who-owns", "/" + path).stdout self.assertIn("owned by " + owner + "-", output) + def test_util_linux_transfer_retains_shadow_pam_and_official_su_modes(self): + old, new = self.runner / "oldrepo", self.runner / "newrepo" + target = self.runner / "target" + shadow = {"bin/login": "shadow login\n", "usr/bin/newgrp": "shadow newgrp\n", + "sbin/nologin": "shadow nologin\n"} + self.package("reliefos-base", "5.0-r0", old, payload=shadow) + self.package("reliefos-authentication", "5.0-r0", old, payload={ + "bin/su": "local su\n", "etc/pam.d/su-l": "product policy\n"}) + self.package("reliefos-storage-util-linux", "5.0-r0", old, payload={ + "usr/sbin/fdisk": "local fdisk\n", "usr/lib/libblkid.so.1": "local blkid\n"}, + symlinks={"sbin/fdisk": "../usr/sbin/fdisk"}) + self.package("reliefos-base", "6.0-r0", new) + self.package("util-linux-login", "2.42.4-r3", new, payload={ + **{name: "official overlapping tool\n" for name in shadow}, + "bin/su": "official su\n", "etc/pam.d/su-l": "upstream policy\n"}, + modes={"bin/su": 0o4755}) + self.package("util-linux-misc", "2.42.4-r3", new, + payload={"sbin/fdisk": "official fdisk\n"}) + self.package("libblkid", "2.42.4-r3", new, + payload={"usr/lib/libblkid.so.1": "official blkid\n"}) + self.package("reliefos-authentication", "6.0-r0", new, ["util-linux-login"], + payload={**shadow, "etc/pam.d/su-l": "product policy\n"}, + replaces=["util-linux-login"]) + self.package("reliefos-storage-util-linux", "6.0-r0", new, + ["util-linux-misc", "libblkid"], + symlinks={"usr/sbin/fdisk": "../../sbin/fdisk"}) + self.index(old) + self.index(new) + repositories = self.runner / "old.repositories" + repositories.write_text("ndx " + str(old / "packages.adb") + "\n") + self.apk("--root", target, "--repositories-file", repositories, + "--no-network", "--no-scripts", "add", "reliefos-base", + "reliefos-authentication", "reliefos-storage-util-linux") + (target / "etc/pam.d/su-l").write_text("administrator policy\n") + checked = self.check() + self.assertEqual(checked.returncode, 0, checked.stdout + checked.stderr) + for _ in range(2): + result = self.transaction("--apply") + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + for name, text in shadow.items(): + self.assertEqual((target / name).read_text(), text) + owner = self.apk("--root", target, "info", "--who-owns", "/" + name).stdout + self.assertIn("owned by reliefos-authentication-", owner) + self.assertEqual((target / "etc/pam.d/su-l").read_text(), "administrator policy\n") + self.assertEqual((target / "bin/su").stat().st_mode & 0o7777, 0o4755) + self.assertEqual((target / "bin/su").read_text(), "official su\n") + self.assertEqual(os.readlink(target / "usr/sbin/fdisk"), "../../sbin/fdisk") + self.assertFalse((target / "sbin/fdisk").is_symlink()) + for path, package in (("bin/su", "util-linux-login"), + ("sbin/fdisk", "util-linux-misc"), + ("usr/lib/libblkid.so.1", "libblkid")): + owner = self.apk("--root", target, "info", "--who-owns", "/" + path).stdout + self.assertIn("owned by " + package + "-", owner) + # A later upstream-only upgrade must still honor the already installed + # local replacement, without reinstalling/changing authentication. + self.package("util-linux-login", "2.42.5-r0", new, payload={ + **{name: "new upstream overlap\n" for name in shadow}, + "bin/su": "upgraded official su\n", "etc/pam.d/su-l": "new upstream policy\n"}, + modes={"bin/su": 0o4755}) + self.index(new) + repositories.write_text("ndx " + str(new / "packages.adb") + "\n") + self.apk("--root", target, "--repositories-file", repositories, + "--no-network", "--no-scripts", "upgrade", "util-linux-login") + for name, text in shadow.items(): + self.assertEqual((target / name).read_text(), text) + self.assertEqual((target / "bin/su").read_text(), "upgraded official su\n") + self.assertEqual((target / "bin/su").stat().st_mode & 0o7777, 0o4755) + self.assertEqual((target / "etc/pam.d/su-l").read_text(), "administrator policy\n") + def test_old_console_ca_placeholder_is_replaced_by_real_bundle(self): old, new = self.runner / "oldrepo", self.runner / "newrepo" target = self.runner / "target" diff --git a/tools/test_lsblk_filesystems_qemu.py b/tools/test_lsblk_filesystems_qemu.py index 9f5084d9..94500cf0 100644 --- a/tools/test_lsblk_filesystems_qemu.py +++ b/tools/test_lsblk_filesystems_qemu.py @@ -40,6 +40,8 @@ def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--image", type=Path, required=True, help="fresh production raw disk") parser.add_argument("--smp", type=int, choices=(1, 2), default=2) + parser.add_argument("--allow-empty-fsver", action="store_true", + help="accept the documented official Alpine lsblk 2.42.4-r3 probe limitation") args = parser.parse_args() output = ROOT / f"build/lsblk-filesystems-qemu/{args.smp}cpu" output.mkdir(parents=True, exist_ok=True) @@ -109,11 +111,14 @@ def main(): for i, name in enumerate(("sda1", "sda2")): device, metadata = devices[name], expected[i] for column, key in (("fstype", "TYPE"), ("fsver", "VERSION"), ("label", "LABEL"), ("uuid", "UUID")): + if column == "fsver" and args.allow_empty_fsver and not device[column]: + continue assert (device[column] or "") == metadata.get(key, ""), (name, column, device, metadata) assert device["partuuid"].lower() == partitions[i]["uuid"].lower(), device assert device["mountpoints"] == [["/boot", "/"][i]], device assert device["fsavail"] and device["fsuse%"].endswith("%"), device - print(f"PASS QEMU {args.smp} CPU: real filesystem type/version/label/UUID/PARTUUID, usage and block-read DAC") + version = " (empty FSVER permitted for the official APK)" if args.allow_empty_fsver else "" + print(f"PASS QEMU {args.smp} CPU: real filesystem metadata, usage and block-read DAC{version}") if __name__ == "__main__": From 96336f82ee5c8fbf39419f591556b713666c299e Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sat, 14 Nov 2026 20:27:31 +0800 Subject: [PATCH 3/5] feat(packages): migrate libmd to official Alpine APKs --- Documentation/admin-guide/packages.rst | 13 ++-- .../en/LC_MESSAGES/admin-guide/packages.po | 10 ++-- .../ja/LC_MESSAGES/admin-guide/packages.po | 8 +-- NOTICE | 9 +-- configs/apk-ownership.json | 7 +-- configs/auth-upstream.json | 8 --- configs/dependencies.lock.json | 51 ++++++++++++---- scripts/reliefos/Makefile.apk | 6 +- scripts/reliefos/Makefile.apk-dependencies | 7 ++- scripts/reliefos/Makefile.upstream | 5 +- tests/build/test-deps.sh | 13 ++-- tests/build/test-libbsd-development.sh | 59 ++++++++++++++----- tests/build/test-third-party.sh | 8 +-- tests/integration/apk-base-migration.sh | 11 +++- tests/integration/apk-libmd-migration.sh | 53 +++++++++++++++++ tests/integration/upstream-incremental.sh | 8 ++- tests/integration/upstream-products.sh | 4 +- tools/build/apk-stage.sh | 4 +- tools/build/libbsd-development.sh | 47 +++++++++++---- tools/build/rootfs-stage.sh | 9 ++- tools/build/upstream.sh | 2 - tools/test_auth_guest.py | 1 + tools/test_installer_update_packages.py | 47 +++++++++++++++ tools/tests/libmd_runtime_probe.c | 57 ++++++++++++++++++ 24 files changed, 351 insertions(+), 96 deletions(-) create mode 100644 tests/integration/apk-libmd-migration.sh create mode 100644 tools/tests/libmd_runtime_probe.c diff --git a/Documentation/admin-guide/packages.rst b/Documentation/admin-guide/packages.rst index b8fabc98..290b9e1b 100644 --- a/Documentation/admin-guide/packages.rst +++ b/Documentation/admin-guide/packages.rst @@ -32,15 +32,18 @@ sl、ncurses、zlib、libpng、SQLite、mbedTLS 3 由签名 Alpine APK 提供。 ``apk info --who-owns /usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` 查询。 离线更新器在预检时将旧包装包的 world 请求转换为官方包,保留其他包和配置; 正式事务自动卸载旧包,完成后清除离线缓存中的旧包装包归档。 -新的自有包使用第 6 代版本前缀,保证从第 2、3、4、5 代包按正常版本顺序升级。 +新的自有包使用第 7 代版本前缀,保证从第 2、3、4、5、6 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 SQLite VFS 或厂商内部符号的外部程序需要重新编译。 -libbsd、dosfstools、e2fsprogs 及其运行库和文档也直接使用锁定的官方 Alpine APK。 +libmd 1.3.0、libbsd 运行库,以及 dosfstools、e2fsprogs 工具及其配套运行库和文档, +均直接使用锁定的官方 Alpine APK。 ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口由兼容链接转发。 -本地认证支持包继续提供 libmd,本地文件系统包继续提供 exfatprogs;它们通过真实的 -APK 依赖安装已迁移的官方包,升级事务同时转移旧文件的所有权,不强制覆盖文件。 -shadow 构建使用独立提取的 libbsd 开发文件,不把 Alpine 的 Linux 头文件混入 SDK。 +libmd 保留官方 ``/usr/lib`` 路径,旧 ``/lib`` 入口由本地认证支持包中的单向链接转发。 +本地文件系统包继续提供 exfatprogs;兼容包通过真实 APK 依赖安装官方库和工具, +升级时同时转移旧文件的所有权,不强制覆盖。 +shadow 构建使用独立提取的 libbsd 和 libmd 开发文件,运行镜像不包含 libmd 的头文件、 +静态库和 pkg-config 文件,也不把 Alpine 的 Linux 头文件混入 SDK。 util-linux 2.42.4 的命令、运行库和手册由锁定的官方 Alpine edge APK 提供。 分区和文件系统工具保留官方 ``/sbin`` 路径,mount、umount、lsblk 保留 ``/bin`` 路径; diff --git a/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po b/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po index e153858c..72736118 100644 --- a/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po +++ b/Documentation/locale/en/LC_MESSAGES/admin-guide/packages.po @@ -55,7 +55,7 @@ msgid "" "系统直接请求官方命令、终端工具/数据和 SQLite 命令/运行库,不再生成本地包装包。 文件所有权可通过 ``apk info --who-owns " "/usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` 查询。 " "离线更新器在预检时将旧包装包的 world 请求转换为官方包,保留其他包和配置; 正式事务自动卸载旧包,完成后清除离线缓存中的旧包装包归档。 " -"新的自有包使用第 6 代版本前缀,保证从第 2、3、4、5 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " +"新的自有包使用第 7 代版本前缀,保证从第 2、3、4、5、6 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " "SQLite VFS 或厂商内部符号的外部程序需要重新编译。" msgstr "" "sl, ncurses, zlib, libpng, SQLite, and mbedTLS 3 are supplied by signed " @@ -67,13 +67,13 @@ msgstr "" "to official packages while preserving other packages and configuration. The " "actual transaction automatically removes old packages; afterward it clears " "their wrapper archives from the offline cache. New project-owned packages " -"use a sixth-generation version prefix to upgrade normally from second-, " -"third-, fourth-, and fifth-generation packages. The old ``sqlite.so.3`` ABI has been removed. " +"use a seventh-generation version prefix to upgrade normally from second-, " +"third-, fourth-, fifth-, and sixth-generation packages. The old ``sqlite.so.3`` ABI has been removed. " "External programs depending on the old custom SQLite VFS or vendor-internal " "symbols must be rebuilt." -msgid "libbsd、dosfstools、e2fsprogs 及其运行库和文档也直接使用锁定的官方 Alpine APK。 ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口由兼容链接转发。 本地认证支持包继续提供 libmd,本地文件系统包继续提供 exfatprogs;它们通过真实的 APK 依赖安装已迁移的官方包,升级事务同时转移旧文件的所有权,不强制覆盖文件。 shadow 构建使用独立提取的 libbsd 开发文件,不把 Alpine 的 Linux 头文件混入 SDK。" -msgstr "libbsd, dosfstools, e2fsprogs, and their runtime libraries and documentation also come directly from pinned official Alpine APKs. The ext2/3/4 and FAT tools retain their official ``/sbin`` paths; compatibility links forward older ``/usr/sbin`` entry points. The local authentication support package still supplies libmd, and the local filesystem package still supplies exfatprogs. Real APK dependencies install the migrated official packages, transferring ownership of old files in the same upgrade transaction without forced overwrites. Shadow builds use separately extracted libbsd development files, keeping Alpine Linux headers out of the SDK." +msgid "libmd 1.3.0、libbsd 运行库,以及 dosfstools、e2fsprogs 工具及其配套运行库和文档, 均直接使用锁定的官方 Alpine APK。 ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口由兼容链接转发。 libmd 保留官方 ``/usr/lib`` 路径,旧 ``/lib`` 入口由本地认证支持包中的单向链接转发。 本地文件系统包继续提供 exfatprogs;兼容包通过真实 APK 依赖安装官方库和工具, 升级时同时转移旧文件的所有权,不强制覆盖。 shadow 构建使用独立提取的 libbsd 和 libmd 开发文件,运行镜像不包含 libmd 的头文件、 静态库和 pkg-config 文件,也不把 Alpine 的 Linux 头文件混入 SDK。" +msgstr "The libmd 1.3.0 and libbsd runtime libraries, along with dosfstools, e2fsprogs, their supporting libraries and documentation, come directly from pinned official Alpine APKs. ext2/3/4 and FAT tools retain their official ``/sbin`` paths; compatibility links forward older ``/usr/sbin`` entry points. libmd retains its official ``/usr/lib`` path; one-way links in the local authentication support package forward older ``/lib`` entry points. The local filesystem package continues to provide exfatprogs. Compatibility packages use real APK dependencies, transferring ownership of old files during upgrades without forced overwrites. Shadow uses separately extracted libbsd and libmd development inputs. Runtime images exclude libmd headers, static archives and pkg-config files, and Alpine Linux headers are not mixed into the SDK." msgid "util-linux 2.42.4 的命令、运行库和手册由锁定的官方 Alpine edge APK 提供。 分区和文件系统工具保留官方 ``/sbin`` 路径,mount、umount、lsblk 保留 ``/bin`` 路径; 旧入口通过单向兼容链接转发。exfatprogs 的开发依赖从官方 APK 单独提取,运行镜像不包含 这份开发根。现有 shadow login、newgrp、nologin 和 PAM 策略由本地认证包明确接管重叠文件, 官方包保留 su、runuser 的文件归属和权限。" msgstr "The util-linux 2.42.4 commands, runtime libraries, and manuals come from pinned official Alpine edge APKs. Partition and filesystem tools retain their official ``/sbin`` paths; mount, umount, and lsblk retain their ``/bin`` paths. One-way compatibility links forward older entry points. Development dependencies for exfatprogs are extracted separately from official APKs; this development root is excluded from runtime images. The local authentication package explicitly owns overlapping files for the existing shadow login, newgrp, nologin, and PAM policy. Official packages retain ownership and permissions of su and runuser." diff --git a/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po b/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po index b5031e8f..234dc4e7 100644 --- a/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po +++ b/Documentation/locale/ja/LC_MESSAGES/admin-guide/packages.po @@ -51,7 +51,7 @@ msgid "" "系统直接请求官方命令、终端工具/数据和 SQLite 命令/运行库,不再生成本地包装包。 文件所有权可通过 ``apk info --who-owns " "/usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` 查询。 " "离线更新器在预检时将旧包装包的 world 请求转换为官方包,保留其他包和配置; 正式事务自动卸载旧包,完成后清除离线缓存中的旧包装包归档。 " -"新的自有包使用第 6 代版本前缀,保证从第 2、3、4、5 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " +"新的自有包使用第 7 代版本前缀,保证从第 2、3、4、5、6 代包按正常版本顺序升级。 旧的 ``sqlite.so.3`` ABI 已移除。 依赖旧自定义 " "SQLite VFS 或厂商内部符号的外部程序需要重新编译。" msgstr "" "sl、ncurses、zlib、libpng、SQLite、mbedTLS 3 は署名済み Alpine APK " @@ -60,11 +60,11 @@ msgstr "" "/usr/bin/sl``、``/usr/bin/tput``、``/usr/lib/libsqlite3.so.0`` " "で照会できます。オフライン更新器は事前検査で旧ラッパーパッケージの world " "要求を公式パッケージに変換し、他のパッケージと設定は保持します。正式な処理では旧パッケージを自動削除し、完了後にオフラインキャッシュから旧ラッパーのアーカイブを除去します。新しい自有パッケージは第" -" 6 世代のバージョン接頭辞を使い、第 2・第 3・第 4・第 5 世代から通常のバージョン順に更新できます。旧 ``sqlite.so.3`` ABI " +" 7 世代のバージョン接頭辞を使い、第 2・第 3・第 4・第 5・第 6 世代から通常のバージョン順に更新できます。旧 ``sqlite.so.3`` ABI " "は削除済みです。旧独自 SQLite VFS やベンダー内部シンボルに依存する外部プログラムは再コンパイルが必要です。" -msgid "libbsd、dosfstools、e2fsprogs 及其运行库和文档也直接使用锁定的官方 Alpine APK。 ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口由兼容链接转发。 本地认证支持包继续提供 libmd,本地文件系统包继续提供 exfatprogs;它们通过真实的 APK 依赖安装已迁移的官方包,升级事务同时转移旧文件的所有权,不强制覆盖文件。 shadow 构建使用独立提取的 libbsd 开发文件,不把 Alpine 的 Linux 头文件混入 SDK。" -msgstr "libbsd、dosfstools、e2fsprogs とその実行時ライブラリおよび文書も、固定した公式 Alpine APK を直接使用します。ext2/3/4 と FAT のツールは公式の ``/sbin`` パスを維持し、従来の ``/usr/sbin`` 入口は互換リンクで転送します。ローカル認証支援パッケージは引き続き libmd を、ローカルファイルシステムパッケージは exfatprogs を提供します。実際の APK 依存関係により移行済みの公式パッケージを導入し、同じ更新処理で旧ファイルの所有権を移転するため、強制上書きは行いません。shadow のビルドには別途展開した libbsd 開発ファイルを使い、Alpine の Linux ヘッダーを SDK に混在させません。" +msgid "libmd 1.3.0、libbsd 运行库,以及 dosfstools、e2fsprogs 工具及其配套运行库和文档, 均直接使用锁定的官方 Alpine APK。 ext2/3/4 和 FAT 工具保留官方 ``/sbin`` 路径,旧 ``/usr/sbin`` 入口由兼容链接转发。 libmd 保留官方 ``/usr/lib`` 路径,旧 ``/lib`` 入口由本地认证支持包中的单向链接转发。 本地文件系统包继续提供 exfatprogs;兼容包通过真实 APK 依赖安装官方库和工具, 升级时同时转移旧文件的所有权,不强制覆盖。 shadow 构建使用独立提取的 libbsd 和 libmd 开发文件,运行镜像不包含 libmd 的头文件、 静态库和 pkg-config 文件,也不把 Alpine 的 Linux 头文件混入 SDK。" +msgstr "libmd 1.3.0 と libbsd のランタイムライブラリ、および dosfstools、e2fsprogs とその関連ライブラリ・文書は、固定された公式 Alpine APK から直接提供されます。ext2/3/4 と FAT のツールは公式の ``/sbin`` パスを保持し、旧 ``/usr/sbin`` の入口は互換リンクで転送されます。libmd は公式の ``/usr/lib`` パスを保持し、旧 ``/lib`` の入口はローカル認証サポートパッケージの一方向リンクで転送されます。ローカルファイルシステムパッケージは引き続き exfatprogs を提供します。互換パッケージは実際の APK 依存関係を使用し、更新時に強制上書きを行わず旧ファイルの所有権を移します。shadow のビルドには個別に抽出した libbsd と libmd の開発用ファイルを使用します。ランタイムイメージには libmd のヘッダー、静的ライブラリ、pkg-config ファイルを含めず、Alpine の Linux ヘッダーを SDK に混在させません。" msgid "util-linux 2.42.4 的命令、运行库和手册由锁定的官方 Alpine edge APK 提供。 分区和文件系统工具保留官方 ``/sbin`` 路径,mount、umount、lsblk 保留 ``/bin`` 路径; 旧入口通过单向兼容链接转发。exfatprogs 的开发依赖从官方 APK 单独提取,运行镜像不包含 这份开发根。现有 shadow login、newgrp、nologin 和 PAM 策略由本地认证包明确接管重叠文件, 官方包保留 su、runuser 的文件归属和权限。" msgstr "util-linux 2.42.4 のコマンド、実行時ライブラリ、マニュアルは固定した公式 Alpine edge APK が提供します。パーティションとファイルシステムのツールは公式の ``/sbin`` パスを、mount、umount、lsblk は ``/bin`` パスを維持します。従来の入口は一方向の互換リンクで転送します。exfatprogs の開発依存ファイルは公式 APK から別途展開し、その開発用ルートは実行時イメージに含めません。既存の shadow login、newgrp、nologin と PAM 設定の重複ファイルは、ローカル認証パッケージが明示的に所有します。su と runuser の所有関係および権限は公式パッケージが維持します。" diff --git a/NOTICE b/NOTICE index 57cdd8d1..be37ec63 100644 --- a/NOTICE +++ b/NOTICE @@ -62,10 +62,11 @@ Runtime, libraries, and applications development APKs are extracted only for building shadow. See resources/licenses/libbsd-LICENSE for BSD/ISC/MIT and file-specific terms, and configs/dependencies.lock.json for archive identities. -* libmd 1.3.0: BSD/ISC/Beerware/public-domain and file-specific terms; - see COPYING. This authentication dependency uses verified release archives - identified in configs/dependencies.lock.json; full notices are copied into the - isolated staging root's /usr/share/licenses// directory. +* libmd 1.3.0: unmodified signed Alpine runtime/documentation APKs under + BSD/ISC/Beerware/public-domain and file-specific terms. Full notices are in + /usr/share/licenses/libmd/COPYING from libmd-doc. The official development + APK is extracted only into shadow's isolated build inputs. Versions, + recipe commits and archive hashes are in configs/dependencies.lock.json. * Vim (vim, vim-common, xxd): Vim License. Installed from signed Alpine APKs; versions and archive hashes are recorded in configs/dependencies.lock.json. * ncurses 6.6: MIT-style license. See resources/licenses/ncurses-LICENSE. diff --git a/configs/apk-ownership.json b/configs/apk-ownership.json index 966d1442..d6742db1 100644 --- a/configs/apk-ownership.json +++ b/configs/apk-ownership.json @@ -212,10 +212,9 @@ "auth-support-libraries": { "destination": "alpine-after-validation", "components": [], - "library_stems": ["lib/libmd"], - "paths": ["usr/share/licenses/libmd"], - "alpine_candidates": ["libmd"], - "reason": "Local libmd 1.3.0 supplies the real libmd.so.0 ABI. Official libbsd owns its runtime; its development files are isolated for building shadow." + "paths": ["lib/libmd.so", "lib/libmd.so.0", "lib/libmd.so.0.3.0"], + "alpine_candidates": [], + "reason": "Legacy /lib libmd entry points forward to the official runtime SONAME. Original libmd/libbsd runtime and documentation APKs retain ownership; their development inputs are isolated for building shadow." }, "storage-util-linux": { "destination": "alpine-after-validation", diff --git a/configs/auth-upstream.json b/configs/auth-upstream.json index ac2e43c5..c76d9542 100644 --- a/configs/auth-upstream.json +++ b/configs/auth-upstream.json @@ -1,12 +1,4 @@ { - "libmd": { - "version": "1.2.0", - "url": "https://libbsd.freedesktop.org/releases/libmd-1.2.0.tar.xz", - "sha256": "ac15ffb8430502fbaccdec66c5a82ee0eab0b0f36220df56710feadfeb13d0a0", - "directory": "libmd-1.2.0", - "license_file": "COPYING", - "checksum_source": "https://lists.freedesktop.org/archives/libbsd/2026-May/000509.html" - }, "shadow": { "version": "4.20.2", "url": "https://github.com/shadow-maint/shadow/releases/download/4.20.2/shadow-4.20.2.tar.xz", diff --git a/configs/dependencies.lock.json b/configs/dependencies.lock.json index a86c783e..ed72ca52 100644 --- a/configs/dependencies.lock.json +++ b/configs/dependencies.lock.json @@ -2665,7 +2665,7 @@ "script": "tools/build/upstream-apk.sh", "target": "apk-root", "feature": "base", - "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 02365e78d654a7beb23fd35d7d69f4a649009ede; .PKGINFO license = BSD-3-Clause; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; libmd.so.0 remains provided by local libmd 1.3.0", + "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 02365e78d654a7beb23fd35d7d69f4a649009ede; .PKGINFO license = BSD-3-Clause; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; libmd.so.0 is provided by the official libmd 1.3.0-r0 APK", "license_in_source": ".PKGINFO" }, { @@ -2682,16 +2682,30 @@ "license_in_source": ".PKGINFO" }, { - "id": "libmd", - "kind": "tarball", - "version": "1.3.0", - "url": "https://libbsd.freedesktop.org/releases/libmd-1.3.0.tar.xz", - "sha256": "fc0f1eb6b6766470326f2c014693809190e67dba84274a6fbae9d4912d066706", - "directory": "libmd-1.3.0", - "license_in_source": "COPYING", - "checksum_source": "https://archive.hadrons.org/software/libmd/libmd-1.3.0.announce", - "script": "tools/build/upstream.sh", - "target": "auth-upstream" + "id": "alpine-libmd-doc", + "kind": "apk", + "version": "1.3.0-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libmd-doc-1.3.0-r0.apk", + "sha256": "f9f81d1cb8719bed024edc972e4af1d5bcdff8877891f53c49f35e6c3d5db3dd", + "directory": "libmd-doc-1.3.0-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit b9f624c71024df38a4cd84bc84b51fc3498f15a7; .PKGINFO license = BSD-3-Clause AND BSD-2-Clause AND ISC AND Beerware AND Public Domain; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" + }, + { + "id": "alpine-libmd", + "kind": "apk", + "version": "1.3.0-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libmd-1.3.0-r0.apk", + "sha256": "0d49d6bb91fafb818fccd9df25927ed51a308c944df2ffdbb505b364c9042df8", + "directory": "libmd-1.3.0-r0", + "script": "tools/build/upstream-apk.sh", + "target": "apk-root", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit b9f624c71024df38a4cd84bc84b51fc3498f15a7; .PKGINFO license = BSD-3-Clause AND BSD-2-Clause AND ISC AND Beerware AND Public Domain; SHA-256 and embedded official signature verified", + "license_in_source": ".PKGINFO" }, { "id": "libxcrypt", @@ -3324,7 +3338,7 @@ "script": "tools/build/libbsd-development.sh", "target": "libbsd-development", "feature": "base", - "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 02365e78d654a7beb23fd35d7d69f4a649009ede; .PKGINFO license = BSD-3-Clause; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; build-only headers, linker script and pkg-config files; never a rootfs overlay; use local libmd 1.3.0 development files", + "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 02365e78d654a7beb23fd35d7d69f4a649009ede; .PKGINFO license = BSD-3-Clause; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; build-only headers, linker script and pkg-config files; never a rootfs overlay; use the official libmd-dev 1.3.0-r0 APK for MD development inputs", "license_in_source": ".PKGINFO" }, { @@ -3340,6 +3354,19 @@ "note": "Official Alpine v3.24 main x86_64 package; aports recipe commit 02365e78d654a7beb23fd35d7d69f4a649009ede; .PKGINFO license = BSD-3-Clause; archive SHA-256 computed from downloaded bytes; embedded APK signature verified by apk-tools with the official Alpine keys; build-only libbsd.a; never a rootfs overlay", "license_in_source": ".PKGINFO" }, + { + "id": "runtime-dev-libmd-dev", + "kind": "apk", + "version": "1.3.0-r0", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/libmd-dev-1.3.0-r0.apk", + "sha256": "3e8e607e41d45bc385aaa4dfaf28fe888c9316e2f6b188866cfd8037b8a13dd0", + "directory": "libmd-dev-1.3.0-r0", + "script": "tools/build/libbsd-development.sh", + "target": "libbsd-development", + "feature": "base", + "note": "Official Alpine edge main x86_64 APK; recipe commit b9f624c71024df38a4cd84bc84b51fc3498f15a7; .PKGINFO license = BSD-3-Clause AND BSD-2-Clause AND ISC AND Beerware AND Public Domain; SHA-256 and embedded official signature verified; build-only shadow dependency, never a runtime overlay", + "license_in_source": ".PKGINFO" + }, { "id": "runtime-dev-libpng-dev", "kind": "apk", diff --git a/scripts/reliefos/Makefile.apk b/scripts/reliefos/Makefile.apk index 6cff80f3..3fadcf3e 100644 --- a/scripts/reliefos/Makefile.apk +++ b/scripts/reliefos/Makefile.apk @@ -8,10 +8,10 @@ APK_REPOSITORY := $(APK_WORK)/repository APK_MANIFEST := $(APK_WORK)/manifest.json APK_OWNERSHIP := $(APK_WORK)/ownership.tsv APK_SIGNING_KEY ?= $(HOME)/.local/share/leonos/apk-signing/key.pem -# Generation 6 transfers the util-linux suite to official Alpine owners. -# This sorts after generation 5 even for development builds at the same commit. +# Generation 7 transfers libmd and its development inputs to official APKs. +# This sorts after generation 6 even for development builds at the same commit. # Published releases must still use an increasing SOURCE_DATE_EPOCH. -APK_BUILD_VERSION ?= 6.$(SOURCE_DATE_EPOCH)-r0 +APK_BUILD_VERSION ?= 7.$(SOURCE_DATE_EPOCH)-r0 APK_STAGE_SCRIPT := $(RELIEFOS_SRC)/tools/build/apk-stage.sh APK_STAGE_INPUTS := $(RELIEFOS_SRC)/tools/build/apk-layout.sh $(RELIEFOS_LAYOUT_TOOL) $(RELIEFOS_LOCK) $(RELIEFOS_DEPS_TOOL) BUILD_LOG_INPUTS := $(RELIEFOS_SHELL_LOG) $(RELIEFOS_SRC)/tools/build/run-logged.sh $(RELIEFOS_SRC)/tools/build/format-log.awk diff --git a/scripts/reliefos/Makefile.apk-dependencies b/scripts/reliefos/Makefile.apk-dependencies index a7049cfb..35dbbf98 100644 --- a/scripts/reliefos/Makefile.apk-dependencies +++ b/scripts/reliefos/Makefile.apk-dependencies @@ -7,18 +7,19 @@ $(UPSTREAM_APK) $(UPSTREAM_APK_ROOT)/.complete &: $(RELIEFOS_SRC)/tools/build/up .PHONY: upstream-apk upstream-apk: $(UPSTREAM_APK) $(UPSTREAM_APK_ROOT)/.complete -# Shadow consumes official libbsd headers and libraries in an isolated build +# Shadow consumes official libbsd/libmd headers and libraries in an isolated build # root. Do not add this root to the guest overlay or the public musl sysroot. LIBBSD_DEVELOPMENT_ROOT := $(UPSTREAM_ROOT)/libbsd/root upstream_libbsd_products := $(addprefix $(LIBBSD_DEVELOPMENT_ROOT)/,usr/include/bsd/stdlib.h usr/include/bsd/sys/queue.h usr/lib/libbsd.so usr/lib/libbsd.so.0 usr/lib/libbsd.so.0.12.2 usr/lib/libbsd.a usr/lib/pkgconfig/libbsd.pc usr/lib/pkgconfig/libbsd-overlay.pc lib/libbsd.so lib/libbsd.so.0 lib/libbsd.a) +upstream_libbsd_products += $(addprefix $(LIBBSD_DEVELOPMENT_ROOT)/,usr/include/md5.h usr/include/sha256.h usr/include/sha512.h usr/lib/libmd.so usr/lib/libmd.so.0 usr/lib/libmd.so.0.3.0 usr/lib/libmd.a usr/lib/pkgconfig/libmd.pc lib/libmd.so lib/libmd.so.0 lib/libmd.a) $(LIBBSD_DEVELOPMENT_ROOT)/.complete $(upstream_libbsd_products) &: $(RELIEFOS_SRC)/tools/build/libbsd-development.sh $(RELIEFOS_LOCK) $(RELIEFOS_DEPS_TOOL) $(UPSTREAM_APK) $(RELIEFOS_SRC)/resources/licenses/libbsd-LICENSE $(Q)sh $(RELIEFOS_SRC)/tools/build/libbsd-development.sh $(RELIEFOS_SRC) $(abspath $(RELIEFOS_DEPS_TOOL)) $(RELIEFOS_LOCK) $(RELIEFOS_CACHE) $(abspath $(UPSTREAM_APK)) $(abspath $(LIBBSD_DEVELOPMENT_ROOT)) $(Q)touch $(upstream_libbsd_products) $(O_META)/libbsd-development-present.parameters: FORCE $(RELIEFOS_SRC)/tools/build/upstream-verify.sh $(Q)sh $(RELIEFOS_SRC)/tools/build/upstream-verify.sh $(LIBBSD_DEVELOPMENT_ROOT) $(LIBBSD_DEVELOPMENT_ROOT).files $@ $(LIBBSD_DEVELOPMENT_ROOT)/.complete $(upstream_libbsd_products): $(O_META)/libbsd-development-present.parameters -.PHONY: upstream-libbsd libbsd-development -upstream-libbsd libbsd-development: $(LIBBSD_DEVELOPMENT_ROOT)/.complete $(upstream_libbsd_products) +.PHONY: upstream-libbsd upstream-libmd libbsd-development libmd-development +upstream-libbsd upstream-libmd libbsd-development libmd-development: $(LIBBSD_DEVELOPMENT_ROOT)/.complete $(upstream_libbsd_products) UTIL_LINUX_DEVELOPMENT_ROOT := $(UPSTREAM_ROOT)/util-linux/root upstream_util-linux_products := $(addprefix $(UTIL_LINUX_DEVELOPMENT_ROOT)/,usr/include/blkid/blkid.h usr/include/uuid/uuid.h usr/include/libeconf.h usr/lib/libblkid.a usr/lib/libuuid.a usr/lib/libeconf.a usr/lib/libblkid.so usr/lib/libuuid.so usr/lib/libeconf.so usr/lib/pkgconfig/blkid.pc usr/lib/pkgconfig/uuid.pc usr/lib/pkgconfig/libeconf.pc) diff --git a/scripts/reliefos/Makefile.upstream b/scripts/reliefos/Makefile.upstream index 7ecc0bfc..4e289fa5 100644 --- a/scripts/reliefos/Makefile.upstream +++ b/scripts/reliefos/Makefile.upstream @@ -1,8 +1,7 @@ # Include after third-party.mk, pam.mk and runtime.mk. Each package owns an isolated root. UPSTREAM_ROOT := $(O)/upstream UPSTREAM_SCRIPT := $(RELIEFOS_SRC)/tools/build/upstream.sh -UPSTREAM_PACKAGES := libmd sudo shadow exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg -upstream_libmd_outputs := lib/libmd.so.0 usr/include/md5.h +UPSTREAM_PACKAGES := sudo shadow exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg upstream_sudo_outputs := usr/bin/sudo usr/lib/sudo/sudoers.so upstream_shadow_outputs := bin/login usr/sbin/useradd usr/sbin/usermod usr/sbin/userdel upstream_exfatprogs_outputs := usr/sbin/mkfs.exfat usr/sbin/fsck.exfat @@ -16,7 +15,7 @@ upstream_nuked-opl3_script := $(RELIEFOS_SRC)/tools/build/opl3.sh upstream_ffmpeg_outputs := usr/lib/libavformat-reliefplayer.so.62 usr/lib/libavcodec-reliefplayer.so.62 usr/lib/libavutil-reliefplayer.so.60 usr/lib/libswresample-reliefplayer.so.6 usr/lib/libswscale-reliefplayer.so.9 usr/include/libavformat/avformat.h usr/include/libavcodec/avcodec.h usr/include/libavutil/avutil.h usr/include/libswresample/swresample.h usr/include/libswscale/swscale.h upstream_ffmpeg_script := $(RELIEFOS_SRC)/tools/build/ffmpeg.sh $(foreach package,$(UPSTREAM_PACKAGES),$(eval upstream_$(package)_primary := $(upstream_$(package)_outputs))) -upstream_shadow_deps := libmd libbsd +upstream_shadow_deps := libbsd upstream_exfatprogs_deps := util-linux upstream_alsa-utils_deps := alsa-lib upstream_alsa-lib_patches := $(wildcard $(RELIEFOS_SRC)/patches/alsa-lib/*.patch) diff --git a/tests/build/test-deps.sh b/tests/build/test-deps.sh index 8ca406da..264957a2 100755 --- a/tests/build/test-deps.sh +++ b/tests/build/test-deps.sh @@ -106,11 +106,14 @@ fi expect_output_is 'a submodule reports its pinned commit' 9fa28ece75d8a2191de7c5bb53bed224c5947417 \ "$deps" --lock "$lock" --id musl --print commit expect_output_is 'a tarball reports its digest' \ - fc0f1eb6b6766470326f2c014693809190e67dba84274a6fbae9d4912d066706 \ - "$deps" --lock "$lock" --id libmd --print sha256 + 102bbdfd934776c12c6d83743a31ec648f8c2f1ddfa1832b6e13b6efd09412cb \ + "$deps" --lock "$lock" --id exfatprogs --print sha256 expect_output_is 'a tarball reports its download url' \ - https://libbsd.freedesktop.org/releases/libmd-1.3.0.tar.xz \ - "$deps" --lock "$lock" --id libmd --print url + https://github.com/exfatprogs/exfatprogs/releases/download/1.4.4/exfatprogs-1.4.4.tar.xz \ + "$deps" --lock "$lock" --id exfatprogs --print url +expect_output_is 'official libmd reports its pinned APK digest' \ + 0d49d6bb91fafb818fccd9df25927ed51a308c944df2ffdbb505b364c9042df8 \ + "$deps" --lock "$lock" --id alpine-libmd --print sha256 expect_failure 'an unknown id fails rather than printing nothing' \ "$deps" --lock "$lock" --id does-not-exist --print commit expect_failure 'an unknown field fails rather than printing nothing' \ @@ -128,7 +131,7 @@ else printf 'ok - submodules are excluded from the fetch list\n' fi checks=$((checks + 1)) -if printf '%s\n' "$fetch_list" | grep -q 'libmd-1.3.0.tar.xz'; then +if printf '%s\n' "$fetch_list" | grep -q 'exfatprogs-1.4.4.tar.xz'; then printf 'ok - downloaded tarballs appear in the fetch list\n' else printf 'FAIL - downloaded tarballs must appear in the fetch list\n' diff --git a/tests/build/test-libbsd-development.sh b/tests/build/test-libbsd-development.sh index b04eb1c0..cd874a96 100755 --- a/tests/build/test-libbsd-development.sh +++ b/tests/build/test-libbsd-development.sh @@ -33,12 +33,15 @@ case $4 in alpine-libbsd) name=libbsd;; runtime-dev-libbsd-dev) name=libbsd-dev;; runtime-dev-libbsd-static) name=libbsd-static;; + alpine-libmd) name=libmd;; + runtime-dev-libmd-dev) name=libmd-dev;; *) exit 2;; esac +case $name in libmd*) version=1.3.0-r0; channel=edge;; *) version=0.12.2-r0; channel=v3.24;; esac case $6 in url) if [ "${BAD_URL:-0}" = 1 ]; then printf 'https://fixture.invalid/../bad.apk\n'; exit; fi - printf 'https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/%s-0.12.2-r0.apk\n' "$name";; + printf 'https://dl-cdn.alpinelinux.org/alpine/%s/main/x86_64/%s-%s.apk\n' "$channel" "$name" "$version";; sha256) if [ "${BAD_DIGEST:-0}" = 1 ]; then printf 'bad-digest\n'; exit; fi cat "$FIXTURE_WORK/digests/$name";; @@ -78,15 +81,15 @@ exec "$FIXTURE_FIND" "$@" DATA chmod +x "$work/bin/"* -# The static BSD fixture deliberately needs libmd from a separate local stage. +# The BSD fixture needs libmd from a separately verified official APK. cc=${CC:-cc} printf 'int fixture_md(void) { return 17; }\n' >"$work/md.c" printf 'extern int fixture_md(void); int fixture_bsd(void) { return fixture_md(); }\n' >"$work/bsd.c" "$cc" -fPIC -c "$work/md.c" -o "$work/md.o" "$cc" -fPIC -c "$work/bsd.c" -o "$work/bsd.o" ar rcs "$work/md/lib/libmd.a" "$work/md.o" -"$cc" -shared -Wl,-soname,libmd.so.0 "$work/md.o" -o "$work/md/lib/libmd.so.0.0.0" -ln -s libmd.so.0.0.0 "$work/md/lib/libmd.so.0" +"$cc" -shared -Wl,-soname,libmd.so.0 "$work/md.o" -o "$work/md/lib/libmd.so.0.3.0" +ln -s libmd.so.0.3.0 "$work/md/lib/libmd.so.0" ln -s libmd.so.0 "$work/md/lib/libmd.so" "$cc" -shared -Wl,-soname,libbsd.so.0 "$work/bsd.o" -L"$work/md/lib" -lmd -o "$work/libbsd.so.0.12.2" ar rcs "$work/libbsd.a" "$work/bsd.o" @@ -144,12 +147,35 @@ for name in ('libbsd', 'libbsd-dev', 'libbsd-static'): with tarfile.open(work / 'good' / f'{name}-0.12.2-r0.apk', 'w:gz', format=tarfile.USTAR_FORMAT) as archive: for info, data in members: archive.addfile(info, io.BytesIO(data) if info.isreg() else None) +# The adapter must obtain MD bytes from their own signed package inputs, +# ignoring the similarly named unrelated archive in the BSD development APK. +for name in ('libmd', 'libmd-dev'): + members = [regular('.PKGINFO', f'pkgname = {name}\npkgver = 1.3.0-r0\narch = x86_64\n'.encode())] + if name == 'libmd': + members.append(regular('usr/lib/libmd.so.0.3.0', (work / 'md/lib/libmd.so.0.3.0').read_bytes())) + link = tarfile.TarInfo('usr/lib/libmd.so.0') + link.type, link.linkname = tarfile.SYMTYPE, 'libmd.so.0.3.0' + members.append((link, b'')) + else: + for header in ('md5.h', 'sha1.h', 'sha256.h', 'sha512.h'): + members.append(regular('usr/include/' + header, b'int fixture_md(void);\n')) + members.append(regular('usr/lib/libmd.a', (work / 'md/lib/libmd.a').read_bytes())) + md_pc = pc.replace(b'libbsd', b'libmd').replace(b'0.12.2', b'1.3.0').replace(b'Libs.private: -pthread -lmd\n', b'') + members.append(regular('usr/lib/pkgconfig/libmd.pc', md_pc)) + link = tarfile.TarInfo('usr/lib/libmd.so') + link.type, link.linkname = tarfile.SYMTYPE, 'libmd.so.0.3.0' + members.append((link, b'')) + members.append(regular('usr/include/linux/foreign.h', b'not an MD header\n')) + with tarfile.open(work / 'good' / f'{name}-1.3.0-r0.apk', 'w:gz', format=tarfile.USTAR_FORMAT) as archive: + for info, data in members: + archive.addfile(info, io.BytesIO(data) if info.isreg() else None) PY python3 "$work/packages.py" "$work" reseal() { - for name in libbsd libbsd-dev libbsd-static; do - sum=$(sha256sum "$cache/$name-0.12.2-r0.apk") + for name in libbsd libbsd-dev libbsd-static libmd libmd-dev; do + case $name in libmd*) version=1.3.0-r0;; *) version=0.12.2-r0;; esac + sum=$(sha256sum "$cache/$name-$version.apk") printf '%s\n' "${sum%% *}" >"$work/digests/$name" done } @@ -180,15 +206,21 @@ expect_failure() { reset_cache invoke -[ "$(wc -l <"$work/verifications" | tr -d ' ')" = 3 ] || fail 'did not verify every package' +[ "$(wc -l <"$work/verifications" | tr -d ' ')" = 5 ] || fail 'did not verify every package' cmp "$src/resources/licenses/libbsd-LICENSE" "$output/usr/share/licenses/libbsd/LICENSE" for library in libbsd.so libbsd.so.0 libbsd.so.0.12.2 libbsd.a; do [ "$(readlink "$output/lib/$library")" = "../usr/lib/$library" ] || fail "bad compatibility link: $library" test -s "$output/lib/$library" done [ "$(readlink "$output/usr/lib/libbsd.so.0")" = libbsd.so.0.12.2 ] || fail 'bad SONAME link' +for library in libmd.so libmd.so.0 libmd.so.0.3.0 libmd.a; do + [ "$(readlink "$output/lib/$library")" = "../usr/lib/$library" ] || fail "bad MD link: $library" + test -s "$output/lib/$library" +done +cmp "$work/md/lib/libmd.a" "$output/usr/lib/libmd.a" +test -s "$output/usr/include/sha1.h" [ ! -e "$output/lib/libbsd-ctor.a" ] || fail 'invented a ctor archive' -for path in usr/include/stdlib.h usr/include/sys/cdefs.h usr/include/linux/types.h usr/lib/libc.so usr/lib/libmd.a usr/lib/libbsd.la; do +for path in usr/include/stdlib.h usr/include/sys/cdefs.h usr/include/linux/types.h usr/include/linux/foreign.h usr/lib/libc.so usr/lib/libbsd.la; do [ ! -e "$output/$path" ] || fail "selected unrelated input: $path" done (cd "$output" && "$real_find" . ! -type d -print | sed 's@^./@@' | sort) >"$work/expected.files" @@ -197,12 +229,11 @@ grep -Fxq 'usr/include/bsd/nested/extra.h' "$output.files" grep -Fxq '.complete' "$output.files" if grep -F '/usr/lib/libbsd.so.0.12.2' "$output/usr/lib/libbsd.so"; then fail 'absolute linker-script path'; fi -# Copy into shadow-style deps, merge the local libmd stage and move the tree. +# Relocate the combined shadow development root without any local MD stage. combined=$work/deps\ before\ moving relocated=$work/relocated mkdir -p "$combined" cp -a "$output/." "$combined/" -cp -a "$work/md/." "$combined/" mv "$combined" "$relocated" cat >"$work/consumer.c" <<'DATA' #include @@ -216,9 +247,9 @@ LD_LIBRARY_PATH="$relocated/lib:$relocated/usr/lib" "$work/dynamic" "$work/static" if "$cc" -I"$relocated/usr/include" "$work/consumer.c" -L"$relocated/lib" -L"$relocated/usr/lib" \ -Wl,-Bstatic -lbsd -Wl,-Bdynamic -o "$work/no-md" >"$work/no-md.log" 2>&1; then - fail 'static fixture did not require local libmd.a' + fail 'static fixture did not require official libmd.a' fi -for package in libbsd libbsd-overlay; do +for package in libbsd libbsd-overlay libmd; do pc_flags=$(PKG_CONFIG_PATH='' PKG_CONFIG_LIBDIR="$relocated/usr/lib/pkgconfig" \ PKG_CONFIG_SYSROOT_DIR="$relocated" pkg-config --cflags --libs --static "$package") case $pc_flags in *"$relocated/usr/"*) ;; *) fail 'pkg-config lost relocated prefix';; esac @@ -232,7 +263,7 @@ printf 'corruption\n' >>"$cache/libbsd-0.12.2-r0.apk" expect_failure 'checksum mismatch' [ ! -s "$work/verifications" ] || fail 'verification ran before checksum validation' reset_cache -FAIL_VERIFY_AFTER=3 expect_failure 'invalid signature in final package' +FAIL_VERIFY_AFTER=5 expect_failure 'invalid signature in final package' reset_cache rm "$cache/libbsd-static-0.12.2-r0.apk" expect_failure 'missing offline cache' @@ -351,4 +382,4 @@ cmp "$work/before.files" "$output.files" # Also exercise invocation entirely through relative arguments. (cd "$work" && PATH="$work/bin:$PATH" sh "$adapter" source bin/deps lock cache bin/apk relative-root) test -s "$work/relative-root/lib/libbsd.so.0" -printf 'libbsd development: relocation, local-libmd linking, inventory recovery and failure safety passed\n' +printf 'BSD development: official libmd linking, relocation, inventory recovery and failure safety passed\n' diff --git a/tests/build/test-third-party.sh b/tests/build/test-third-party.sh index 4ef63e74..09f1b9e2 100755 --- a/tests/build/test-third-party.sh +++ b/tests/build/test-third-party.sh @@ -81,8 +81,8 @@ locked_patch=$("$deps" --lock "$lock" --id musl --list-patches 2>/dev/null | cut # --- an unmet dependency stops the build without going online ----------------- expect_failure 'a missing download is refused by name, not fetched on demand' \ - 'libmd' \ - sh "$fetch" --deps "$deps" --lock "$lock" --cache "$work/empty" --verify-only + 'exfatprogs' \ + sh "$fetch" --deps "$deps" --lock "$lock" --cache "$work/empty" --verify-only --only exfatprogs # A cache that already holds the right bytes must not need the network at all. # The fixture digest is computed from the fixture file, so this proves the @@ -185,10 +185,10 @@ else printf 'FAIL - sysroot records %s, the lock pins %s\n' "$stamp_musl" "$locked_musl" failures=$((failures + 1)) fi -stamp_patch=$(sed -n 's/.*"sha256": "\([0-9a-f]*\)".*/\1/p' "$stamp" | head -n1) +stamp_patch=$(sed -n 's/.*"sha256": "\([0-9a-f]*\)".*/\1/p' "$stamp") checks=$((checks + 1)) if [ -n "$locked_patch" ] && [ "$stamp_patch" = "$locked_patch" ]; then - printf 'ok - the sysroot records the patch digest that was applied\n' + printf 'ok - the sysroot records every applied patch digest in order\n' else printf 'FAIL - sysroot patch digest %s does not match the lock (%s)\n' \ "$stamp_patch" "$locked_patch" diff --git a/tests/integration/apk-base-migration.sh b/tests/integration/apk-base-migration.sh index b346d6b4..a0affe85 100644 --- a/tests/integration/apk-base-migration.sh +++ b/tests/integration/apk-base-migration.sh @@ -4,7 +4,7 @@ set -eu PATH=/usr/sbin:/usr/bin:/sbin:/bin export PATH -for package in libbsd libbsd-doc dosfstools dosfstools-doc e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc ca-certificates-bundle; do +for package in libmd libmd-doc libbsd libbsd-doc dosfstools dosfstools-doc e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc ca-certificates-bundle; do apk info -e "$package" done test -s /etc/ssl/certs/ca-certificates.crt @@ -14,6 +14,15 @@ for entry in sbin/mkfs.ext4:e2fsprogs sbin/fsck.ext2:e2fsprogs sbin/mkfs.fat:dos apk info --who-owns "/$path" | grep -F "owned by $owner-" done apk info --who-owns /lib/libmd.so.0 | grep -F 'owned by reliefos-auth-support-libraries-' +apk info --who-owns /usr/lib/libmd.so.0 | grep -F 'owned by libmd-' +apk info --who-owns /usr/share/licenses/libmd/COPYING | grep -F 'owned by libmd-doc-' +test "$(readlink /lib/libmd.so.0)" = ../usr/lib/libmd.so.0 +for library in libmd.so libmd.so.0.3.0; do + test "$(readlink "/lib/$library")" = libmd.so.0 +done +test ! -e /lib/libmd.a +test ! -e /usr/lib/libmd.a +test ! -e /usr/include/md5.h apk info --who-owns /usr/lib/libblkid.so.1 | grep -F 'owned by libblkid-' apk info --who-owns /usr/lib/libuuid.so.1 | grep -F 'owned by libuuid-' test ! -e /lib/libbsd.so.0 diff --git a/tests/integration/apk-libmd-migration.sh b/tests/integration/apk-libmd-migration.sh new file mode 100644 index 00000000..76211add --- /dev/null +++ b/tests/integration/apk-libmd-migration.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# Run in a disposable signed root/guest with two public executable probes. +# The account created here is temporary and has no home or usable password. +set -eu +[ "$#" = 2 ] || { echo 'usage: apk-libmd-migration.sh DYNAMIC_PROBE STATIC_PROBE' >&2; exit 2; } +PATH=/usr/sbin:/usr/bin:/sbin:/bin +export PATH +test "$(id -u)" = 0 +apk info -e libmd +apk info -e libmd-doc +apk info --who-owns /usr/lib/libmd.so.0 | grep -F 'owned by libmd-' +apk info --who-owns /usr/share/licenses/libmd/COPYING | grep -F 'owned by libmd-doc-' +for library in libmd.so libmd.so.0 libmd.so.0.3.0; do + apk info --who-owns "/lib/$library" | grep -F 'owned by reliefos-auth-support-libraries-' + test -s "/lib/$library" +done +test "$(readlink /lib/libmd.so.0)" = ../usr/lib/libmd.so.0 +test "$(readlink /lib/libmd.so)" = libmd.so.0 +test "$(readlink /lib/libmd.so.0.3.0)" = libmd.so.0 +for path in /lib/libmd.a /usr/lib/libmd.a /usr/include/md5.h /lib/pkgconfig/libmd.pc; do + test ! -e "$path" +done +work=$(mktemp -d /tmp/apk-libmd.XXXXXX) +account=mdqa$$ +group=mdqg$$ +group_created=no user_created=no +cleanup() { + status=$? + trap - 0 + if [ "$user_created" = yes ]; then userdel "$account" || status=1; fi + if [ "$group_created" = yes ]; then groupdel "$group" || status=1; fi + rm -rf "$work" || status=1 + exit "$status" +} +trap cleanup 0 +trap 'exit 130' HUP INT TERM +printf abc >"$work/input" +chmod 600 "$work/input" +for probe do + "$probe" "$work/input" + runuser -u nobody -- "$probe" --deny "$work/input" +done +groupadd "$group" +group_created=yes +useradd -l -M -g "$group" -s /bin/sh "$account" +user_created=yes +usermod -c libmd-qa -s /bin/bash "$account" +test "$(id -gn "$account")" = "$group" +userdel "$account" +user_created=no +groupdel "$group" +group_created=no +printf '%s\n' 'PASS official libmd ownership, compatibility links, digests and shadow account tools' diff --git a/tests/integration/upstream-incremental.sh b/tests/integration/upstream-incremental.sh index 7852375e..cbec32eb 100755 --- a/tests/integration/upstream-incremental.sh +++ b/tests/integration/upstream-incremental.sh @@ -8,7 +8,7 @@ out=$(CDPATH= cd -- "$out" && pwd) work=$(mktemp -d "$out/meta/upstream-incremental.XXXXXX") trap 'rm -rf "$work"' EXIT snapshot() { - for pkg in libmd libbsd util-linux sudo shadow exfatprogs; do + for pkg in libbsd util-linux sudo shadow exfatprogs; do find "$out/upstream/$pkg/root" -type f -printf '%p %T@ %s\n' done find "$out/upstream/apk" "$out/upstream/runtime-development" -type f -printf '%p %T@ %s\n' @@ -38,4 +38,10 @@ expected=$(sha256sum "$secondary") rm "$secondary" make -C "$src" O="$make_out" util-linux-development -j8 > "$work/restore-util-linux.log" 2>&1 || { cat "$work/restore-util-linux.log" >&2; exit 1; } test "$(sha256sum "$secondary")" = "$expected" +secondary=$out/upstream/libbsd/root/usr/include/sha1.h +test -s "$secondary" +expected=$(sha256sum "$secondary") +rm "$secondary" +make -C "$src" O="$make_out" upstream-libmd -j8 > "$work/restore-libmd.log" 2>&1 || { cat "$work/restore-libmd.log" >&2; exit 1; } +test "$(sha256sum "$secondary")" = "$expected" printf '%s\n' 'upstream no-op mtimes and secondary-output restoration: PASS' diff --git a/tests/integration/upstream-products.sh b/tests/integration/upstream-products.sh index 78a966b5..feeccadf 100755 --- a/tests/integration/upstream-products.sh +++ b/tests/integration/upstream-products.sh @@ -3,7 +3,7 @@ set -eu root=${1:?usage: upstream-products.sh UPSTREAM_ROOT} apps=${2:-$root/../userland} -for entry in libmd/lib/libmd.so.0 libbsd/usr/lib/libbsd.so.0 sudo/usr/bin/sudo sudo/usr/lib/sudo/sudoers.so shadow/bin/login shadow/usr/sbin/useradd shadow/usr/sbin/usermod shadow/usr/sbin/userdel exfatprogs/usr/sbin/mkfs.exfat exfatprogs/usr/sbin/fsck.exfat; do +for entry in libbsd/usr/lib/libbsd.so.0 libbsd/usr/lib/libmd.so.0 sudo/usr/bin/sudo sudo/usr/lib/sudo/sudoers.so shadow/bin/login shadow/usr/sbin/useradd shadow/usr/sbin/usermod shadow/usr/sbin/userdel exfatprogs/usr/sbin/mkfs.exfat exfatprogs/usr/sbin/fsck.exfat; do pkg=${entry%%/*}; path=$root/$pkg/root/${entry#*/} test -f "$path" readelf -h "$path" | grep -q 'Advanced Micro Devices X86-64' @@ -12,7 +12,7 @@ for entry in libmd/lib/libmd.so.0 libbsd/usr/lib/libbsd.so.0 sudo/usr/bin/sudo s esac done src=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) -for package in libbsd libbsd-doc dosfstools dosfstools-doc e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc ncurses ncurses-terminfo util-linux util-linux-misc util-linux-login runuser blkid lsblk sfdisk mount umount libblkid libuuid libmount libfdisk libsmartcols; do +for package in libmd libmd-doc libbsd libbsd-doc dosfstools dosfstools-doc e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc ncurses ncurses-terminfo util-linux util-linux-misc util-linux-login runuser blkid lsblk sfdisk mount umount libblkid libuuid libmount libfdisk libsmartcols; do set -- "$root/apk/packages/$package-"[0-9]*.apk test "$#" = 1 && test -s "$1" "$root/apk/apk.static" --keys-dir "$src/system/rootfs/etc/apk/keys" verify "$1" diff --git a/tools/build/apk-stage.sh b/tools/build/apk-stage.sh index 992f1338..050e233a 100644 --- a/tools/build/apk-stage.sh +++ b/tools/build/apk-stage.sh @@ -409,10 +409,10 @@ while IFS= read -r group; do reliefos-apk-tools) dependencies="$dependencies reliefos-busybox" ;; reliefos-busybox) dependencies="$dependencies reliefos-coreutils" ;; reliefos-coreutils) dependencies="$dependencies !coreutils !coreutils-single" ;; - # These local groups retain libmd/exFAT and compatibility aliases. + # These local groups retain exFAT and compatibility aliases. # Their real dependencies pull the migrated tools into older systems # in the same signed transaction that upgrades the former file owner. - reliefos-auth-support-libraries) dependencies="$dependencies libbsd libbsd-doc" ;; + reliefos-auth-support-libraries) dependencies="$dependencies libbsd libbsd-doc libmd libmd-doc" ;; reliefos-authentication) dependencies="$dependencies util-linux-login" ;; reliefos-storage-util-linux) dependencies="$dependencies util-linux util-linux-misc util-linux-login runuser blkid lsblk sfdisk mount umount libblkid libfdisk libmount libsmartcols libuuid util-linux-doc util-linux-login-doc" ;; reliefos-storage-filesystems) dependencies="$dependencies e2fsprogs e2fsprogs-extra e2fsprogs-libs libcom_err e2fsprogs-doc dosfstools dosfstools-doc" ;; diff --git a/tools/build/libbsd-development.sh b/tools/build/libbsd-development.sh index 0082fcb1..560c7b0a 100755 --- a/tools/build/libbsd-development.sh +++ b/tools/build/libbsd-development.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Offline, build-only libbsd root. Never overlay this root on the guest/sysroot. +# Offline libbsd/libmd inputs for shadow. Never overlay on the guest/sysroot. set -eu LC_ALL=C export LC_ALL @@ -61,15 +61,22 @@ trap cleanup 0 trap 'exit 130' HUP INT TERM mkdir -p "$stage/usr/share/reliefos/sdk/apk" -for id in alpine-libbsd runtime-dev-libbsd-dev runtime-dev-libbsd-static; do +for id in alpine-libbsd runtime-dev-libbsd-dev runtime-dev-libbsd-static \ + alpine-libmd runtime-dev-libmd-dev; do case $id in alpine-libbsd) package=libbsd;; runtime-dev-libbsd-dev) package=libbsd-dev;; runtime-dev-libbsd-static) package=libbsd-static;; + alpine-libmd) package=libmd;; + runtime-dev-libmd-dev) package=libmd-dev;; + esac + case $package in + libmd*) channel=edge; version=1.3.0-r0;; + *) channel=v3.24; version=0.12.2-r0;; esac url=$("$deps" --lock "$lock" --id "$id" --print url) digest=$("$deps" --lock "$lock" --id "$id" --print sha256) - [ "$url" = "https://dl-cdn.alpinelinux.org/alpine/v3.24/main/x86_64/$package-0.12.2-r0.apk" ] || die "unexpected locked URL for $id" + [ "$url" = "https://dl-cdn.alpinelinux.org/alpine/$channel/main/x86_64/$package-$version.apk" ] || die "unexpected locked URL for $id" [ "${#digest}" = 64 ] || die "invalid locked digest for $id" case $digest in *[!0-9a-f]*) die "invalid locked digest for $id";; esac archive=$cache/${url##*/} @@ -114,13 +121,26 @@ for id in alpine-libbsd runtime-dev-libbsd-dev runtime-dev-libbsd-static; do alpine-libbsd:usr/lib/libbsd.so.0|alpine-libbsd:usr/lib/libbsd.so.0.12.2|\ runtime-dev-libbsd-dev:usr/include/bsd/*|runtime-dev-libbsd-dev:usr/lib/libbsd.so|\ runtime-dev-libbsd-dev:usr/lib/pkgconfig/libbsd.pc|runtime-dev-libbsd-dev:usr/lib/pkgconfig/libbsd-overlay.pc|\ - runtime-dev-libbsd-static:usr/lib/libbsd.a) selected=yes; destination=$member;; + runtime-dev-libbsd-static:usr/lib/libbsd.a|\ + alpine-libmd:usr/lib/libmd.so.0|alpine-libmd:usr/lib/libmd.so.0.3.0|\ + runtime-dev-libmd-dev:usr/include/md[245].h|runtime-dev-libmd-dev:usr/include/ripemd.h|\ + runtime-dev-libmd-dev:usr/include/rmd160.h|runtime-dev-libmd-dev:usr/include/sha.h|\ + runtime-dev-libmd-dev:usr/include/sha1.h|runtime-dev-libmd-dev:usr/include/sha2.h|\ + runtime-dev-libmd-dev:usr/include/sha256.h|runtime-dev-libmd-dev:usr/include/sha3.h|\ + runtime-dev-libmd-dev:usr/include/sha512.h|runtime-dev-libmd-dev:usr/lib/libmd.a|\ + runtime-dev-libmd-dev:usr/lib/libmd.so|runtime-dev-libmd-dev:usr/lib/pkgconfig/libmd.pc) + selected=yes; destination=$member;; esac [ "$selected" = yes ] || continue [ ! -e "$stage/$destination" ] && [ ! -L "$stage/$destination" ] || die "duplicate product: $destination" mkdir -p "$stage/$(dirname "$destination")" if [ "$type" = l ]; then - [ "$id:$member:$target" = 'alpine-libbsd:usr/lib/libbsd.so.0:libbsd.so.0.12.2' ] || die "unexpected product symlink: $member" + case $id:$member:$target in + alpine-libbsd:usr/lib/libbsd.so.0:libbsd.so.0.12.2|\ + alpine-libmd:usr/lib/libmd.so.0:libmd.so.0.3.0|\ + runtime-dev-libmd-dev:usr/lib/libmd.so:libmd.so.0.3.0) ;; + *) die "unexpected product symlink: $member";; + esac ln -s "$target" "$stage/$destination" else # Stdout extraction cannot follow archive links or apply owners, @@ -129,10 +149,10 @@ for id in alpine-libbsd runtime-dev-libbsd-dev runtime-dev-libbsd-static; do -xOzf "$archive" -- "$member" >"$stage/$destination" fi done <"$transaction/members" - awk -v package="$package" ' + awk -v package="$package" -v expected_version="$version" ' $0=="pkgname = "package {name++} /^pkgname = / {names++} - $0=="pkgver = 0.12.2-r0" {version++} + $0=="pkgver = "expected_version {version++} /^pkgver = / {versions++} $0=="arch = x86_64" {arch++} /^arch = / {arches++} @@ -142,7 +162,9 @@ done for product in usr/include/bsd/stdlib.h usr/include/bsd/string.h usr/include/bsd/unistd.h \ usr/include/bsd/sys/queue.h usr/lib/libbsd.so.0 usr/lib/libbsd.so.0.12.2 \ - usr/lib/libbsd.so usr/lib/libbsd.a usr/lib/pkgconfig/libbsd.pc usr/lib/pkgconfig/libbsd-overlay.pc; do + usr/lib/libbsd.so usr/lib/libbsd.a usr/lib/pkgconfig/libbsd.pc usr/lib/pkgconfig/libbsd-overlay.pc \ + usr/include/md5.h usr/include/sha256.h usr/include/sha512.h usr/lib/libmd.so.0 \ + usr/lib/libmd.so.0.3.0 usr/lib/libmd.so usr/lib/libmd.a usr/lib/pkgconfig/libmd.pc; do [ -s "$stage/$product" ] || die "missing product: $product" done [ -L "$stage/usr/lib/libbsd.so.0" ] || die 'missing runtime SONAME symlink' @@ -157,7 +179,7 @@ GROUP(/usr/lib/libbsd.so.0.12.2 AS_NEEDED(-lmd)) DATA cmp -s "$transaction/linker-script" "$stage/usr/lib/libbsd.so" || die 'unexpected libbsd linker script' sed 's@GROUP(/usr/lib/@GROUP(@' "$transaction/linker-script" >"$stage/usr/lib/libbsd.so" -for pc in libbsd libbsd-overlay; do +for pc in libbsd libbsd-overlay libmd; do [ "$(sed -n '/^prefix=/p' "$stage/usr/lib/pkgconfig/$pc.pc")" = 'prefix=/usr' ] || die "unexpected $pc.pc prefix" # Keep pcfiledir literal: pkg-config expands it at the relocated destination. # shellcheck disable=SC2016 @@ -166,14 +188,15 @@ for pc in libbsd libbsd-overlay; do done # Consumers search both deps/lib and deps/usr/lib. All aliases stay within this -# build root, including after it is copied beside the local libmd 1.3.0 stage. +# build root, including after relocation with the official libmd inputs. # Alpine does not ship libbsd-ctor.a; do not invent an empty archive for it. mkdir -p "$stage/lib" "$stage/usr/share/licenses/libbsd" -for library in libbsd.so libbsd.so.0 libbsd.so.0.12.2 libbsd.a; do +for library in libbsd.so libbsd.so.0 libbsd.so.0.12.2 libbsd.a \ + libmd.so libmd.so.0 libmd.so.0.3.0 libmd.a; do ln -s "../usr/lib/$library" "$stage/lib/$library" done cp "$src/resources/licenses/libbsd-LICENSE" "$stage/usr/share/licenses/libbsd/LICENSE" -printf '%s\n' 'libbsd 0.12.2-r0 build-only' >"$stage/.complete" +printf '%s\n' 'official libbsd 0.12.2-r0 / libmd 1.3.0-r0 build-only' >"$stage/.complete" (cd "$stage" && find . ! -type d -print) >"$transaction/paths" sed 's@^./@@' "$transaction/paths" >"$transaction/relative-paths" sort "$transaction/relative-paths" >"$transaction/root.files" diff --git a/tools/build/rootfs-stage.sh b/tools/build/rootfs-stage.sh index 9702811c..21edd283 100644 --- a/tools/build/rootfs-stage.sh +++ b/tools/build/rootfs-stage.sh @@ -19,7 +19,7 @@ link() { record l "$2" "/$1" 0777 "${3:-reliefos-base}" "${4:-unique}"; } enabled() { awk -F '\t' -v id="$1" '$1==id && $4==1 {found=1} END {exit !found}' "$metadata"; } # Every enabled upstream root is passed by the build graph. The default keeps # standalone callers compatible with the complete product package set. -rootfs_upstream_packages=${ROOTFS_UPSTREAM_PACKAGES:-'libmd sudo shadow exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg'} +rootfs_upstream_packages=${ROOTFS_UPSTREAM_PACKAGES:-'sudo shadow exfatprogs coreutils alsa-lib alsa-utils nuked-opl3 ffmpeg'} for package in $rootfs_upstream_packages; do if [ "$package" = ffmpeg ]; then if enabled reliefplayer; then @@ -35,7 +35,7 @@ for package in $rootfs_upstream_packages; do continue fi case $package in - libbsd|e2fsprogs|dosfstools|util-linux) + libmd|libbsd|e2fsprogs|dosfstools|util-linux) echo "rootfs-stage: $package is supplied by official APKs; remove its local overlay" >&2 exit 1 ;; @@ -257,6 +257,11 @@ for library in zlib libpng mbedtls3; do file "$src/resources/licenses/$library-LICENSE" "usr/share/licenses/reliefos-runtime-dependencies/$library-LICENSE" done file "$src/resources/licenses/libbsd-LICENSE" usr/share/licenses/libbsd/COPYING +# Official libmd lives in /usr/lib. Keep the former runtime entry points +# forwarding to its stable SONAME, including the historical full basename. +link lib/libmd.so.0 ../usr/lib/libmd.so.0 authentication-support +link lib/libmd.so libmd.so.0 authentication-support +link lib/libmd.so.0.3.0 libmd.so.0 authentication-support file "$src/resources/licenses/e2fsprogs-NOTICE" usr/share/licenses/e2fsprogs/NOTICE file "$src/resources/licenses/util-linux-README.licensing" usr/share/licenses/util-linux/README.licensing file "$src/resources/licenses/libeconf-LICENSE" usr/share/licenses/libeconf/LICENSE diff --git a/tools/build/upstream.sh b/tools/build/upstream.sh index 3940eba4..c63aa1dd 100755 --- a/tools/build/upstream.sh +++ b/tools/build/upstream.sh @@ -42,7 +42,6 @@ LIBS= PKG_CONFIG_PATH= PKG_CONFIG_LIBDIR="$auth/lib/pkgconfig:$auth/usr/lib/pkgc export CC AR RANLIB STRIP BUILD_CC CFLAGS CPPFLAGS LDFLAGS LIBS PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR set -- --host="$target" --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib case $pkg in -libmd) set -- "$@" --libdir=/lib ;; sudo) set -- "$@" --with-pam --with-pam-login --with-secure-path=/usr/sbin:/usr/bin:/sbin:/bin --with-rundir=/run/sudo --with-vardir=/var/lib/sudo --libexecdir=/usr/lib ;; shadow) set -- "$@" --bindir=/bin --sbindir=/sbin --with-libpam --with-yescrypt --without-su --disable-logind ;; exfatprogs) @@ -91,7 +90,6 @@ if [ "$pkg" = alsa-lib ]; then rm "$tmp/usr/lib/libasound.la" "$tmp/usr/lib/libatopology.la" fi case $pkg in -libmd) rm "$tmp/lib/libmd.la" ;; coreutils) sh "$source/build-aux/gen-lists-of-programs.sh" --list-progs > "$work/upstream-programs" sh "$src/tools/build/coreutils-check.sh" "$tmp" \ diff --git a/tools/test_auth_guest.py b/tools/test_auth_guest.py index cce40da6..fdff53e0 100644 --- a/tools/test_auth_guest.py +++ b/tools/test_auth_guest.py @@ -107,6 +107,7 @@ def main(): artifacts += sorted((stage / "lib").glob("libcrypt.so*")) artifacts += sorted((stage / "lib").glob("libbsd.so*")) artifacts += sorted((stage / "lib").glob("libmd.so*")) + artifacts += sorted((stage / "usr/lib").glob("libmd.so*")) artifacts += [stage / "sbin" / helper.name for helper in sorted((auth / "root/sbin").iterdir()) if helper.is_file()] artifacts += [tests / "gcc-probe.elf", stage / "reliefos/kernel.sys", diff --git a/tools/test_installer_update_packages.py b/tools/test_installer_update_packages.py index 564d9941..f8bf8835 100644 --- a/tools/test_installer_update_packages.py +++ b/tools/test_installer_update_packages.py @@ -78,6 +78,8 @@ def apk(cls, *arguments): def package(cls, name, version, repository, dependencies=(), payload=None, symlinks=None, replaces=(), modes=None): files = cls.work / (name + "-" + version) + if files.exists(): + shutil.rmtree(files) (files / "usr/share" / name).mkdir(parents=True, exist_ok=True) (files / "usr/share" / name / "version").write_text(version + "\n") for relative, text in (payload or {}).items(): @@ -304,6 +306,51 @@ def test_util_linux_transfer_retains_shadow_pam_and_official_su_modes(self): self.assertEqual((target / "bin/su").stat().st_mode & 0o7777, 0o4755) self.assertEqual((target / "etc/pam.d/su-l").read_text(), "administrator policy\n") + def test_libmd_transfer_removes_old_development_files_and_keeps_legacy_links(self): + old, new = self.runner / "oldrepo", self.runner / "newrepo" + target = self.runner / "target" + self.package("reliefos-auth-support-libraries", "6.0-r0", old, payload={ + "lib/libmd.so.0.3.0": "old local library\n", "lib/libmd.a": "old archive\n", + "usr/share/licenses/libmd/COPYING": "old license\n"}, + symlinks={"lib/libmd.so": "libmd.so.0.3.0", "lib/libmd.so.0": "libmd.so.0.3.0"}) + self.package("reliefos-base", "6.0-r0", old, payload={ + "usr/include/md5.h": "old header\n", "lib/pkgconfig/libmd.pc": "old build flags\n"}) + self.package("libmd", "1.3.0-r0", new, + payload={"usr/lib/libmd.so.0.3.0": "official library\n"}, + symlinks={"usr/lib/libmd.so.0": "libmd.so.0.3.0"}) + self.package("libmd-doc", "1.3.0-r0", new, + payload={"usr/share/licenses/libmd/COPYING": "official license\n"}) + self.package("reliefos-auth-support-libraries", "7.0-r0", new, ["libmd", "libmd-doc"], + symlinks={"lib/libmd.so.0": "../usr/lib/libmd.so.0", + "lib/libmd.so": "libmd.so.0", "lib/libmd.so.0.3.0": "libmd.so.0"}) + self.package("reliefos-base", "7.0-r0", new) + self.index(old) + self.index(new) + repositories = self.runner / "old.repositories" + repositories.write_text("ndx " + str(old / "packages.adb") + "\n") + self.apk("--root", target, "--repositories-file", repositories, "--no-network", + "--no-scripts", "add", "reliefos-base", "reliefos-auth-support-libraries") + protected = {name: (target / name).read_bytes() for name in ( + "etc/apk/world", "etc/reliefos/local.conf", "home/test/document.txt")} + checked = self.check() + self.assertEqual(checked.returncode, 0, checked.stdout + checked.stderr) + for _ in range(2): + result = self.transaction("--apply") + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + for name, content in protected.items(): + self.assertEqual((target / name).read_bytes(), content, name) + for path in ("lib/libmd.a", "usr/include/md5.h", "lib/pkgconfig/libmd.pc"): + self.assertFalse((target / path).exists(), path) + self.assertEqual(os.readlink(target / "lib/libmd.so.0"), "../usr/lib/libmd.so.0") + for name in ("libmd.so", "libmd.so.0.3.0"): + self.assertEqual(os.readlink(target / "lib" / name), "libmd.so.0") + self.assertEqual((target / "lib" / name).read_text(), "official library\n") + for path, package in (("usr/lib/libmd.so.0", "libmd"), + ("usr/share/licenses/libmd/COPYING", "libmd-doc"), + ("lib/libmd.so.0", "reliefos-auth-support-libraries")): + owner = self.apk("--root", target, "info", "--who-owns", "/" + path).stdout + self.assertIn("owned by " + package + "-", owner) + def test_old_console_ca_placeholder_is_replaced_by_real_bundle(self): old, new = self.runner / "oldrepo", self.runner / "newrepo" target = self.runner / "target" diff --git a/tools/tests/libmd_runtime_probe.c b/tools/tests/libmd_runtime_probe.c new file mode 100644 index 00000000..e7aaf7b3 --- /dev/null +++ b/tools/tests/libmd_runtime_probe.c @@ -0,0 +1,57 @@ +/* Exercise actual libmd/libbsd APIs with their exported development headers. */ +#include +#include +#include +#include +#include +#include +#include +#include + +static int digest_matches(const char *name, const char *actual, const char *expected) +{ + if (actual && strcmp(actual, expected) == 0) + return 0; + fprintf(stderr, "%s: got %s, expected %s\n", name, actual ? actual : "NULL", expected); + return 1; +} + +int main(int argc, char **argv) +{ + static const unsigned char input[] = "abc"; + static const char md5[] = "900150983cd24fb0d6963f7d28e17f72"; + char buffer[129], permissions[12]; + int failures = 0; + + if (argc == 3 && strcmp(argv[1], "--deny") == 0) { + errno = 0; + if (MD5File(argv[2], buffer) != NULL || errno != EACCES) { + fprintf(stderr, "MD5File denied read: errno=%d\n", errno); + return 1; + } + puts("PASS libmd respects file read permissions"); + return 0; + } + if (argc != 2) { + fprintf(stderr, "usage: %s FILE_CONTAINING_abc | --deny PROTECTED_FILE\n", argv[0]); + return 2; + } + failures += digest_matches("MD5Data", MD5Data(input, 3, buffer), md5); + failures += digest_matches("SHA256Data", SHA256Data(input, 3, buffer), + "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"); + failures += digest_matches("SHA512Data", SHA512Data(input, 3, buffer), + "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" + "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"); + failures += digest_matches("MD5File", MD5File(argv[1], buffer), md5); + errno = 0; + if (MD5File("/no-such-libmd-runtime-probe", buffer) != NULL || errno != ENOENT) { + fprintf(stderr, "MD5File missing input: errno=%d\n", errno); + failures++; + } + strmode(S_IFREG | 0644, permissions); + failures += digest_matches("libbsd strmode", permissions, "-rw-r--r-- "); + if (failures) + return 1; + puts("PASS official libmd digest vectors, file errors and libbsd dependency"); + return 0; +} From 0092833a718033c965567438f2f16a01e69720b5 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sat, 14 Nov 2026 21:42:23 +0800 Subject: [PATCH 4/5] fix(sudo): preserve upstream prompts and remove duplicate translations --- Documentation/admin-guide/accounts.rst | 6 +++ .../en/LC_MESSAGES/admin-guide/accounts.po | 11 +++++ .../ja/LC_MESSAGES/admin-guide/accounts.po | 10 ++++ configs/components.toml | 2 +- configs/nls/DOMAINS | 1 - configs/nls/po/sudod/ja_JP.po | 15 ------ configs/nls/po/sudod/sudod.pot | 7 --- configs/nls/po/sudod/zh_CN.po | 15 ------ scripts/reliefos/Makefile.apk | 6 +-- system/rootfs/etc/sudo.conf | 2 +- tools/test_installer_update_packages.py | 48 +++++++++++++++++++ userland/apps/sudod/main.c | 11 +---- userland/runtime/src/sudo_client.c | 5 +- 13 files changed, 85 insertions(+), 54 deletions(-) delete mode 100644 configs/nls/po/sudod/ja_JP.po delete mode 100644 configs/nls/po/sudod/sudod.pot delete mode 100644 configs/nls/po/sudod/zh_CN.po diff --git a/Documentation/admin-guide/accounts.rst b/Documentation/admin-guide/accounts.rst index ffc57715..3f4538b3 100644 --- a/Documentation/admin-guide/accounts.rst +++ b/Documentation/admin-guide/accounts.rst @@ -38,3 +38,9 @@ wheel/video 补充组)、 ``root/root``,以及锁定的 nobody。 已有文件的属组仍按普通 Linux DAC 语义处理。sudo 的图形提示由普通用户运行的 FLTK 辅助程序提供,密码仅经标准输出管道交给 sudo;控制台 PAM 兼容会话使用 上游 libpam_misc 的终端会话实现。 + +sudo 保留 PAM 认证及其账户、会话检查,支持现有 yescrypt 密码。 +密码提示及其翻译由上游 sudo/PAM 提供,ReliefOS 的图形辅助程序原样显示提示, +不替换为自定义的“密码:”。默认 askpass 路径为 +``/usr/lib/reliefos/apps/reliefaskpass/reliefaskpass.elf``;旧配置中指向 +``sudod`` 的路径仍可原样转发提示,升级不会覆盖管理员修改过的配置。 diff --git a/Documentation/locale/en/LC_MESSAGES/admin-guide/accounts.po b/Documentation/locale/en/LC_MESSAGES/admin-guide/accounts.po index 10816d4f..dceec5e5 100644 --- a/Documentation/locale/en/LC_MESSAGES/admin-guide/accounts.po +++ b/Documentation/locale/en/LC_MESSAGES/admin-guide/accounts.po @@ -104,3 +104,14 @@ msgstr "" "running as a regular user, which passes the password to sudo only through a " "standard-output pipe. Console PAM-compatible sessions use the upstream " "libpam_misc terminal conversation implementation." + +msgid "" +"sudo 保留 PAM 认证及其账户、会话检查,支持现有 yescrypt 密码。 密码提示及其翻译由上游 sudo/PAM 提供,ReliefOS 的图形辅助程序原样显示提示, " +"不替换为自定义的“密码:”。默认 askpass 路径为 ``/usr/lib/reliefos/apps/reliefaskpass/reliefaskpass.elf``;旧配置中指向 " +"``sudod`` 的路径仍可原样转发提示,升级不会覆盖管理员修改过的配置。" +msgstr "" +"sudo retains PAM authentication and its account and session checks, including support for existing yescrypt passwords. " +"Password prompts and their translations come from upstream sudo/PAM. The ReliefOS graphical helper displays each prompt unchanged, " +"without substituting a custom password label. The default askpass path is " +"``/usr/lib/reliefos/apps/reliefaskpass/reliefaskpass.elf``. Paths pointing to ``sudod`` in older configurations still forward the prompt unchanged; " +"upgrades preserve administrator-modified configuration." diff --git a/Documentation/locale/ja/LC_MESSAGES/admin-guide/accounts.po b/Documentation/locale/ja/LC_MESSAGES/admin-guide/accounts.po index 30d13f6f..d3f51e68 100644 --- a/Documentation/locale/ja/LC_MESSAGES/admin-guide/accounts.po +++ b/Documentation/locale/ja/LC_MESSAGES/admin-guide/accounts.po @@ -87,3 +87,13 @@ msgstr "" " Linux DAC の意味に従って扱われます。sudo のグラフィカルなプロンプトは一般ユーザーとして動作する FLTK " "ヘルパーが提供し、パスワードは標準出力のパイプだけを通じて sudo に渡されます。コンソールの PAM 互換セッションは、上流の " "libpam_misc による端末対話実装を使用します。" + +msgid "" +"sudo 保留 PAM 认证及其账户、会话检查,支持现有 yescrypt 密码。 密码提示及其翻译由上游 sudo/PAM 提供,ReliefOS 的图形辅助程序原样显示提示, " +"不替换为自定义的“密码:”。默认 askpass 路径为 ``/usr/lib/reliefos/apps/reliefaskpass/reliefaskpass.elf``;旧配置中指向 " +"``sudod`` 的路径仍可原样转发提示,升级不会覆盖管理员修改过的配置。" +msgstr "" +"sudo は PAM 認証とアカウント・セッション検査を維持し、既存の yescrypt パスワードをサポートします。" +"パスワードプロンプトとその翻訳は上流の sudo/PAM が提供し、ReliefOS のグラフィカルヘルパーは独自の文言に置き換えず、そのまま表示します。" +"既定の askpass パスは ``/usr/lib/reliefos/apps/reliefaskpass/reliefaskpass.elf`` です。" +"旧設定で ``sudod`` を指しているパスもプロンプトをそのまま転送でき、更新時には管理者が変更した設定を保持します。" diff --git a/configs/components.toml b/configs/components.toml index 0f0965d4..f1f2cd72 100644 --- a/configs/components.toml +++ b/configs/components.toml @@ -175,7 +175,7 @@ sdk = false api = false [[components]] -# Fixed worker and askpass UI launched through upstream sudo. +# Fixed file-operation worker launched through upstream sudo. id = "sudod" symbol = "APP_SUDOD" label = "Privileged file-operation worker" diff --git a/configs/nls/DOMAINS b/configs/nls/DOMAINS index c484754f..2e8d07de 100644 --- a/configs/nls/DOMAINS +++ b/configs/nls/DOMAINS @@ -51,7 +51,6 @@ settings shell snake soundctl -sudod sysconfdialog taskmgr terminal diff --git a/configs/nls/po/sudod/ja_JP.po b/configs/nls/po/sudod/ja_JP.po deleted file mode 100644 index ccb5bfe0..00000000 --- a/configs/nls/po/sudod/ja_JP.po +++ /dev/null @@ -1,15 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: ReliefOS\n" -"PO-Revision-Date: 2026-11-13 00:00+0000\n" -"Last-Translator: ReliefOS NLS\n" -"Language-Team: Japanese\n" -"Language: ja_JP\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: userland/apps/sudod/main.c:285 -msgid "Password:" -msgstr "パスワード:" diff --git a/configs/nls/po/sudod/sudod.pot b/configs/nls/po/sudod/sudod.pot deleted file mode 100644 index 7768c1ef..00000000 --- a/configs/nls/po/sudod/sudod.pot +++ /dev/null @@ -1,7 +0,0 @@ -msgid "" -msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" - -#: userland/apps/sudod/main.c:285 -msgid "Password:" -msgstr "" diff --git a/configs/nls/po/sudod/zh_CN.po b/configs/nls/po/sudod/zh_CN.po deleted file mode 100644 index 04241d51..00000000 --- a/configs/nls/po/sudod/zh_CN.po +++ /dev/null @@ -1,15 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: ReliefOS 1\n" -"PO-Revision-Date: 2026-09-21 00:00+0800\n" -"Last-Translator: ReliefOS NLS\n" -"Language-Team: none\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: zh_CN\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: userland/apps/sudod/main.c:285 -msgid "Password:" -msgstr "密码:" diff --git a/scripts/reliefos/Makefile.apk b/scripts/reliefos/Makefile.apk index 3fadcf3e..2ef369dc 100644 --- a/scripts/reliefos/Makefile.apk +++ b/scripts/reliefos/Makefile.apk @@ -8,10 +8,10 @@ APK_REPOSITORY := $(APK_WORK)/repository APK_MANIFEST := $(APK_WORK)/manifest.json APK_OWNERSHIP := $(APK_WORK)/ownership.tsv APK_SIGNING_KEY ?= $(HOME)/.local/share/leonos/apk-signing/key.pem -# Generation 7 transfers libmd and its development inputs to official APKs. -# This sorts after generation 6 even for development builds at the same commit. +# Generation 8 retires the duplicate sudod catalogs and updates askpass policy. +# This sorts after generation 7 even for development builds at the same commit. # Published releases must still use an increasing SOURCE_DATE_EPOCH. -APK_BUILD_VERSION ?= 7.$(SOURCE_DATE_EPOCH)-r0 +APK_BUILD_VERSION ?= 8.$(SOURCE_DATE_EPOCH)-r0 APK_STAGE_SCRIPT := $(RELIEFOS_SRC)/tools/build/apk-stage.sh APK_STAGE_INPUTS := $(RELIEFOS_SRC)/tools/build/apk-layout.sh $(RELIEFOS_LAYOUT_TOOL) $(RELIEFOS_LOCK) $(RELIEFOS_DEPS_TOOL) BUILD_LOG_INPUTS := $(RELIEFOS_SHELL_LOG) $(RELIEFOS_SRC)/tools/build/run-logged.sh $(RELIEFOS_SRC)/tools/build/format-log.awk diff --git a/system/rootfs/etc/sudo.conf b/system/rootfs/etc/sudo.conf index 9ac00cd5..c1de4545 100644 --- a/system/rootfs/etc/sudo.conf +++ b/system/rootfs/etc/sudo.conf @@ -1,4 +1,4 @@ Plugin sudoers_policy sudoers.so Plugin sudoers_io sudoers.so Plugin sudoers_audit sudoers.so -Path askpass /usr/lib/reliefos/apps/sudod/sudod.elf +Path askpass /usr/lib/reliefos/apps/reliefaskpass/reliefaskpass.elf diff --git a/tools/test_installer_update_packages.py b/tools/test_installer_update_packages.py index f8bf8835..e9016c59 100644 --- a/tools/test_installer_update_packages.py +++ b/tools/test_installer_update_packages.py @@ -189,6 +189,54 @@ def test_apply_and_retry_preserve_user_files_world_and_repository_access(self): self.assertEqual((target / "usr/share/reliefos-fixture/version").read_text(), "2.0-r0\n") self.assertFalse((target / "run/reliefos-kernel-activation.defer").exists()) + def test_sudo_prompt_cleanup_removes_duplicate_catalogs_and_preserves_pam(self): + old, new = self.runner / "oldrepo", self.runner / "newrepo" + target = self.runner / "target" + old_config = "Path askpass /usr/lib/reliefos/apps/sudod/sudod.elf\n" + new_config = (ROOT / "system/rootfs/etc/sudo.conf").read_text() + remaining_catalogs = { + f"usr/share/locale/{language}/LC_MESSAGES/reliefaskpass.mo": "dialog labels\n" + for language in ("zh_CN", "ja_JP")} + retired_catalogs = { + f"usr/share/locale/{language}/LC_MESSAGES/sudod.mo": "duplicate prompt\n" + for language in ("zh_CN", "ja_JP")} + authentication = { + "usr/bin/sudo": "PAM sudo\n", + "etc/pam.d/sudo": (ROOT / "system/rootfs/etc/pam.d/sudo").read_text(), + "etc/pam.d/sudo-i": (ROOT / "system/rootfs/etc/pam.d/sudo-i").read_text(), + **{f"usr/share/locale/{language}/LC_MESSAGES/{domain}.mo": "upstream translation\n" + for language in ("zh_CN", "ja_JP") for domain in ("sudo", "sudoers")}} + self.package("reliefos-nls", "7.0-r0", old, + payload={**remaining_catalogs, **retired_catalogs}) + self.package("reliefos-nls", "8.0-r0", new, payload=remaining_catalogs) + self.package("reliefos-authentication", "7.0-r0", old, + payload={**authentication, "etc/sudo.conf": old_config}, + modes={"usr/bin/sudo": 0o4755}) + self.package("reliefos-authentication", "8.0-r0", new, + payload={**authentication, "etc/sudo.conf": new_config}, + modes={"usr/bin/sudo": 0o4755}) + self.index(old) + self.index(new) + repositories = self.runner / "old.repositories" + repositories.write_text("ndx " + str(old / "packages.adb") + "\n") + self.apk("--root", target, "--repositories-file", repositories, + "--no-network", "--no-scripts", "add", "reliefos-nls", + "reliefos-authentication") + administrator_config = old_config + "# administrator configuration\n" + (target / "etc/sudo.conf").write_text(administrator_config) + checked = self.check() + self.assertEqual(checked.returncode, 0, checked.stdout + checked.stderr) + for _ in range(2): + result = self.transaction("--apply") + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + for path in retired_catalogs: + self.assertFalse((target / path).exists(), path) + for path, text in {**remaining_catalogs, **authentication}.items(): + self.assertEqual((target / path).read_text(), text, path) + self.assertEqual((target / "etc/sudo.conf").read_text(), administrator_config) + self.assertEqual((target / "etc/sudo.conf.apk-new").read_text(), new_config) + self.assertEqual((target / "usr/bin/sudo").stat().st_mode & 0o7777, 0o4755) + def test_filesystem_and_bsd_split_transfers_owners_and_preserves_configuration(self): old, new = self.runner / "oldrepo", self.runner / "newrepo" target = self.runner / "target" diff --git a/userland/apps/sudod/main.c b/userland/apps/sudod/main.c index 3fbb5dbd..f1bc2fb7 100644 --- a/userland/apps/sudod/main.c +++ b/userland/apps/sudod/main.c @@ -7,10 +7,6 @@ #include #include #include -#include -#define T(s) gettext(s) -#include -#include #include #include #include @@ -281,8 +277,8 @@ static int sudod_finish(int32_t status) static int askpass(const char *prompt) { - if (!prompt || !strcmp(prompt, "Password:") || !strcmp(prompt, "Password: ")) - prompt = T("Password:"); + /* Preserve administrator sudo.conf entries using the former helper path. + * The prompt belongs to sudo/PAM and must be passed through unchanged. */ execl("/usr/lib/reliefos/apps/reliefaskpass/reliefaskpass.elf", "reliefaskpass", prompt, (char *)0); perror("Start authentication prompt"); @@ -291,9 +287,6 @@ static int askpass(const char *prompt) int main(int argc, char **argv) { - setlocale(LC_ALL, ""); - bindtextdomain("sudod", RELIEFOS_LAYOUT_LOCALE); - textdomain("sudod"); struct sudod_request request; struct sudod_path dir; const char *confirm; diff --git a/userland/runtime/src/sudo_client.c b/userland/runtime/src/sudo_client.c index b996e611..1d219ea5 100644 --- a/userland/runtime/src/sudo_client.c +++ b/userland/runtime/src/sudo_client.c @@ -13,7 +13,8 @@ #include #include -#define ASKPASS "/usr/lib/reliefos/apps/sudod/sudod.elf" +#define ASKPASS "/usr/lib/reliefos/apps/reliefaskpass/reliefaskpass.elf" +#define FILEOP_WORKER "/usr/lib/reliefos/apps/sudod/sudod.elf" #define RESULT_MAGIC 0x524f4453u struct fileop_result { uint32_t magic; @@ -252,7 +253,7 @@ int reliefos_fileop(uint32_t op, const char *path1, const char *path2, if ((username && *username) || (password && *password)) { errno = ENOTSUP; return -1; } char verb[16]; snprintf(verb, sizeof(verb), "%u", op); - char *args[] = {"/usr/bin/sudo", "-A", "-u", "root", "--", ASKPASS, + char *args[] = {"/usr/bin/sudo", "-A", "-u", "root", "--", FILEOP_WORKER, "--op", verb, "--path1", (char *)path1, "--path2", (char *)(path2 ? path2 : ""), NULL}; struct fileop_result *reply = calloc(1, sizeof(*reply)); if (!reply) return -1; From e70a598968656ebffce0b639dbd64eb063b6a5d7 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sun, 15 Nov 2026 21:57:34 +0800 Subject: [PATCH 5/5] fix(installer): preserve install errors and update ReliefNT --- kernel/reliefnt | 2 +- tools/tests/installer_tty_input_test.c | 17 +++++++++-- userland/apps/installer/install_ops.c | 31 ++++++++++++--------- userland/apps/installer/install_ops.h | 6 ++-- userland/apps/installer/installer_tty.h | 2 +- userland/apps/installer/installer_tui_job.c | 3 +- 6 files changed, 40 insertions(+), 21 deletions(-) diff --git a/kernel/reliefnt b/kernel/reliefnt index 26d96219..317e9649 160000 --- a/kernel/reliefnt +++ b/kernel/reliefnt @@ -1 +1 @@ -Subproject commit 26d96219b429e38fd18bf8e55b703374129589e0 +Subproject commit 317e964960fe22661ab456842900b7847d839b3c diff --git a/tools/tests/installer_tty_input_test.c b/tools/tests/installer_tty_input_test.c index dd02c833..675ddf8d 100644 --- a/tools/tests/installer_tty_input_test.c +++ b/tools/tests/installer_tty_input_test.c @@ -47,7 +47,7 @@ int installer_setup_valid(const struct installer_setup *value) *value->root_password && !strcmp(value->root_password, value->root_password_confirm); } -static int abnormal_worker, update_failure; +static int abnormal_worker, update_failure, install_failure; static void record_settings(void) { const char *path = getenv("INSTALLER_TEST_RESULT"); @@ -59,15 +59,22 @@ static void record_settings(void) (unsigned long long)setup.swap_size_mib); fclose(file); } -static void fixture_install(void) +static int fixture_install(void) { if (abnormal_worker) _exit(7); + if (install_failure) { + install_success = 0; + strcpy(status_text, "Installation failed"); + strcpy(detail_text, "Copy failed ret=-30"); + return -EROFS; + } progress_value = 50; strcpy(status_text, "Copying fixture files"); refresh_ui(); record_settings(); install_success = 1; page = INSTALLER_PAGE_FINISH; + return 0; } static void fixture_disks(void) { @@ -269,6 +276,12 @@ static void screen_tests(void) update_failure = 0; job.kind = TUI_JOB_INSTALL; assert(tui_run_job(&fixture_context, &job) == 0 && install_success); + install_failure = 1; + assert(tui_run_job(&fixture_context, &job) == -EROFS && !install_success); + assert(!strcmp(status_text, "Installation failed")); + assert(strstr(detail_text, strerror(EROFS))); + assert(strstr(detail_text, "Copy failed ret=-30")); + install_failure = 0; abnormal_worker = 1; assert(tui_run_job(&fixture_context, &job) == -EIO); assert(!strcmp(status_text, "Operation failed")); diff --git a/userland/apps/installer/install_ops.c b/userland/apps/installer/install_ops.c index 3df48d10..5624e506 100644 --- a/userland/apps/installer/install_ops.c +++ b/userland/apps/installer/install_ops.c @@ -1419,15 +1419,19 @@ static void finish_install(int ret, refresh_ui(); } -void perform_install(void) +/** @brief Run the confirmed installation and update progress/completion state. + * @return Zero on success, or the original negative errno on failure. + */ +int perform_install(void) { int ret; if (!installer_setup_valid(&setup)) { finish_install(-EINVAL, T("Invalid installation settings")); - return; + return -EINVAL; } if (selected_disk < 0 || (uint32_t)selected_disk >= disk_count) { - return; + finish_install(-ENODEV, T("Invalid installation settings")); + return -ENODEV; } install_running = 1; install_success = 0; @@ -1442,34 +1446,34 @@ void perform_install(void) ret = check_install_payload_required(); if (ret < 0) { finish_install(ret, T("Payload check failed")); - return; + return ret; } if (setup.swap_enabled) { if (!installer_swap_size_valid(setup.swap_size_mib)) { - finish_install(-EINVAL,T("Invalid swap size"));return; + finish_install(-EINVAL,T("Invalid swap size"));return -EINVAL; } ret=installer_swap_bundle_supported(fresh_root_payload()); - if (ret) {finish_install(ret,T("Selected system does not support swap"));return;} + if (ret) {finish_install(ret,T("Selected system does not support swap"));return ret;} ret=installer_swap_storage_supported(disks[selected_disk].path); - if (ret) {finish_install(ret,T("Swap requires an AHCI disk"));return;} + if (ret) {finish_install(ret,T("Swap requires an AHCI disk"));return ret;} } struct reliefos_boot_install_options boot = installer_boot_options(); ret = reliefos_boot_validate_payload(&boot); if (!ret) ret = reliefos_boot_validate_disk(&boot, !installer_partition_auto); - if (ret < 0) { finish_install(ret, T("Boot installation checks failed")); return; } + if (ret < 0) { finish_install(ret, T("Boot installation checks failed")); return ret; } show_progress(2, T("Preparing target disk"), ""); show_progress(22, T("Mounting target filesystems"), T("Root and boot partitions")); ret = installer_mount_targets(disks[selected_disk].path); if (ret < 0) { finish_install(ret, T("Mount failed")); - return; + return ret; } ret = reliefos_boot_validate_target(&boot); - if (ret < 0) { finish_install(ret, T("Boot installation checks failed")); return; } + if (ret < 0) { finish_install(ret, T("Boot installation checks failed")); return ret; } show_progress(30, T("Scanning installation payload"), T("Root and boot partitions")); ret = count_files_recursive(fresh_root_payload(), ©_total); @@ -1478,7 +1482,7 @@ void perform_install(void) } if (ret < 0) { finish_install(ret, T("Payload scan failed")); - return; + return ret; } show_progress(35, T("Copying system files"), @@ -1486,7 +1490,7 @@ void perform_install(void) ret = copy_payload_ordered(); if (ret < 0) { finish_install(ret, T("Copy failed")); - return; + return ret; } explicit_bzero(setup.password, sizeof(setup.password)); @@ -1497,9 +1501,10 @@ void perform_install(void) if (!ret) ret = sync_target_root(INSTALL_ROOT_MOUNT); if (ret < 0) { finish_install(ret, T("Could not save installed preferences")); - return; + return ret; } show_progress(100, T("Installation completed successfully"), T("Target disk is ready.")); finish_install(0, ""); + return 0; } diff --git a/userland/apps/installer/install_ops.h b/userland/apps/installer/install_ops.h index f76958fd..8ddff8bf 100644 --- a/userland/apps/installer/install_ops.h +++ b/userland/apps/installer/install_ops.h @@ -118,8 +118,10 @@ int installer_partition_set_type(uint32_t type); int installer_partition_delete(void); int installer_partition_format(uint32_t filesystem, const char *label); -/* Long-running operations; they drive `page` to PROGRESS then FINISH. */ -void perform_install(void); +/** @brief Run the confirmed installation and update progress/completion state. + * @return Zero on success, or the original negative errno on failure. + */ +int perform_install(void); #ifdef __cplusplus } diff --git a/userland/apps/installer/installer_tty.h b/userland/apps/installer/installer_tty.h index 4b2e5e80..a679b0cd 100644 --- a/userland/apps/installer/installer_tty.h +++ b/userland/apps/installer/installer_tty.h @@ -45,7 +45,7 @@ struct installer_tty_context { int (*partition_set_type)(uint32_t type); int (*partition_delete)(void); int (*partition_format)(uint32_t filesystem, const char *label); - void (*perform_install)(void); + int (*perform_install)(void); int (*boot_entry_path)(char *path, uint32_t capacity); }; diff --git a/userland/apps/installer/installer_tui_job.c b/userland/apps/installer/installer_tui_job.c index 9c1e2d2b..ae2aadac 100644 --- a/userland/apps/installer/installer_tui_job.c +++ b/userland/apps/installer/installer_tui_job.c @@ -68,8 +68,7 @@ static int execute(const struct installer_tty_context *context, struct tui_job * { switch (job->kind) { case TUI_JOB_INSTALL: - context->perform_install(); - return *context->install_success ? 0 : -EIO; + return context->perform_install(); case TUI_JOB_CHECK: return installer_update_check_target(context->disks[*context->selected_disk].path, job->root_uuid, job->esp_uuid, result, update_progress, result);