On 2026-11-19 10:34, Brian Inglis wrote:
I could post the full redacted output, or send the unredacted output to your PM, if it would help.
Thanks, but I think the strace output suffices. The key lines are here:
17000745 50756044 [main] diff 3042635 fhandler_base::read: returning -1814967408, binary mode 190 50756234 [main] diff 3042635 read: 2479999888 = read(4, 0x6FFAD85B0010, -1814967408) 114 50756348 [main] diff 3042635 read: read(4, 0x6FFB6C2CCBA0, 0) blocking 120 50756468 [main] diff 3042635 fhandler_base::read: returning 0, binary mode 107 50756575 [main] diff 3042635 read: 0 = read(4, 0x6FFB6C2CCBA0, 0) The first two lines says diff called read (4, buf, N) which returned, where N was 2479999888, but strace misinterpreted the 2479999888 as being -1814967408. The last three lines suggest that diff called read (4, buf, N) where N was a multiple of 2**32, and strace got confused into thinking that N == 0, and so did 'read' itself (!). I filed a bug report against Cygwin <https://cygwin.com/pipermail/cygwin/2026-November/260246.html> and installed the attached workaround to diffutils; please give the workaround a try.
From 39b8459c459fc68e80d1dbce2a9f78d89a9a4dd8 Mon Sep 17 00:00:00 2001 From: Paul Eggert <[email protected]> Date: Thu, 19 Nov 2026 16:25:14 -0800 Subject: [PATCH] diff: work around Cygwin bug with big buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem reported by Brian Inglish (bug#882273). * lib/cmpbuf.c (block_read): Don’t ask Cygwin to read more than SYS_BUFSIZE_MAX bytes at a time. --- lib/cmpbuf.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/cmpbuf.c b/lib/cmpbuf.c index d3739b6..f1a0d76 100644 --- a/lib/cmpbuf.c +++ b/lib/cmpbuf.c @@ -43,6 +43,12 @@ block_read (int fd, char *buf, idx_t nbytes) char *bp = buf; char const *buflim = buf + nbytes; idx_t readlim = MIN (IDX_MAX, MIN (SSIZE_MAX, SIZE_MAX)); +#ifdef __CYGWIN__ + /* Cygwin incorrectly truncates read sizes modulo 2**32, and + MS-Windows drivers and Cygwin internals are likely to flake out + above SYS_BUFSIZE_MAX anyway. */ + readlim = MIN (readlim, SYS_BUFSIZE_MAX); +#endif do { @@ -54,9 +60,9 @@ block_read (int fd, char *buf, idx_t nbytes) if (nread == 0) break; - /* Accommodate FreeBSD 13, which can't read more than INT_MAX bytes - when debug.iosize_max_clamp is nonzero. Prefer a power - of two for the read limit in this case. + /* Accommodate macOS, which can't read more than INT_MAX bytes. + FreeBSD behaves similarly if debug.iosize_max_clamp is nonzero. + Prefer a power of two for the read limit in this case. Also, work around a bug in Linux kernel 6.3.8 tmpfs, which fails if the current offset + bytes_to_read exceeds -- 2.56.1
