On 2026-11-18 22:19, Paul Eggert wrote:
On 2026-11-18 09:20, Brian Inglis wrote:
yes "01234567890123456789012345" | head -n 410000000 > test1
cp test1 test2
echo "A" >> test1
echo "B" >> test2

diff -q test1 test2
echo "diff exit: $?"   # Outputs 0 (incorrect; expected 1)

I can't reproduce this problem on Fedora 45 x86-64, unfortunately. With either the stock diff 3.12, or with bleeding-edge source.

Is there some Cygwin equivalent of "strace -o /tmp/tr diff -q test1 test2" that you can try, to see what the syscalls are doing?

Thanks Paul,

Ran the `diff -u` strace of all operations, with all outputs enabled, and extracted the portion from open to close of diff operating on test files that shows the continuous POSIX emulation layer view, with no redactions:

$ wc -lwmcL diffutils-3.12-1-2-strace.*
  1388  14438 174003 174003   1905 diffutils-3.12-1-2-strace.out
   103   1095  10124  10124    305 diffutils-3.12-1-2-strace.txt
  1491  15533 184127 184127   1905 total

This shows the opens, stats, mmaps, closes: you will have to infer the program operations performed between the syscalls.

You could either post, or just PM me, about any Cygwin strace output details?

The mmaps map arenas separated by the file size 11'070'000'002B (410'000'001 lines) rounded up to 64KB 0x10000 boundaries, the Cygwin emulation memory granularity "page size" == 16 pages:

$ printf '%#0d\n' $((0x6ffd6c2d0000-0x6ffad85a0000))
11070013440

The rest of the strace output elided is all the emulation setup and translation from Cygwin to MS Windows, plus process shutdown; this extract shows the open and close operations under the emulated Cygwin root \usr\local\cygwin64\, in the standard package source maintenance directory /usr/src/diffutils/.

I could post the full redacted output, or send the unredacted output to your PM, if it would help.

Reference output:

$ cmp -b test1 test2
# test1 test2 differ: byte 11070000001, line 410000001 is 101 A 102 B

[OMG octal output still 60 years after the IBM 360 and 55 after the PDP-11!
I got pissed when DEC kept octal output default on the PDP-11 and even VAX-11
- for 11 octal digit words? :-/
Was okay on earlier multiple of 6 bit word machines from IBM and the BUNCH.]

--
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
                                -- Antoine de Saint-Exupéry
  327  422361 [main] diff 3042635 open: open(/usr/src/diffutils/test1, 0x40000)
  110  422471 [main] diff 3042635 normalize_posix_path: src 
/usr/src/diffutils/test1
  104  422575 [main] diff 3042635 normalize_posix_path: 
/usr/src/diffutils/test1 = normalize_posix_path (/usr/src/diffutils/test1)
  107  422682 [main] diff 3042635 mount_info::conv_to_win32_path: 
conv_to_win32_path (/usr/src/diffutils/test1)
  111  422793 [main] diff 3042635 mount_info::conv_to_win32_path: src_path 
/usr/src/diffutils/test1, dst C:\usr\local\cygwin64\usr\src\diffutils\test1, 
flags 0x30008, rc 0
  224  423017 [main] diff 3042635 symlink_info::check: 0x0 = NtCreateFile 
(\??\C:\usr\local\cygwin64\usr\src\diffutils\test1)
  596  423613 [main] diff 3042635 symlink_info::check: not a symlink
  267  423880 [main] diff 3042635 symlink_info::check: 0 = 
symlink.check(C:\usr\local\cygwin64\usr\src\diffutils\test1, 0x7FFFFB340) 
(mount_flags 0x30008, path_flags 0x0)
  108  423988 [main] diff 3042635 path_conv::check: 
this->path(C:\usr\local\cygwin64\usr\src\diffutils\test1), has_acls(1)
  112  424100 [main] diff 3042635 build_fh_pc: fh 0x800009ED0, dev 000000C3
  143  424243 [main] diff 3042635 fhandler_base::open: 
(\??\C:\usr\local\cygwin64\usr\src\diffutils\test1, 0x40000)
  250  424493 [main] diff 3042635 fhandler_base::set_flags: flags 0x40000, 
supplied_bin 0x10000
  119  424612 [main] diff 3042635 fhandler_base::set_flags: filemode set to 
binary
  104  424716 [main] diff 3042635 fhandler_base::open: 0x0 = NtCreateFile 
(0x294, 0x80100000, \??\C:\usr\local\cygwin64\usr\src\diffutils\test1, io, 
NULL, 0x0, 0x7, 0x1, 0x4020, NULL, 0)
  167  424883 [main] diff 3042635 fhandler_base::open: 1 = 
fhandler_base::open(\??\C:\usr\local\cygwin64\usr\src\diffutils\test1, 0x40000)
  166  425049 [main] diff 3042635 fhandler_base::open_fs: 1 = 
fhandler_disk_file::open(\??\C:\usr\local\cygwin64\usr\src\diffutils\test1, 
0x40000)
  161  425210 [main] diff 3042635 open: 3 = open(/usr/src/diffutils/test1, 
0x40000)
  328  425538 [main] diff 3042635 fhandler_base::fstat_helper: 0 = fstat 
(\??\C:\usr\local\cygwin64\usr\src\diffutils\test1, 0x7FFFFC8A0) 
st_size=11070000002, st_mode=0100644, 
st_ino=7036874427478428st_atim=6AFF245D.A7BF2A0 st_ctim=6AFF22F4.372B95E4 
st_mtim=6AFF22F4.372B95E4 st_birthtim=6AFF2131.364A2D34
  163  425701 [main] diff 3042635 fstat: 0 = fstat(3, 0x7FFFFC8A0)
  111  425812 [main] diff 3042635 open: open(/usr/src/diffutils/test2, 0x40000)
  103  425915 [main] diff 3042635 normalize_posix_path: src 
/usr/src/diffutils/test2
  117  426032 [main] diff 3042635 normalize_posix_path: 
/usr/src/diffutils/test2 = normalize_posix_path (/usr/src/diffutils/test2)
  110  426142 [main] diff 3042635 mount_info::conv_to_win32_path: 
conv_to_win32_path (/usr/src/diffutils/test2)
  112  426254 [main] diff 3042635 mount_info::conv_to_win32_path: src_path 
/usr/src/diffutils/test2, dst C:\usr\local\cygwin64\usr\src\diffutils\test2, 
flags 0x30008, rc 0
  163  426417 [main] diff 3042635 symlink_info::check: 0x0 = NtCreateFile 
(\??\C:\usr\local\cygwin64\usr\src\diffutils\test2)
  518  426935 [main] diff 3042635 symlink_info::check: not a symlink
  275  427210 [main] diff 3042635 symlink_info::check: 0 = 
symlink.check(C:\usr\local\cygwin64\usr\src\diffutils\test2, 0x7FFFFB340) 
(mount_flags 0x30008, path_flags 0x0)
  116  427326 [main] diff 3042635 path_conv::check: 
this->path(C:\usr\local\cygwin64\usr\src\diffutils\test2), has_acls(1)
  123  427449 [main] diff 3042635 build_fh_pc: fh 0x80001BF70, dev 000000C3
  141  427590 [main] diff 3042635 fhandler_base::open: 
(\??\C:\usr\local\cygwin64\usr\src\diffutils\test2, 0x40000)
  222  427812 [main] diff 3042635 fhandler_base::set_flags: flags 0x40000, 
supplied_bin 0x10000
  104  427916 [main] diff 3042635 fhandler_base::set_flags: filemode set to 
binary
  103  428019 [main] diff 3042635 fhandler_base::open: 0x0 = NtCreateFile 
(0x324, 0x80100000, \??\C:\usr\local\cygwin64\usr\src\diffutils\test2, io, 
NULL, 0x0, 0x7, 0x1, 0x4020, NULL, 0)
  160  428179 [main] diff 3042635 fhandler_base::open: 1 = 
fhandler_base::open(\??\C:\usr\local\cygwin64\usr\src\diffutils\test2, 0x40000)
  161  428340 [main] diff 3042635 fhandler_base::open_fs: 1 = 
fhandler_disk_file::open(\??\C:\usr\local\cygwin64\usr\src\diffutils\test2, 
0x40000)
  160  428500 [main] diff 3042635 open: 4 = open(/usr/src/diffutils/test2, 
0x40000)
  320  428820 [main] diff 3042635 fhandler_base::fstat_helper: 0 = fstat 
(\??\C:\usr\local\cygwin64\usr\src\diffutils\test2, 0x7FFFFC9D8) 
st_size=11070000002, st_mode=0100644, 
st_ino=8444249311031710st_atim=6AFF245D.A7BF2A0 st_ctim=6AFF22F4.372B95E4 
st_mtim=6AFF22F4.372B95E4 st_birthtim=6AFF2132.1FB3BF4
  163  428983 [main] diff 3042635 fstat: 0 = fstat(4, 0x7FFFFC9D8)
  212  429195 [main] diff 3042635 fhandler_base::set_flags: flags 0x50000, 
supplied_bin 0x0
  102  429297 [main] diff 3042635 fhandler_base::set_flags: O_TEXT/O_BINARY set 
in flags 0x10000
  101  429398 [main] diff 3042635 fhandler_base::set_flags: filemode set to 
binary
  114  429512 [main] diff 3042635 _setmode: 
(3<\??\C:\usr\local\cygwin64\usr\src\diffutils\test1>, 0x700010000) returning 
binary
  172  429684 [main] diff 3042635 _cygwin_istext_for_stdio: fd 3: opened as 
binary
 1124  430808 [main] diff 3042635 setmode_helper: improbable, but 0 != 3
 1028  431836 [main] diff 3042635 setmode_helper: improbable, but 1 != 3
 1031  432867 [main] diff 3042635 setmode_helper: improbable, but 2 != 3
  109  432976 [main] diff 3042635 read: read(3, 0xA0003A420, 65536) blocking
27264  460240 [main] diff 3042635 fhandler_base::read: returning 65536, binary 
mode
  194  460434 [main] diff 3042635 read: 65536 = read(3, 0xA0003A420, 65536)
  319  460753 [main] diff 3042635 fhandler_base::set_flags: flags 0x50000, 
supplied_bin 0x0
  274  461027 [main] diff 3042635 fhandler_base::set_flags: O_TEXT/O_BINARY set 
in flags 0x10000
  136  461163 [main] diff 3042635 fhandler_base::set_flags: filemode set to 
binary
  113  461276 [main] diff 3042635 _setmode: 
(4<\??\C:\usr\local\cygwin64\usr\src\diffutils\test2>, 0x10000) returning binary
  182  461458 [main] diff 3042635 _cygwin_istext_for_stdio: fd 4: opened as 
binary
  919  462377 [main] diff 3042635 setmode_helper: improbable, but 0 != 4
 1061  463438 [main] diff 3042635 setmode_helper: improbable, but 1 != 4
  969  464407 [main] diff 3042635 setmode_helper: improbable, but 2 != 4
  159  464566 [main] diff 3042635 read: read(4, 0xA0004A430, 65536) blocking
82446  547012 [main] diff 3042635 fhandler_base::read: returning 65536, binary 
mode
  179  547191 [main] diff 3042635 read: 65536 = read(4, 0xA0004A430, 65536)
  166  547357 [main] diff 3042635 mmap: addr 0x0, len 11070013440, prot 0x3, 
flags 0x22, fd -1, off 0x0
142356  689713 [main] diff 3042635 mmap: 0x6FFD6C2D0000 = mmap() 
  647  690360 [main] diff 3042635 read: read(3, 0x6FFD6C2E0010, -1814967408) 
blocking
22514840 23205200 [main] diff 3042635 fhandler_base::read: returning 
-1814967408, binary mode
  195 23205395 [main] diff 3042635 read: 2479999888 = read(3, 0x6FFD6C2E0010, 
-1814967408)
  114 23205509 [main] diff 3042635 read: read(3, 0x6FFDFFFFCBA0, 0) blocking
  121 23205630 [main] diff 3042635 fhandler_base::read: returning 0, binary mode
  109 23205739 [main] diff 3042635 read: 0 = read(3, 0x6FFDFFFFCBA0, 0)
  115 23205854 [main] diff 3042635 mmap: addr 0x0, len 11070013440, prot 0x3, 
flags 0x22, fd -1, off 0x0
136910 23342764 [main] diff 3042635 mmap: 0x6FFAD85A0000 = mmap() 
  489 23343253 [main] diff 3042635 read: read(4, 0x6FFAD85B0010, -1814967408) 
blocking
--- Process 3328 (pid: 3042635) thread 8844 created
--- Process 3328 (pid: 3042635) thread 8928 created
10178801 33522054 [sig] diff 3042635 talktome: pid 1410255 wants some 
information
  199 33522253 [sig] diff 3042635 open_shared: name cygpid.1410255, shared 
0x1A0040000 (wanted 0x1A0040000), h 0x344, m 6, created 0
--- Process 3328 (pid: 3042635) thread 14260 created
  706 33522959 [commune] diff 3042635 cygthread::stub: thread 'commune', id 
0x37B4, stack_ptr 0x325CCB0
  818 33523777 [commune] diff 3042635 commune_process: processing PICOM_CMDLINE
  191 33523968 [commune] diff 3042635 commune_process: synchronized with pid 
1410255
229821 33753789 [sig] diff 3042635 talktome: pid 1410255 wants some information
  219 33754008 [sig] diff 3042635 open_shared: name cygpid.1410255, shared 
0x1A0050000 (wanted 0x1A0050000), h 0x340, m 6, created 0
  465 33754473 [commune] diff 3042635 commune_process: processing PICOM_SIGINFO
  124 33754597 [commune] diff 3042635 sig_send: sendsig 0x180, pid 3042635, 
signal -76, its_me 1
  145 33754742 [commune] diff 3042635 sig_send: wakeup 0x340
  141 33754883 [commune] diff 3042635 sig_send: Waiting for pack.wakeup 0x340
  112 33754995 [sig] diff 3042635 wait_sig: signalling pack.wakeup 0x340
  160 33755155 [commune] diff 3042635 sig_send: returning 0x0 from sending 
signal -76
  144 33755299 [commune] diff 3042635 commune_process: synchronized with pid 
1410255
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)
2160552 52917127 [main] diff 3042635 munmap: munmap (addr 0x6FFD6C2D0000, len 
11070013440)
1213324 54130451 [main] diff 3042635 munmap: 0 = munmap(): 0x6FFD6C2D0000
  442 54130893 [main] diff 3042635 munmap: munmap (addr 0x6FFAD85A0000, len 
11070013440)
1187452 55318345 [main] diff 3042635 munmap: 0 = munmap(): 0x6FFAD85A0000
  356 55318701 [main] diff 3042635 close: close(3)
  151 55318852 [main] diff 3042635 fhandler_base::close: closing 
'/usr/src/diffutils/test1' handle 0x294
  167 55319019 [main] diff 3042635 close: 0 = close(3)
  111 55319130 [main] diff 3042635 close: close(4)
  115 55319245 [main] diff 3042635 fhandler_base::close: closing 
'/usr/src/diffutils/test2' handle 0x324
  133 55319378 [main] diff 3042635 close: 0 = close(4)

Reply via email to