Feature #155 » MISSING_5_2_IN_8_27_PLAN.md
Coreutils 8.27 gap plan vs 5.2 patch stack
This is a focused gap-check of coreutils/5.2/patches against:
coreutils/8.27/patchesgnulib/for-coreutils-8.27/patches
Goal: identify likely necessary items from 5.2 that are not clearly carried into 8.27.
1) High-confidence gaps (likely required)
A. copy.c fstat/stat workaround is missing
From 5.2 patch 0005-Don-t-call-fstat-when-compiling-for-AmigaOS4.patch:
- In
copy_reg, 5.2 usedstat(src_path, ...)on AmigaOS4 instead offstat(source_desc, ...). - Rationale in patch message:
fstat()inode/device behavior is broken for that use case.
In 8.27 patch set:
src/copy.cis touched, but only formkfifooverride handling.- No equivalent
fstatfallback is present there.
Plan action P1: port/adapt this fix into 8.27 src/copy.c (or revalidate and prove unnecessary).
B. Amiga path semantics are not globally ported (coverage likely incomplete)
5.2 base patch changed global-ish behavior (e.g. ISSLASH handling with : for Amiga paths) and touched many files.
8.27 patch:
- Adds Amiga path handling in some utilities (comments in patch history mention this),
- but does not include broad config-level equivalent of the 5.2
config.hinISSLASHadaptation.
Risk:
- path handling may work in some commands (
ls,cp, etc.) but remain inconsistent in others.
Plan action P1: run targeted path semantics audit across key tools (at least cp, mv, rm, pathchk, realpath, test, ln, install, sort/split temp path logic).
C. Newlib-specific correctness bits from 5.2 are not present in 8.27
From 5.2:
0007: forceHAVE_WORKING_READDIRfor__amigaos4__ && __NEWLIB__.- 5.2 base patch had more
__NEWLIB__-specific paths.
In 8.27:
- Most logic appears CLIB2-centric (
__CLIB2__guards are common in patch). - No explicit carry-over of
HAVE_WORKING_READDIRbehavior found.
Plan action P1: if newlib is in scope, re-check and likely port these bits.
2) Medium-confidence gaps (depends on target/runtime goals)
D. Environment/usergroup support model changed, not clearly replaced for non-clib2
5.2 had lib/amigaos.c + lib/amigaos.h with environment and user/group wrappers.
8.27 does not carry these files; README notes suggest clib2 runtime took over parts of this behavior.
This is fine if target is strictly clib2 and those runtime behaviors are reliable.
Plan action P2: decide if we need support for:
- clib2 only, or
- clib2 + newlib, or
- clib2 + clib4 + newlib.
If broader than clib2-only, reintroduce/adapt missing env/user wrappers as needed.
E. Host build portability update (config.guess/config.sub) not carried as a coreutils patch
5.2 0009 updated config/config.guess and config/config.sub for modern hosts (e.g. aarch64 Linux builders).
8.27 does not include an equivalent patch in coreutils.
However 8.27 bootstrap is gnulib-driven and points to ../../gnulib/repo; if gnulib is modern enough, this may already be satisfied.
Plan action P2: verify on target build hosts (especially aarch64 Linux) whether bootstrap/configure path resolves correctly without extra patching.
3) Items already covered by 8.27 + gnulib patches
- Mounted filesystem detection hard-fail -> warning/hack:
- covered by
gnulib/for-coreutils-8.27/patches/0001.
- covered by
- Disable/avoid
sttybuild path:- covered in 8.27
configure.ac/src/local.mkchanges.
- covered in 8.27
- Remove docs/man/test integration for build simplification:
- covered by 8.27
Makefile.amand configure-side reductions.
- covered by 8.27
- RLIMIT_DATA/clib2 flavor fix in sort:
- appears covered in 8.27 sort changes.
4) Practical execution plan
Phase 1 — quick wins / likely fixes
- Add/port the
copy.cfstatfallback logic from 5.2 (P1-A). - Add a compact path-semantics compatibility layer strategy for 8.27 (
P1-B):- either central macro approach,
- or complete utility-level coverage list + patches.
- If newlib target exists: port
HAVE_WORKING_READDIRand related newlib-specific behavior (P1-C).
Phase 2 — target matrix alignment
- Decide libc support matrix (clib2 only vs multi-libc).
- If multi-libc: recover/adapt missing runtime wrappers from 5.2 where still required.
- Validate host build portability (aarch64 etc.) and patch config helper flow only if needed.
Phase 3 — validation
- Runtime test set on AmigaOS:
- file copy/stat behaviors,
- absolute/relative path handling with
:and/, - env propagation behavior,
- selected utilities touched in old 5.2-only list (
pathchk,test,uname, etc.).
- Build-host matrix test:
- x86_64 Linux
- aarch64 Linux
5) Decisions captured so far
Based on your feedback:
- Libc direction: move away from clib2-centric behavior and target clib4.
- Host build support: aarch64 host support is not required.
stty: likely keep disabled for now (same behavior class as 5.2), unless explicitly requested otherwise.
Decisions finalized:
sttystays disabled for now.- Keep the old 5.2-derived
sort/splitreplacement approach for now.
6) clib4-first migration tasks (new)
Because the 8.27 patch stack is heavily guarded with __CLIB2__, this is the priority plan:
-
Build system switch to clib4
- Change native build flags from
-mcrt=clib2to-mcrt=clib4innative-build/makefilefor coreutils. - Ensure linked libs/options are correct for clib4 runtime expectations.
- Change native build flags from
-
Audit and refactor
__CLIB2__conditionals- In
coreutils/8.27patch content, identify each#if defined __amigaos__ && defined __CLIB2__block. - Classify each block:
- truly clib2-specific ABI/API workaround,
- generic AmigaOS behavior that should become libc-agnostic,
- code that should be removed once using clib4/newer libc behavior.
- In
-
Re-validate with clib4 libc behavior
- Re-test areas currently modified for clib2 assumptions:
- locale handling (
setlocale/collation paths in sort), - file descriptor and stdio temp-stream handling (
mkstemp,fdopen,fstatpaths), - filesystem type handling in
stat(f_fstypenamepaths), - process/signal related blocks that were simplified for Amiga/clib2.
- locale handling (
- Re-test areas currently modified for clib2 assumptions:
-
Keep/port 5.2 fixes that are libc-neutral
copy.cfstat/stat workaround (if still reproducible with clib4).- path semantics consistency checks.
-
Drop non-needed legacy substitutions where possible
- Especially
sort/splitold-code replacement if clib4 allows upstream-like behavior.
- Especially
7) Remaining questions to finalize patch selection
stty: confirm final choice — keep disabled, or attempt implementation?sort/split: keep old replacement approach for now, or prioritize reverting toward upstream 8.27 code?