Subject: bug#77252: 回复： bug#77252: cat lost content when used in cmd.exe

From: Pádraig Brady <[email-masked]>
Date: Wed, 26 Mar 2025 13:00:05 +0000

tag 77252 notabug
close 77252
stop

On 26/03/2025 07:43, anmikf wrote:
> 在Git for windows的Git Bash里面执行`cat catbug`,文件内容能完全显示。
> 但是在Win10的cmd.exe里面执行`"C:\Program Files\Git\usr\bin\cat.exe" catbug`,文件内容不能完全显示，会丢失第51367行的字符'B'，经过测试发现会丢失第1900544个字节。
> ------------------------
> Execute `cat catbug` in Git Bash for Windows, and the file content will be fully displayed.
> However, when executing `"C:\Program Files\Git\usr\bin\cat.exe" catbug` in cmd. exe of Win10, the file content cannot be fully displayed and the character 'B' on line 51367 will be lost. After testing, it was found that the 1900544th byte will be lost.

I think you're using version 8.32 of cat (according to https://packages.msys2.org/packages/coreutils)
You're having an issue on a 64KiB boundary, i.e. the first byte in a 64KiB buffer is not displayed.
I strongly suspect cmd.exe is at issue here not cat, as a bug like that in cat would not go unnoticed.
Also given it works under git bash for windows, that also absolves cat.exe from coreutils.

thanks,
Pádraig