Skip to content

macOS /usr/bin/patch cause obscure failures and stalls #225

@marc-hb

Description

@marc-hb

macOS' /usr/bin/patch and GNU patch have very subtle incompatibilities that cause only some "more advanced" tests to fail in obscure and very time-consuming ways - while other tests pass. In some cases (depending on test threads racing), the lack of newlines in some test data even causes the whole test suite to stall.

failures:
    context_diff::tests::test_permutations
    context_diff::tests::test_permutations_empty_lines
    context_diff::tests::test_permutations_reverse
    unified_diff::tests::test_permutations
    unified_diff::tests::test_permutations_empty_lines
    unified_diff::tests::test_permutations_missing_line_ending
    unified_diff::tests::test_permutations_reverse

test result: FAILED. 118 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out; finished in 13.50s

Examples:

diff: "--- target/unified-diff//alef\t2026-05-06 17:34:45.259112903 -0400\n+++ target/unified-diff//alef\t2026-05-06 17:34:45.259112903 -0400\n@@ -1,4 +1,4 @@\n-a\n-c\n+b\n+d\n f\n h\n@@ -5,2 +5,2 @@\n-i\n+j\n l\n"
alef: "a\nc\nf\nh\ni\nl\n"
bet: "b\nd\nf\nh\nj\nl\n"
patching file 'target/unified-diff//alef'
1 out of 2 hunks failed--saving rejects to 'target/unified-diff//alef.rej'

---- context_diff::tests::test_permutations_reverse stdout ----

thread 'context_diff::tests::test_permutations_reverse' (14471508) panicked at src/context_diff.rs:718:33:
assertion failed: `(left == right)`

Diff < left / right > :
 [
     98,
     10,
<    100,
<    10,
<    99,
<    10,
<    98,
<    10,
<    97,
<    10,
 ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions