git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: AI Textconv filter misconfiguration on Windows leads to silent corruption of diff output (ongoing investigation)

From
Skybuck Flying <skybuck2000@hotmail.com>
Date
Aug 11, 2026, 02:13 UTC
Message-ID
<AM0PR02MB445083767BAE669D4656CA6CB3DD2@AM0PR02MB4450.eurprd02.prod.outlook.com>
In-Reply-To
<AM0PR02MB445096594555DAD1D9EE1505B3DD2@AM0PR02MB4450.eurprd02.prod.outlook.com>
I confronted Co-Pilot with it, according to Co-Pilot you will like this shorter report better, more to the point:
Hi,

I encountered an issue on Windows where a textconv filter intended to strip carriage returns ends up corrupting diff output by removing literal 'r' characters.

Configuration:
    [diff "lfclean"]
        textconv = sed -e s/\r//
    *.go diff=lfclean
Environment:
- Windows 10
- Git for Windows (2.x)
- sed from Git for Windows: usr/bin/sed.exe
Problem:
Running `git diff` on Go source files shows corrupted identifiers:
    compareCache → compaeCache
    return → eturn
    for → fo
    cacheReader → cacheReade
etc.
The repository content is correct:
- `git diff --no-textconv` shows correct diffs.
- `git show <commit>:<file>` shows correct content.
Reproduction outside Git:
    echo compareCache | C:\Tools\Git\usr\bin\sed.exe -e s/\r//
Output:
    compaeCache

So sed removes literal 'r' instead of carriage returns. It appears that on Windows, the backslash in `\r` is not preserved through MSYS argument parsing, effectively turning the expression into `s/r//`.

Impact:
- Diff output becomes misleading/corrupted.
- No warning is emitted.
- The issue is silent and difficult to diagnose.
Suggestion:
- Consider documenting that sed-based textconv filters using backslash escapes
  are unsafe on Windows.
- Possibly warn when textconv commands contain `\r` on Windows.
- A built-in CR-stripping textconv filter would avoid these pitfalls.
Thanks,
  Skybuck Flying
Previous: Skybuck FlyingNext: Skybuck Flying
Message 2 of 16 in “AI Textconv filter misconfiguration on Windows leads to silent corruption of diff output (ongoing investigation)”
  1. Skybuck FlyingAug 11, 2026
  2. Skybuck FlyingAug 11, 2026
  3. Skybuck FlyingAug 11, 2026
  4. Skybuck FlyingAug 11, 2026
  5. Skybuck FlyingAug 11, 2026
  6. Skybuck FlyingSep 1, 2026
  7. Skybuck FlyingSep 1, 2026
  8. Skybuck FlyingSep 1, 2026
  9. rsbecker@nexbridge.comSep 1, 2026
  10. Skybuck FlyingSep 2, 2026
  11. Skybuck FlyingSep 2, 2026
  12. D. Ben KnobleSep 2, 2026
  13. Skybuck FlyingSep 2, 2026
  14. Bradley MorganAug 21, 2026
  15. Theodore TsoAug 11, 2026
  16. Jeff KingAug 11, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.