← Back to Pull requests

sed: skip an input file that can't be read and exit with 2 #643

Open
unknown opened this pull request with 111 lines diff across 1 files
View on GitHub
unknown unknown commented on Nov 06, 2026 04:55 UTC
Author

When one of the input files can't be opened, GNU sed prints an error, carries on with the other files and exits with 2 at the end. We stopped at the first missing file with status 1, so nothing after it got processed.

$ printf 'a\nb\n' > f
$ sed p missing f; echo $?
sed: can't read missing: No such file or directory
a
a
b
b
2

Our sed printed only the error and returned 1.

Now the error is shown, the file is skipped and the exit status is 2. A few details I matched with GNU sed 4.9:

  • $ still matches the last line of the last file that can actually be opened, so sed -n '$p' f missing prints b.

  • The status stays 2 even if q sets another exit code later, like GNU does.
  • Added test_missing_input_file_is_skipped. It fails on main and passes with the change. cargo test, cargo fmt --check and cargo clippy --all-targets --all-features -- -D warnings pass.

    Diff: 111 lines (+83 / -28) across 1 files Reviewer: qodelicious Review duration: 35444m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.31) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.31 · 111 lines diff across 1 files
    0.31
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.282
    Real PR Conversation Timeline
    1 comments
    "Review active on #643"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 31.2% (LOW) · Higher = larger blast radius
    31.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.8% · Safe to merge
    17.8%
    Repository