René's URL Explorer Experiment


Title: diff panics (broken-pipe unwrap) when its stdout is closed early · Issue #244 · uutils/diffutils · GitHub

Open Graph Title: diff panics (broken-pipe unwrap) when its stdout is closed early · Issue #244 · uutils/diffutils

X Title: diff panics (broken-pipe unwrap) when its stdout is closed early · Issue #244 · uutils/diffutils

Description: Summary When diff's standard output is a pipe whose reader closes early (e.g. diff … | head), uutils diff aborts with a panic (exit 134, core dump) instead of dying cleanly to SIGPIPE like GNU (exit 141). The output is written with a bar...

Open Graph Description: Summary When diff's standard output is a pipe whose reader closes early (e.g. diff … | head), uutils diff aborts with a panic (exit 134, core dump) instead of dying cleanly to SIGPIPE like GNU (exi...

X Description: Summary When diff's standard output is a pipe whose reader closes early (e.g. diff … | head), uutils diff aborts with a panic (exit 134, core dump) instead of dying cleanly to SIGPIPE like GNU ...

Opengraph URL: https://github.com/uutils/diffutils/issues/244

X: @github

direct link

Domain: redirect.github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"diff panics (broken-pipe unwrap) when its stdout is closed early","articleBody":"## Summary\n\nWhen `diff`'s standard output is a pipe whose reader closes early (e.g. `diff … | head`), uutils `diff` aborts with a panic (exit 134, core dump)\ninstead of dying cleanly to `SIGPIPE` like GNU (exit 141). The output is written with a bare `.unwrap()` on the `write_all`/`push_output` result; the `BrokenPipe` error is unwrapped and, under `panic=\"abort\"`, aborts the process. This affects every output mode: the normal/context/unified/ed path writes the buffered result in `src/diff.rs:94`, and the side-by-side (`-y`) path writes each line in `src/side_diff.rs:353-356`.\n\n## Steps to reproduce\n\n```console\n$ seq 1 100000 \u003e b1; seq 1 100000 | sed 's/5/X/' \u003e b2\n$ diffutils diff b1 b2 | head -1\nthread 'main' panicked at src/diff.rs:94:41:\ncalled `Result::unwrap()` on an `Err` value: Os { code: 32, kind: BrokenPipe, message: \"Broken pipe\" }\n$ echo \"${PIPESTATUS[0]}\"\n134\n```\n\nSide-by-side mode hits the sibling site `src/side_diff.rs:353`:\n\n```console\n$ diffutils diff -y b1 b2 | head -1\nthread 'main' panicked at src/side_diff.rs:353:87:\ncalled `Result::unwrap()` on an `Err` value: Os { code: 32, kind: BrokenPipe, message: \"Broken pipe\" }\n$ echo \"${PIPESTATUS[0]}\"\n134\n```\n\n## Expected behavior\n\nMatch GNU: a closed output pipe terminates the program via `SIGPIPE` (exit 141) with no error message and no core dump.\n\n```console\n$ /usr/bin/diff b1 b2 | head -1\n1c1\n$ echo \"${PIPESTATUS[0]}\"\n141\n$ /usr/bin/diff -y b1 b2 | head -1\n1                            \u003c      1\n$ echo \"${PIPESTATUS[0]}\"\n141\n```\n\n## Root cause\n\nThe full diff output (normal/context/unified/ed) is buffered and written once:\n\n```rust\n// src/diff.rs:94\nio::stdout().write_all(\u0026result).unwrap();\n```\n\nSide-by-side writes each line straight to the locked stdout and unwraps every\nwrite:\n\n```rust\n// src/side_diff.rs:353-356\npush_output(...).unwrap();   // and the sibling unwraps at :354, :356\n```\n\nAny `write_all`/`push_output` error — `BrokenPipe` in the common pipe-closed case — is unwrapped and aborts. \n\n_Found by our static analysis tooling._","author":{"url":"https://github.com/leeewee","@type":"Person","name":"leeewee"},"datePublished":"2026-06-10T04:50:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/244/diffutils/issues/244"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:2f7ac55f-93d9-2917-d213-4fa386e9b4cb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9550:1C4EB2:BA8451:F80241:6A4D46D2
html-safe-nonce75029b88cdbcc6955d4d24aacba0017802dc406076377674b83f11fff44eca2c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTUwOjFDNEVCMjpCQTg0NTE6RjgwMjQxOjZBNEQ0NkQyIiwidmlzaXRvcl9pZCI6IjY5NzkzOTE0NjIwMjM0NDgyNzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacf62a106be3abb2f9cc3c808cb12360e7f3a3b5c0479f3df36feaa866d02cc91a
hovercard-subject-tagissue:4628095723
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/uutils/diffutils/244/issue_layout
twitter:imagehttps://opengraph.githubassets.com/df627d59ebf41c483b4f1cbc8e62b86e66de492ab1e0e7c785c824812c15b0f9/uutils/diffutils/issues/244
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/df627d59ebf41c483b4f1cbc8e62b86e66de492ab1e0e7c785c824812c15b0f9/uutils/diffutils/issues/244
og:image:altSummary When diff's standard output is a pipe whose reader closes early (e.g. diff … | head), uutils diff aborts with a panic (exit 134, core dump) instead of dying cleanly to SIGPIPE like GNU (exi...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameleeewee
hostnamegithub.com
expected-hostnamegithub.com
None92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6
turbo-cache-controlno-preview
go-importgithub.com/uutils/diffutils git https://github.com/uutils/diffutils.git
octolytics-dimension-user_id5148717
octolytics-dimension-user_loginuutils
octolytics-dimension-repository_id341787720
octolytics-dimension-repository_nwouutils/diffutils
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id341787720
octolytics-dimension-repository_network_root_nwouutils/diffutils
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release56fc8347865a14e2ec811533d68f929cf4e0ec19
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://redirect.github.com/uutils/diffutils/issues/244#start-of-content
https://redirect.github.com/
Sign in https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fuutils%2Fdiffutils%2Fissues%2F244
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fuutils%2Fdiffutils%2Fissues%2F244
Sign up https://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=uutils%2Fdiffutils
Reloadhttps://redirect.github.com/uutils/diffutils/issues/244
Reloadhttps://redirect.github.com/uutils/diffutils/issues/244
Reloadhttps://redirect.github.com/uutils/diffutils/issues/244
Please reload this pagehttps://redirect.github.com/uutils/diffutils/issues/244
uutils https://redirect.github.com/uutils
diffutilshttps://redirect.github.com/uutils/diffutils
Notifications https://redirect.github.com/login?return_to=%2Fuutils%2Fdiffutils
Fork 35 https://redirect.github.com/login?return_to=%2Fuutils%2Fdiffutils
Star 269 https://redirect.github.com/login?return_to=%2Fuutils%2Fdiffutils
Code https://redirect.github.com/uutils/diffutils
Issues 20 https://redirect.github.com/uutils/diffutils/issues
Pull requests 12 https://redirect.github.com/uutils/diffutils/pulls
Actions https://redirect.github.com/uutils/diffutils/actions
Projects https://redirect.github.com/uutils/diffutils/projects
Security and quality 0 https://redirect.github.com/uutils/diffutils/security
Insights https://redirect.github.com/uutils/diffutils/pulse
Code https://redirect.github.com/uutils/diffutils
Issues https://redirect.github.com/uutils/diffutils/issues
Pull requests https://redirect.github.com/uutils/diffutils/pulls
Actions https://redirect.github.com/uutils/diffutils/actions
Projects https://redirect.github.com/uutils/diffutils/projects
Security and quality https://redirect.github.com/uutils/diffutils/security
Insights https://redirect.github.com/uutils/diffutils/pulse
diff panics (broken-pipe unwrap) when its stdout is closed earlyhttps://redirect.github.com/uutils/diffutils/issues/244#top
https://github.com/leeewee
leeeweehttps://github.com/leeewee
on Jun 10, 2026https://github.com/uutils/diffutils/issues/244#issue-4628095723
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.