Feature #155 » 8.32_CLIB4_PORT_PLAN.md
Coreutils 8.32 (clib4) port plan
Goal: add a new parallel port track for Coreutils 8.32 targeting AmigaOS4 + clib4, while keeping existing 5.2 and 8.27 tracks untouched.
0) Current baseline facts (for planning)
- Existing coreutils tracks:
5.2(COREUTILS-5_2_1)8.27(v8.27)
- Existing gnulib track tied to 8.27:
for-coreutils-8.27@405cd675...
- Upstream Coreutils
v8.32exists. - In upstream
v8.32,gnulibis a submodule at:d279bc6d9f9323e19ad8c32b6d12ff96dfb0f5ba
- Native build flow currently hardcodes old coreutils version and clib2 flags in
native-build/makefile.
1) Add new patch tracks (non-disruptive)
Create new branch entries without changing old ones:
-
coreutils/series- add:
8.32\tv8.32\thttps://ftp.gnu.org/gnu/coreutils/coreutils-8.32.tar.xz
- add:
-
gnulib/series- add:
for-coreutils-8.32\td279bc6d9f9323e19ad8c32b6d12ff96dfb0f5ba\t?
- add:
-
create empty patch dirs:
coreutils/8.32/patches/gnulib/for-coreutils-8.32/patches/
Rationale: this keeps 5.2/8.27 intact and enables independent iteration.
2) Bootstrap + gnulib strategy for 8.32
Mandatory pairing rule: coreutils 8.32 must use a matching gnulib baseline for 8.32 (do not reuse the 8.27 gnulib track).
- Baseline to use: gnulib commit
d279bc6d9f9323e19ad8c32b6d12ff96dfb0f5ba(the submodule commit referenced by upstream coreutilsv8.32). - Then apply AmigaOS-specific gnulib patches in the new
for-coreutils-8.32track.
Use same architecture used in 8.27 track (external gnulib repo), but cleanly for 8.32:
-
Apply a coreutils patch equivalent to 8.27 submodule-removal:
- remove
.gitmodulessubmodule entry and gitlink (gnulib).
- remove
-
Ensure
bootstrapuses local gnulib repo path, not network submodule fetch:use_git=falseGNULIB_SRCDIR=../../gnulib/repo
-
In gnulib 8.32 track, port only minimal AmigaOS-related m4 changes needed for configure/bootstrap to succeed:
- mounted-fs detection behavior (warn/usable path)
- warning policy only if still necessary.
3) Build-system enabling for parallel version selection
Do not replace old defaults yet. Add configurable knobs.
In native-build/makefile:
-
Add branch/version selector variables for coreutils:
- e.g.
COREUTILS_BRANCH ?= 5.2 - and set
COREUTILS_VERSIONfrom branch mapping (5.2.1,8.27,8.32).
- e.g.
-
Add libc runtime selector for coreutils build:
- e.g.
COREUTILS_CRT ?= clib2 - for new track use
COREUTILS_CRT=clib4 - propagate to
CPPFLAGS/LDFLAGSas-mcrt=$(COREUTILS_CRT).
- e.g.
-
Keep backward-compatible defaults:
- existing builds unchanged unless branch/CRT is explicitly set.
-
Add a new documented invocation path for 8.32+clib4.
4) Patching strategy for 8.32 (clib4-first)
Use a phased approach to avoid importing all 5.2/8.27 debt.
Phase A — minimal compile/bootstrap viability
-
Coreutils 8.32 base patch:
- AmigaOS target compile fixes only.
- disable or exclude fragile/non-essential pieces initially (including
stty, per your decision).
-
Gnulib 8.32 base patch:
- only mandatory m4/autoconf behavior fixes needed to configure/build.
-
Confirm
./bootstrapsucceeds with local gnulib track.
Phase B — functional parity essentials
Port only proven-necessary deltas from prior tracks:
-
copy.cfstatfallback check:- test whether old Amiga inode issue still reproduces under clib4;
- patch only if needed.
-
path semantics audit:
- ensure Amiga absolute path rules (
:and/) are handled consistently in key utilities.
- ensure Amiga absolute path rules (
-
newlib-specific 5.2 tweaks are not default scope now (target is clib4).
Phase C — runtime cleanup
- Eliminate clib2-specific assumptions (avoid
__CLIB2__-locked logic). - Keep patches narrow and upstream-structured.
- Avoid old-code replacement unless a hard blocker appears.
5) Testing matrix (required before declaring usable)
Build tests
gild checkout gnulib for-coreutils-8.32gild checkout coreutils 8.32cd coreutils/repo && ./bootstrap- native build with
-mcrt=clib4
Runtime smoke tests (AmigaOS4)
Core file ops:
cp,mv,rm,install,ln,readlink,realpath,stat,ls
Text/data ops:
sort,split,cut,tee,dd,od
Environment/shell behavior:
env,printenv,path handling, temp file behavior
Negative tests:
- permissions edge cases
- missing files / diagnostics
stty:
- verify it is disabled intentionally and does not break packaging.
5.1) End-state requirement: per-tool test scripts (AmigaOS4)
At the end of this porting effort, we must have an automated test script set that validates each shipped coreutils tool on AmigaOS4.
Required outcome:
- A test harness script (or small runner) that executes all per-tool tests and returns a non-zero code on any failure.
- One test script per tool (or clearly grouped scripts with explicit per-tool sections) covering at least:
- command starts and exits correctly,
- basic expected behavior with normal inputs,
- at least one error-path/diagnostic check.
- A generated summary report showing pass/fail per tool.
- Documentation for how to run the full suite on AmigaOS4.
Minimum acceptance criterion:
- No 8.32 clib4 release candidate is considered ready unless the per-tool AmigaOS4 test suite passes.
5.2) Coreutils 8.32 tool list to cover with tests
Test coverage target is based on the upstream v8.32 utility set (from man pages). The per-tool scripts must cover the shipped tools below:
arch, b2sum, base32, base64, basename, basenc, cat, chcon, chgrp, chmod, chown, chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, head, hostid, hostname, id, install, join, kill, link, ln, logname, ls, md5sum, mkdir, mkfifo, mknod, mktemp, mv, nice, nl, nohup, nproc, numfmt, od, paste, pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, realpath, rm, rmdir, runcon, seq, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, shred, shuf, sleep, sort, split, stat, stdbuf, stty, sum, sync, tac, tail, tee, test, timeout, touch, tr, true, truncate, tsort, tty, uname, unexpand, uniq, unlink, uptime, users, vdir, wc, who, whoami, yes
Notes:
sttyis expected to be disabled in this port, but still needs a test that confirms expected disabled behavior.[(left bracket) should be validated as part oftestcoverage if it is shipped as an alias/hardlink in the final package.
6) Suggested patch/commit structure
Keep reviewable, layered patches:
coreutils8.32: track scaffolding + series entriesgnulib8.32: track scaffolding + series entrycoreutils8.32: remove gnulib submodule referencescoreutils8.32: bootstrap local gnulib wiringgnulib8.32: minimal m4 AmigaOS fixescoreutils8.32: minimal AmigaOS/clib4 compile fixesbuild: parameterize coreutils branch + CRTcoreutils8.32: targeted runtime fixes from validation
7) Risks to manage
- Dragging 8.27 technical debt into 8.32 (especially large source replacements).
- Hidden clib2 assumptions in previous patches.
- Bootstrap mismatch between chosen coreutils tag and gnulib commit if not pinned correctly.
Mitigation:
- start minimal, test-driven,
- patch only validated failures,
- keep gnulib pin aligned with upstream 8.32 submodule SHA first.
8) Open confirmations before implementation
Please confirm these before I draft concrete first patches:
- For 8.32 track, do you want me to keep
sort/splitupstream 8.32 code unless proven broken (recommended)? - Should docs/man/tests remain excluded initially (like 8.27), or try full default first?
- Do you want
native-build/makefiledefault to remain5.2 + clib2, with 8.32+clib4 enabled only via explicit vars (recommended)?