Skip to content

WIP: winx3-fileops — cp/mv/rm/rmdir/mkdir/chmod GNU fixes (#1324–#1331) - #1404

Merged
caomengxuan666 merged 10 commits into
mainfrom
fix/winx3-fileops
Oct 27, 2026
Merged

caomengxuan666 merged 10 commits into
mainfrom
fix/winx3-fileops

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Draft PR for the winx3-fileops cluster (cp/mv/rm/rmdir/mkdir/chmod), tracking WinuxCmd #1324–#1331. Fixes are committed per issue as they take shape; verification (Wine mini-harness probes vs GNU coreutils 9.4) is still in progress — do not merge yet.

Progress:

All committed sources are byte-identical to the cluster's desk-verified reference files. Local-only build harness adaptations (mingw/Wine verification) are intentionally NOT part of these commits.

…n answer (#1324)

Regression test: cp_interactive_1324_second_prompt_reads_own_line in tests/unit/cp. Verification pending: Wine mini-harness probes (build slot). Part of the winx3-fileops cluster (#1324-#1331).
…argv (#1325)

A -t/--suffix value containing i/n/f letters no longer rewrites the overwrite mode. Regression test: mv_overwrite_1325_target_value_not_scanned. Verification pending: Wine mini-harness probes (build slot).
…-u weak (#1326)

GNU 9.4 measured rule: explicit --update=VALUE forms are last-wins among themselves and beat -u/bare --update in either order. Regression test: mv_update_1326_explicit_beats_u. Note: bare --update and --update= are indistinguishable in the parser (both store empty); the empty form stays 'older' (documented gap). Verification pending: Wine mini-harness probes (build slot).
… prompt (#1327)

Prompts name the item kind (regular file / regular empty file / symbolic link / directory) via i18n keys command.rm.prompt.*, drop the (y/n) suffix, skip the descend prompt for empty directories, prompt for the directory itself after recursion, and never prompt for a missing operand. Existing prompt presence checks updated to the typed wording. New tests: rm_interactive_1327_typed_prompts / _missing_operand_no_prompt / _empty_dir_no_descend / _full_sequence. i18n catalog sync (unixwin/winuxcmd-i18n) is an integration follow-up. Verification pending: Wine mini-harness probes (build slot).
…ths (#1328)

Recursive -v output now reads removed 'd/f' then removed directory 'd' (GNU wording), and a display path is threaded through the recursion so prompts/verbose lines no longer leak \\?\ extended paths. Regression test: rm_verbose_1328_recursive_paths. Verification pending: Wine mini-harness probes (build slot).
…#1330)

mode_allows_write now evaluates symbolic modes properly (base 0777, who/op/perms clauses, copy letters, empty perms) instead of substring heuristics that rejected e.g. u+rwx. Parse failures report 'invalid mode'. Regression test: mkdir_mode_1330_symbolic. Note: GNU measures u+rwx as 0777, not 0700 as the issue text claimed. Verification pending: Wine mini-harness probes (build slot).
…ty perms (#1331)

parse_symbolic_mode now returns clause lists: who once, then (op, perms) pairs; a perms segment is empty, all [rwxXst], or exactly one [ugo] copy letter (mixed is invalid). Display and owner-write application handle copy semantics. Regression tests: chmod_symbolic_1331_copy_and_multiop. Out of scope (noted): omitted-who umask masking. Verification pending: Wine mini-harness probes (build slot).
# Conflicts:
#	tests/unit/mkdir/mkdir_unit_test.cpp
#	tests/unit/mv/mv_unit_test.cpp
#	tests/unit/rm/rm_unit_test.cpp
)

- chmod -v now prints the 9-char permission string GNU prints, dropping
  the type bit exactly like coreutils chmod.c does with &perms[1]
  ("changed from 0644 (rw-r--r--) to 0664 (rw-rw-r--)"); the 1331 pin
  asserted the GNU form while the implementation emitted the ls -l style
  10-char form.
- rm_interactive_1327_missing_operand_no_prompt keyed its no-prompt
  assertion on the bare word "remove", which the cannot-remove
  diagnostic itself contains; key on the prompt's trailing "'? " so the
  assertion actually distinguishes prompt from diagnostic.
- Rebuild the rm test tail that the main merge interleaved (1298
  long-verbose body had 1327 assertions spliced in; the 1328
  recursive-paths pin carried a duplicated 1298 tail).
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 27, 2026 06:25
@caomengxuan666

Copy link
Copy Markdown
Member Author

Verified post-merge (origin/main @ 1854504): MSVC Debug build green; cp/mv/rm/rmdir/mkdir/chmod unit tests 165/165; full ctest 3238 — the 11 residuals are exactly the environment-bound baseline set (3x issue_1288 LongPathsEnabled=0, find.issue_1309_ls, 7x xargs CONIN$).

Merge notes: the three conflicted test files (mkdir/mv/rm) all had tail interleaving — rebuilt so every test function is byte-identical to one parent side (1297/1298 from main kept whole, 1327/1328 branch tests kept whole).

Two verification-debt fixes on top (the cluster's pending adjudication):

  • chmod -v now prints GNU's 9-char permission string, dropping the type bit like coreutils chmod.c's &perms[1] — the 1331 pin asserted the GNU form but the implementation emitted the ls -l style 10-char form ('-rw-r--r--' vs 'rw-r--r--').
  • rm_interactive_1327_missing_operand_no_prompt keyed its no-prompt assertion on the bare word "remove", which the cannot-remove diagnostic itself contains; the assertion now keys on the prompt's trailing "'? ". Implementation behaviour was already correct (verified manually: rm -i missing prompts nothing, exits 1).

i18n: en adds the three #1327 rm prompt keys + 'removed directory ' (#1328), drops the four superseded prompt/wording keys. Synced on winuxcmd-i18n sync/winx3-fileops-i18n (zh-CN translated, VERSION 0.6.29).

# Conflicts:
#	tests/unit/cp/cp_unit_test.cpp
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