Skip to content

Writing a sufficiently large string to a git bash pipe on windows regressed in 1.62 #98947

Closed
@smmalis37

Description

@smmalis37

Reproduction steps:

  1. Be on windows.
  2. cargo new --bin something
  3. replace main.rs with main.txt and rename it back to main.rs.
  4. Open git bash
  5. Run cargo run | cat

I expected to see this happen: my really long string gets printed twice, followed by a clean exit

Instead, this happened: some amount of my really long string gets printed, followed by:
fatal runtime error: I/O error: operation failed to complete synchronously

Additional Details

  • The test case, while simple, does appear to have a minimum size requirement to trigger this crash. Shrinking the string will cause it to stop crashing.
  • I'm using cat in the steps for simplicity, but we've observed this happening with other programs at the end of the pipe too.
  • Redirecting to a file instead of a pipe seems to not trigger this crash.
  • Using cargo run is not necessary to trigger the crash, running the built executable directly also crashes.
  • This PR added this new error condition: Fix unsound File methods #95469
  • I am not the only one seeing this new error message: rustc -C help panics (ICEs) when piped to a closed stdout #98700 (comment)

Version it worked on

rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: x86_64-pc-windows-msvc
release: 1.61.0
LLVM version: 14.0.0

Version with regression

rustc 1.62.0 (a8314ef7d 2022-06-27)
binary: rustc
commit-hash: a8314ef7d0ec7b75c336af2c9857bfaf43002bfc
commit-date: 2022-06-27
host: x86_64-pc-windows-msvc
release: 1.62.0
LLVM version: 14.0.5

@rustbot modify labels: +regression-from-stable-to-stable +O-windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-windowsOperating system: WindowsP-highHigh priorityT-libsRelevant to the library team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions