Skip to content

fix(paths): fold csplit -f/--prefix through the shared argv boundary (#1276) - #1278

Merged
caomengxuan666 merged 1 commit into
mainfrom
fix/1276
Oct 22, 2026
Merged

caomengxuan666 merged 1 commit into
mainfrom
fix/1276

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Summary

  • csplit's -f/--prefix operand flows into every derived output filename, which a bare std::ofstream resolved literally (src/commands/csplit.cpp): a drive-dialect spelling like /e/xx- was opened relative to the cwd's drive instead of the named drive — the same blind spot family as sort -T in fix(paths): resolve bare MSYS drive-root operands through the shared argv boundary (#1230) #1274.
  • The filename is now folded through native_path::normalize_api_operand once at materialization, so the ofstream and cleanup()'s std::filesystem::remove share one resolved native spelling (/e/xx-00 → E:\xx-00).

Test plan

  • New regression test csplit.csplit_prefix_drive_dialect_writes_named_directory: -f /d/<tmp>/seg- through the external path asserts seg-00/seg-01 land in the named directory with the right contents
  • winuxcmd-tests.exe --gtest_filter=csplit.*: 18/18 passed (MSVC Debug build)

Fixes #1276.

Generated with Devin

…1276)

The -f/--prefix operand feeds each derived output filename, which the
bare ofstream resolved literally: a dialect spelling like "/e/xx-" was
opened relative to the cwd drive instead of the named drive. Normalize
the filename once at materialization so the ofstream and cleanup's
remove share one resolved spelling - the same pattern as the sort -T
fix in #1274.

Regression test: "-f /d/..." through the external path asserts the
segments land in the named directory.

Fixes #1276.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@caomengxuan666
caomengxuan666 merged commit 88390a7 into main Oct 22, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/1276 branch October 30, 2026 01:42
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.

[P3][paths] csplit -f/--prefix 输出前缀裸 ofstream 未过共享归一边界(csplit.cpp:463)——#1274 同类残留

1 participant