Skip to content

WIP: W1 oracle audit — coreutils file faces (Refs #1462) - #1473

Merged
caomengxuan666 merged 29 commits into
mainfrom
fix/audit-w1-coreutils-files
Oct 31, 2026
Merged

caomengxuan666 merged 29 commits into
mainfrom
fix/audit-w1-coreutils-files

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Per-command audit of coreutils file faces against the coreutils-9.4 oracle source (tracker #1462). Work in progress: fixes land per command family as the audit completes; the full per-command table ships in the cluster REPORT.

Batch 1 (this push): stat %R + %H/%L modifiers, ls --sort=width, chmod missing-operand-after diagnostic. Differential cases added for each.

No earlier external PRs touch these applets (only open PR is #1426, FFI prototype). link is out of scope by repo policy (AGENTS.md ban). CI is the build gate (MSVC-only project).

Refs #1462

- stat: implement %R (device type in hex, coreutils-9.4 stat.c:1816);
  the help text advertised it but the renderer fell through to '?'.
  Implement the %H/%L major/minor modifiers for %d and %r
  (stat.c:1800-1801, 1817-1818, print_it dispatch): %Hd/%Ld decompose
  the same synthesized st_dev value reported by %d, %Hr/%Lr are 0
  like %r itself. Help text gains the four modifier lines.
- ls: accept --sort=width (ls.c:911-919 sort_args), ordered by the
  display width of the quoted name with name tie-break (ls.c
  cmp_width). Previously rejected as an invalid argument.
- chmod: with a mode but no file operand, print the GNU long-form
  diagnostic "missing operand after '<mode>'" (chmod.c:528-534)
  instead of the plain "missing operand".

Differential cases: corpus/stat/40-rdev-hex, corpus/stat/41-rdev-parts,
corpus/ls/05-sort-width, corpus/chmod/02-missing-operand-after.
Refs #1462

Previously --preserve was a boolean switch: any value enabled full
metadata preservation and an invalid attribute was silently accepted.
coreutils-9.4 cp.c:872-935 (decode_preserve_arg) defines a comma list
of mode/timestamps/ownership/links/context/xattr/all with argmatch
validation; a bare --preserve means 'all', -p contributes
mode+ownership+timestamps, -a contributes all, and --no-preserve
clears the listed attributes.

- Add PreserveAttrs + parse_preserve_attrs with GNU-shaped
  invalid-argument diagnostics, validated once in run_cp_pipeline
  before any copying starts (same pattern as --update).
- preserve_metadata now applies timestamps only when 'timestamps'
  is in the set and file attributes only when 'mode' is.
- --attributes-only keeps its historical default set (mode +
  timestamps) when no preserve-family option is given.

Differential cases: corpus/cp/01-preserve-invalid,
corpus/cp/02-no-preserve-invalid, corpus/cp/03-preserve-mode.
Refs #1462

ln (oracle ln.c):
- -r without -s is now an error (ln.c:571-572) instead of silently
  making a hard link; -d/-F no longer abort the run up front (with
  -s, or with no operands, GNU proceeds) — a directory hard-link
  source without -d gets 'hard link not allowed for directory'
  (ln.c:202-208).
- -L/-P and -f/-i resolve last-one-wins from the occurrence stream
  (ln.c:506-522); the invented --logical/--physical mutual-exclusion
  error is gone.
- Existing-destination handling: a directory destination is refused
  before force/backup/prompt (ln.c:228-232); -f/backup removal can
  no longer delete the source itself ('<src>' and '<dest>' are the
  same file, ln.c:260-300) nor a destination created earlier in the
  same run (ln.c:234-242); backup failures carry their reason.
- -S alone enables backups (ln.c:550-553); backup CONTROL matching
  is case-sensitive argmatch; repeated -t is 'multiple target
  directories specified' (ln.c:529-531); -t is validated before the
  missing-operand check; -n applies to the multi-operand form;
  trailing slashes are stripped before taking a basename
  (ln.c:666-673); with a backup the combined verbose line is the
  only one printed.

unlink (oracle unlink.c:82-83): a read-only file now unlinks — the
attribute is cleared first, since unlink(2) ignores the file's own
write bit and DeleteFileW does not.

rm (oracle rm.c/remove.c):
- Default mode is RMI_SOMETIMES: write-protected files/directories
  prompt on a terminal stdin instead of being silently cleared and
  deleted (rm.c:189-199, remove.c:213-221); -i uses the
  write-protected prompt forms (remove.c:278-279, 316-317).
- --preserve-root value is validated ('unrecognized
  --preserve-root argument', rm.c:299-310) and toggles with
  --no-preserve-root in argv order.
- Root failsafe only applies to recursive runs and uses the
  ROOT_DEV_INO_WARN wording; '//' spellings are recognised as root;
  '.'/'..' refusal is unconditional.
- -f ignores only nonexistent-class probe errors (remove.c:330-360).
- --one-file-system skips are reported on stderr and fail the run
  (remove.c:557-567).
- Removal failures read 'cannot remove <path>: <strerror>' without
  the file/directory nouns; unreadable directories read 'cannot
  read directory'; missing-operand wording is 'missing operand';
  -I prompt uses singular/plural 'argument(s)' without '(y/n)';
  --interactive accepts argmatch prefixes with the GNU error list.

Differential cases: corpus/ln/36-39, corpus/unlink/01,
corpus/rm/02-03.
Refs #1462

- --backup=CONTROL is honoured (mv.c:519-522): argmatch over
  none/simple/existing/numbered with the GNU invalid/ambiguous
  diagnostics, VERSION_CONTROL fallback for a bare -b/--backup,
  numbered backups take max existing N + 1, and -S alone enables
  backups (mv.c:404-407). Previously every control behaved as
  'simple' and --backup=bogus was silently accepted.
- --backup with --no-clobber is a fatal error before anything is
  moved (mv.c:512-516).
- --update accepts argmatch prefixes; the older-skip no longer
  applies to directories (copy.c:2353).
- Operand diagnostics: one operand reports 'missing destination
  file operand after' (mv.c:430-438); -T with >2 operands reports
  'extra operand' (mv.c:450-453); repeated -t reports 'multiple
  target directories specified' (mv.c:367-370); the -t/-T message
  names the short forms (mv.c:445-449); a bad target reports
  'target directory <dir>: <reason>' / 'target <dir>: <reason>'
  (mv.c:458-462, 492-496) instead of a bare 'target is not a
  directory'.
- Same-file guard on the rename path (copy.c:2344-2350) with the
  single-link / same-entry refinement.
- Verbose line names the backup made (copy.c:2085-2088); the
  cross-volume copy fallback preserves nested symlinks via
  copy_symlinks (mv.c:135 preserve_links).

Differential cases: corpus/mv/01-05.
Refs #1462

mkdir (oracle mkdir.c, lib/mkdir-p.c):
- Invalid-mode diagnostic names the mode (mkdir.c:290), and the
  missing-operand check now precedes mode compilation
  (mkdir.c:259 vs 290).
- A --context value earns the non-SELinux warning and the
  directory is still created; a bare -Z stays silent
  (mkdir.c:243-248).
- Non -p creation failures report the actual error text instead of
  defaulting to 'No such file or directory' (mkdir-p.c:200).
- Mode-application failures read 'cannot change permissions of'
  (mkdir-p.c:190).

rmdir (oracle rmdir.c):
- ignorable_failure is complete (rmdir.c:98-105): EACCES/EPERM/
  EROFS/EBUSY are ignored when the directory is verified non-empty,
  not only ENOTEMPTY.
- An ignorable failure now stops the -p ascent instead of being
  collapsed into success (rmdir.c:139-166, 249-250).
- Parent failures read 'failed to remove directory' (rmdir.c:150),
  and remove_parents attempts the root itself (rmdir.c:112-166).

Differential cases: corpus/mkdir/03-04, corpus/rmdir/02-03.
Refs #1462

- The four GNU option conflicts are validated (install.c:917-922,
  1001-1013): -d with -s, -d with -t, -C with -p, -C with -s.
  Repeated -t reports 'multiple target directories specified'.
- Backup grammar follows xget_version: -S alone enables backups,
  CONTROL matches by case-sensitive argmatch prefix with the GNU
  diagnostics, a bare -b/--backup falls back to VERSION_CONTROL,
  and numbered backups take max existing N + 1 with 'existing'
  triggered by any numbered backup present (lib/backupfile.c).
- -m accepts octal modes of any length (install.c:991-993).
- -d processes every operand and aggregates the exit status;
  directory-creation failures carry their reason (install.c:699).
- Copy order is now copy, strip, timestamps, mode (install.c:
  654-676) — with -s -m 444 the destination is no longer read-only
  when strip runs; -p sets only atime/mtime and its failure reads
  'cannot set timestamps for' (install.c:466-481).
- -o/-g names are validated fatally before copying (install.c:
  539, 558); --strip-program without -s warns (install.c:998-1000);
  -C with non-permission mode bits warns and is ignored
  (install.c:1015-1017); the verbose backup note rides the copy
  line, and the invented -C skip and set-mode lines are gone.

Differential cases: corpus/install/03-06.
Refs #1462

sync (oracle sync.c):
- -d/-f conflict reads 'cannot specify both --data and
  --file-system' (sync.c:209-211); flush failures read 'error
  syncing' with the reason (sync.c:154); open failures always
  carry the reason (sync.c:112); directory operands are opened
  and flushed instead of silently skipped.

mkfifo (oracle mkfifo.c):
- -Z pairs with --context[=CTX] as in GNU (system.h:344-345);
  a context value warns and the fifo is created, a bare -Z is
  silent (mkfifo.c:118-122) — it used to hard-fail.
- -m is evaluated as a real mode (multi-op and copy clauses
  included) against the 0666 base; readonly derives from the
  value, so 0400/0000/a=r now map correctly, and bits outside
  0777 fail with 'mode must specify only file permission bits'
  (mkfifo.c:151-165). Missing operand precedes mode compilation.

mknod (oracle mknod.c):
- Same mode evaluation; -m now applies to type p (mknod.c:264).
- MAJOR/MINOR parse base-0 with the 'invalid major device
  number' wording (mknod.c:236-245); a fifth operand is an
  'extra operand' error (mknod.c:183-191); the 'Special files
  require...' note is capitalized and printed only for the
  two-operand case (mknod.c:177-179); the exists diagnostic
  quotes the name; --context warns and creates (mknod.c:131-140).

Differential cases: corpus/sync/01, corpus/mkfifo/01-03,
corpus/mknod/01-02.
Refs #1462

du (oracle du.c):
- DU-1: traversal and operands honor the default/-P symlink
  policy — cfg.no_dereference was parsed but never read, so
  everything behaved like -L. A symlink now contributes itself
  (own size, own inode for dedup, own times); directory links
  are not entered. -L still follows; -H/-D follow operands only.
- DU-2: -x compares VOLUME serials, not drive-letter spellings.
- DU-3: -S no longer corrupts the -c grand total (full_size is
  accumulated alongside every printed-line size, du.c:654).
- DU-4: the -c total line is unconditional (du.c:1135);
  --threshold filters per-entry lines only.
- DU-5: '-a -s' reads 'cannot both summarize and show all
  entries' (du.c:937-938); -s with --max-depth=0 warns, other
  depths warn and fail (du.c:940-947).
- DU-6: '--threshold=-0' rejected by name (du.c:841-849).
- DU-7: --files0-from: extra operand named with the combination
  rule (du.c:1037-1043); unopenable list is 'cannot open .. for
  reading: <reason>'; empty names and a stdin '-' are diagnosed
  with list name and record number and fail the run (du.c:
  1018-1115).
- DU-8a: --time words restricted to the GNU set with argmatch
  prefixes (atime/access/use, ctime/status, mtime); the invented
  'modification'/'modified' words are gone.
- DU-8b: --time-style validated against the GNU set with
  TIME_STYLE env default and posix- prefixes (du.c:960-1005).
- DU-8c: --time-style=iso prints the date only.
- DU-8f: a directory's own time always enters its tmax.
- DU-10: unreadable directory diagnosed 'cannot read directory'
  with the reason; the run fails.
- DU-11: --inodes warns that --apparent-size/-b are ineffective.

Differential cases: corpus/du/02-05.
Refs #1462

df (oracle df.c):
- DF-1: a fully filtered run prints NO table: 'df: no file
  systems processed' on stderr, exit 1 (df.c:1843-1850). The
  in-code comment asserting a bare header with exit 0 was false
  and is removed; the unit test that pinned that behavior is
  corrected to the oracle expectation.
- DF-2: -t/-x accumulate ALL occurrences as lists (df.c:
  650-676); a type in both lists is fatal — 'file system type
  .. both selected and excluded' (df.c:1749-1770). Matching
  stays case-insensitive as a documented platform adaptation
  (Windows volume APIs report canonical-case type names).
- DF-3: -l no longer cancels under -a (df.c:1019). (-a
  admitting inaccessible file systems stays unmodeled:
  enumeration materializes readable volumes only.)
- DF-4: --total row: target is '-' in default mode (mount was
  never set); --output total cells are Source='total',
  File='-', Target='-' (or 'total' when source is absent).
- DF-5: --output=file prints '-' for auto-enumerated drives
  (df.c:1097-1098), not the manufactured drive root.
- DF-6: an existing-but-unreadable filesystem reports the real
  reason via the failing call's error, not a hardcoded
  'No such file or directory' (df.c get_dev).
- DF-8: --output diagnostics quote the field name (df.c:
  456-465); the empty-field case no longer doubles the space.

Differential cases: corpus/df/01-03.
Refs #1462

Shared root cause (RL-2/RP-1, HIGH): the canonicalise walker in
native_path::canonicalize_path_w probed components with
GetFileAttributesW, which follows links, so a dangling symlink
landed in the missing-component branch and was kept verbatim.
The walker now probes for a reparse target in the
invalid-attributes branch and substitutes it in every mode;
under CAN_EXISTING the substituted components fail ENOENT in
turn, preserving -e's outcome. readlink -f/-m and realpath
(default/-m) now print the target's path for a dangling leaf,
as GNU does (verified against coreutils 9.4).

readlink (oracle readlink.c):
- RL-1: the invented POSIXLY_CORRECT semantics are removed —
  diagnostics default off, -v enables, -q/-s always silence,
  last flag wins. readlink.c has no such variable.
- RL-3: -n suppresses the terminator even with -z
  (readlink.c:162-168).
- RL-4: 'ignoring --no-newline with multiple arguments' loses
  the invented 'warning:' (readlink.c:149-156).
- RL-5: exotic reparse points report 'Invalid argument', the
  same EINVAL as non-links.

realpath (oracle realpath.c):
- RP-2: --relative-base not a prefix of --relative-to discards
  the relative-to; results print absolute (realpath.c:262-276).
- RP-3: -L/-P/-s edit one mode word in argv order; logical mode
  canonicalises twice (lexical pass, then following pass), so
  '-s -P' expands again and '-P -L' is logical.
- RP-5: an empty operand is a per-operand failure
  ('realpath: '': No such file or directory'), other operands
  still processed.
- RP-6: -z no longer NUL-terminates stderr diagnostics.
- RP-7: the registration description no longer claims an
  operand is optional or that all components must exist.

Differential cases: corpus/readlink/02-04, corpus/realpath/37-38.
Refs #1462

touch (oracle touch.c / posixtm.c):
- T1: operand '-' retimes standard output (touch.c:127-128)
  instead of creating a literal file named '-'.
- T2/T3: --time is additive over ALL occurrences (change_times
  |= XARGMATCH, touch.c:319-322) on top of -a/-m, with argmatch
  prefix matching over the GNU word set (atime/access/use,
  mtime/modify, change) and the Valid-arguments list on error.
  It used to replace the selection and read one occurrence.
- T4: the multi-source rule exists now: -t with -r or -d fails
  with 'cannot specify times from more than one source' +
  try-help (touch.c:336-340); repeated -d/-t keep only the last
  occurrence, evaluated once — occurrences were chained, each
  result seeding the next.
- T5: -r + -d evaluates the string against the reference atime
  for the atime field and the reference mtime for mtime
  (touch.c:354-360).
- T6: all validation precedes the missing-operand check; the
  missing-operand line gains the try-help tail.
- T7: a -t trailing dot with no seconds is invalid
  (posixtm.c:100-107).
- T8 (half): leap seconds (ss=60/61) normalize into the next
  minute (posixtm.c:195-205). Pre-1601 years stay rejected —
  the FILETIME epoch is a hard platform floor.
- T10: post-open failures carry the reason with GNU's two
  forms split: 'cannot touch' for open/read failures,
  'setting times of' for SetFileTime and -h failures
  (touch.c:194,200).

Differential cases: corpus/touch/34-37.
Refs #1462

shred (oracle shred.c):
- S1: --random-source is implemented — the named file supplies
  the random bytes; two different sources are fatal ('multiple
  random sources specified', shred.c:1199-1202); an unopenable
  source aborts before any file is shredded. It was declared
  and discarded.
- S2: removal follows wipename — the file is truncated to 0
  through its open handle first (shred.c:938-947), then renamed
  once per basename length down to 1, names from the nameset
  odometer starting at all-'0's, directory synced per rename
  for wipesync (shred.c:979,1053-1085); failures read
  '<name>: failed to remove: <reason>'. Removal now runs ONLY
  when the wipe succeeded (shred.c:1144) — a failed wipe used
  to be deleted anyway. -u on '-' truncates the stdout file.
- S3: non-exact round-up uses the volume cluster size
  (ST_BLKSIZE analogue), not a fixed 512 (shred.c:867-875).
- S4: -s suffix grammar completed — R/Q powers (suffix string
  'cbBkKMGTPEZYRQ0', shred.c:1214-1215), bare suffix = 1x,
  letter+'D' = 1000^n.
- S5: --remove HOW is argmatch-resolved with prefixes; 'w' is
  ambiguous; diagnostics use the GNU shape + Valid list
  (shred.c:1208-1211).
- S6: -n/-s/--remove all validate before the missing-operand
  check (shred.c:1184-1222 vs 1242-1246).
- S7: -n parses as uintmax (xdectoumax): '+' allowed, values
  beyond the 32-bit int work, negatives report the overflow
  wording 'Value too large for defined data type'.
- S8: open failures read '<name>: failed to open for writing:
  <reason>' (shred.c:1133), directories included.
- S9: files are opened write-only (shred.c:1127 O_WRONLY).
- S10: verbose goes to stderr in GNU shapes ('pass i/n
  (random)...', 'removing', 'renamed to', 'removed').

Differential cases: corpus/shred/01-05.
Refs #1462

win32_posix_error_text is imported unqualified in these TUs;
the winux::win32_error:: qualification does not exist. And the
--files0-from probe open now converts the narrow normalized
path explicitly (normalize_api_operand returns std::string).
- mkfifo/mknod: the octal -m gate is 0777, not 07777 (GNU rejects
  -m 7777 with 'mode must specify only file permission bits')
- cp: argmatch Valid-arguments lists use the GNU '  - ' item shape;
  --preserve and --update gain the Try line; --update lists only
  all/none/older (none-fail stays accepted, unlisted as in GNU)
- cp --sparse/--reflink lists: same item shape
- rm: --interactive list groups synonyms as GNU does
- du: --time rejects 'mtime' (not in the XARGMATCH set); --time-style
  is validated only when --time is in effect, the accepted set is
  full-iso/long-iso/iso ('locale' rejected), and 'posix-' is stripped
  only from the TIME_STYLE environment value; usage-class errors
  (summarize conflicts, files0-from combination, --time, --time-style)
  gain the Try line
- touch: --time rejects 'change'; the error gains the Try line
- df: --output decode errors end with the Try line
- shred: --remove argmatch error gains the Try line; --random-source
  names the file unquoted; a negative -n reports without the overflow
  suffix (positive overflow keeps it); -n value recovery via raw argv
- ln: 'cannot overwrite directory' prints the dest unquoted
- whitelist: six runner-environment cases (9p hardlink/symlink
  creation, UNC absolute-path spelling) with precedented reasons
- cases: du/06 (lazy time-style), du/07 (--time=mtime), touch/38
  (--time=change)
…(Refs #1462)

Code fixes (tests pinned the GNU behavior):
- mv: a no-clobber skip now prints "not replacing '<dest>'" and
  fails the file (copy.c:2438, 2425-2445: return_val is true only
  for I_ALWAYS_SKIP); declined -i and unwritable-destination prompts
  likewise fail the file instead of silently succeeding
- ln: the directory hard-link refusal names the source operand
  unquoted (ln.c:202-208, quoteaf)
- mknod: the File-exists diagnostic follows quotef (mknod.c:257):
  plain names unquoted, quotes only around names that need them
- install: restore the -v "skipping identical destination" note on
  a -C skip (the #1288 behavior removed by the audit round)

Test updates (tests pinned pre-audit invented text; GNU 9.4 captures
and oracle source govern): df empty --output field is quoted;
du --files0-from combination wording; du --time fixture pins the
directory times (a directory contributes its own time to the max);
ln create/-fT expectations follow the up-front GNU refusals;
mknod note reads "require"; mv -n expects the report + exit 1;
readlink has no POSIXLY_CORRECT mode and fails silently without -v;
realpath empty operand is a per-operand No-such-file error;
rm says "missing operand"; rmdir -p ancestor failures use the
"failed to remove directory" form (rmdir.c:150);
sync conflict wording (sync.c:211)
…efs #1462)

- differential mv/06 (-n reports 'not replacing' and fails), mv/07
  (-i decline fails, prompt on stderr), mv/08 (--update=none skips
  silently with success): byte-verified against GNU coreutils 9.4
  (copy.c:2438, 2425-2445)
- unit tests: the two interactive-decline tests expected exit 0;
  GNU mv exits 1 on a declined prompt (cp's decline is 0 — the
  asymmetry is in copy.c's return plumbing via do_move)
…1462)

Diagnostic: CI shows the -n skip exits 1 in both the unit harness
and the differential corpus (mv/06 OUT_DIFF) but the subject's
stderr does not contain the expected 'not replacing' line; capture
the actual bytes in the ctest log to pin the emitting path.
Bisect the mv -n residual: the subject answers a bare -n with the
--backup/--no-clobber mutual-exclusion fatal, so the backup-given
probe fires spuriously. 09 checks whether a plain verbose force
overwrite grows a backup note, 10 whether --backup=none disarms
the conflict, 11 whether -S still triggers it as GNU requires.
…apes (Refs #1462)

mv -v printed a bare '<src>' -> '<dest>'; GNU prints
"renamed '<src>' -> '<dest>'" for a rename and, for the copy
fallback, "copied '<src>' -> '<dest>'" followed by
"removed '<src>'" (captured from the local coreutils 9.4:
same-volume and cross-volume runs).  The backup note still
rides the first line.  Caught by probe case mv/09.
)

A pre-existing dst.txt~ with sentinel content separates the two
remaining explanations for mv/09: if the subject makes a backup
on a plain overwrite it overwrites the sentinel with the old
destination; GNU leaves it untouched.
… probes (Refs #1462)

CI evidence (unit TEST_LOG + differential mv/06, mv/12): a bare
'mv -n a b' was answered with the --backup/--no-clobber mutual-
exclusion error, and a plain 'mv -f a b' overwrote a pre-existing
b~ sentinel -- backups were in effect with no backup option
given.  The has()/get() name probes misfire on this option table
(duplicated long-only entries); the occurrence scan used by
parse_overwrite_mode reads -f/-i/-n correctly in the same binary,
so mv_make_backups and the suffix lookup now scan occurrences.
…#1462)

The differential buckets (OUT_DIFF) do not carry the subject's
actual output, and mv/06, mv/09 and mv/12 still differ after the
backup-detection rewrite.  This test pins the GNU expectations
for a verbose force overwrite and for the backup sentinel, and
logs the exact stdout/stderr and sentinel state so the ctest log
shows the subject's bytes either way.
Temporary: the occurrence-scan rewrite did not change the
behavior (x64 run for d2b54f0: bare -n still answers with the
mutual-exclusion error, plain -v -f still makes a backup), so
dump every occurrence index and its meta names to stderr; the
no-clobber unit tests log stderr verbatim.  To be removed once
the stream is known.
… (Refs #1462)

The occurrence dump proved mv_make_backups sees a clean stream
(only -n) yet the mutual-exclusion error still fires, and plain
overwrites still make backups.  Mark the mv conflict-check
verdict and cp's validation entry to learn which code actually
executes during an mv invocation.  Temporary.
…l (Refs #1462)

mv_make_backups returns Result<optional<MvBackupControl>>.  Both call
sites tested has_value() on the std::expected itself, which only says
'no error' and is therefore true even when no backup was requested:

- the --backup/--no-clobber conflict check fired for every bare -n
  (mv -n a b answered with the mutual-exclusion error instead of
  'not replacing'), and
- backup_existing_destination never took its no-backup early return,
  so plain overwrites (mv -f a b) made a backup and replaced a
  pre-existing b~ sentinel (and **control read a disengaged optional).

GNU contract: the conflict fires only when make_backups is set
(mv.c:512-515, make_backups && I_ALWAYS_NO; make_backups defaults to
false, mv.c:315), and a backup is made only when backup_type is not
no_backups (mv.c:519-522).  The skip itself reports 'not replacing %s'
(copy.c:2438).  cp's select_backup_path callers already unwrap this
way (if (!*backup_path)); mv now matches.

Test side verified against the oracle, not weakened: the three
failing unit tests encode exactly the contracts above.
The occurrence dump and verdict markers served their purpose: they
proved mv_make_backups sees a clean occurrence stream for a bare -n,
which localized the defect to the call sites' engagement test (fixed
in the previous commit).  No user-visible text changes.
…no-clobber tests (Refs #1462)

The captures served their purpose (they exposed the mutual-
exclusion answer that led to the engagement-test fix); the
tests stand on their GNU expectations alone now.  This also
re-triggers CI for the branch head, whose last two commits
landed without workflow runs.
…s-files

# Conflicts:
#	tests/differential/whitelist.txt
…ness, not the engaged mode (Refs #1462)

Oracle-verified: mv --backup=none -n a b answers with the
mutual-exclusion error (exit 1), exactly like --backup=simple -n;
the resolved mode none only means no backup file is made.  The
conflict check therefore tests mv_backup_option_given (any of
-b/--backup/-S/--suffix present) while backup creation keeps
testing the engaged control.  mv/10 renamed to record the true
premise (it previously encoded the opposite assumption and only
passed while the engagement test was broken).  No user-visible
text changes.
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 31, 2026 19:49
@caomengxuan666
caomengxuan666 merged commit 7f77657 into main Oct 31, 2026
8 of 9 checks passed
caomengxuan666 added a commit that referenced this pull request Oct 31, 2026
Main advanced by #1473 (W1 coreutils files) and #1476 (W6 cmp/patch)
after the cpio composition base 4728cfc. File overlap with this
branch: none (108 main files vs 25 branch files), so the composition
in 61ad842 is untouched; merging keeps the PR current for merge.
caomengxuan666 added a commit that referenced this pull request Oct 31, 2026
Brings in the W1 mv fix (#1473) and W6 diff fix (#1476) merges.
Overlapping files: src/commands/date.cpp (both waves touched it,
disjoint hunks) and tests/differential/baseline.json (append-only).
Refs #1462
@caomengxuan666
caomengxuan666 deleted the fix/audit-w1-coreutils-files branch November 2, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant