Subject: bug#77840: [bug-diffutils] bug#77840: Testing diffutils 3.12 on PPC Mac OS X 10.4.11, Tiger, produces so many failures

From: Peter Dyballa <[email-masked]>
Date: Tue, 24 Jun 2025 12:42:29 +0200

I have one more clue: on old Tiger the changed component of curr (or filevec) holds TRUE instead of FALSE. Here are excepts from the debug sessions, side by side:

Session on PPC Mac OS X 10.4.11, Tiger, Darwin 8.11.0                           | Session on x86_64 macOS High Sierra, Version 10.13.6, Darwin 17.7.0
=====================================================                           | ===================================================================
Current directory is …/work/diffutils-3.12/src/                                 | Current directory is …/work/diffutils-3.12/src/
GNU gdb 6.3.50-20050815 (Apple version gdb-696) (Sat Oct 20 18:20:28 GMT 2007)  | GNU gdb (GDB) 14.2
Copyright 2004 Free Software Foundation, Inc.                                   | Copyright (C) 2023 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are    | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
welcome to change it and/or distribute copies of it under certain conditions.   | This is free software: you are free to change and redistribute it.
Type "show copying" to see the conditions.                                      | There is NO WARRANTY, to the extent permitted by law.
There is absolutely no warranty for GDB.  Type "show warranty" for details.     | Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin"...DISPLAY = Mac               | This GDB was configured as "x86_64-apple-darwin17.7.0".
TERM = dumb                                                                     | Type "show configuration" for configuration details.
                                                                                | For bug reporting instructions, please see:
                                                                                |   <https://www.gnu.org/software/gdb/bugs/>.
                                                                                |   Find the GDB manual and other documentation resources online at:
                                                                                |       <http://www.gnu.org/software/gdb/documentation/>.
                                                                                |
warning: --arch option not supported in this gdb.                               | For help, type "help".
Reading symbols for shared libraries ..... done                                 | Type "apropos word" to search for commands related to "word"...
                                                                                | Reading symbols from …/work/diffutils-3.12/src/diff...
Breakpoint 1 at 0xe1c8: file diff.c, line 1372.                                 | Breakpoint 1 at 0x10000ab7a: file diff.c, line 1372.
Breakpoint 2 at 0x5fa8: file analyze.c, line 463.                               | Breakpoint 2 at 0x100001c44: file analyze.c, line 463.
Breakpoint 3 at 0x6764: file analyze.c, line 578.                               | Breakpoint 3 at 0x1000022d5: file analyze.c, line 578.
Breakpoint 4 at 0xf1ac: file diff.c, line 1633.                                 | Breakpoint 4 at 0x1000098b6: file diff.c, line 1633.
Breakpoint 5 at 0x8e10: file context.c, line 349.                               | Breakpoint 5 at 0x1000057ec: file context.c, line 349.
Breakpoint 6 at 0x69f4: file analyze.c, line 624.                               | Breakpoint 6 at 0x100002527: file analyze.c, line 624.
Breakpoint 7 at 0x6a04: file analyze.c, line 628.                               | Breakpoint 7 at 0x10000253d: file analyze.c, line 628.
Breakpoint 8 at 0x82f4: file context.c, line 123.                               | Breakpoint 8 at 0x10000523e: file context.c, line 123.
Breakpoint 9 at 0x8fa8: file context.c, line 379.                               | Breakpoint 9 at 0x1000059ab: file context.c, line 379.
Breakpoint 10 at 0x222e4: file util.c, line 989.                                | Breakpoint 10 at 0x100013092: file util.c, line 989.
Breakpoint 11 at 0x2244c: file util.c, line 1028.                               | Breakpoint 11 at 0x1000131ab: file util.c, line 1028.
DISPLAY = Mac                                                                   | DISPLAY = :0
TERM = dumb                                                                     | TERM = dumb
(gdb) run                                                                       | (gdb) run
Starting program: …/work/diffutils-3.12/src/diff -a -u \                        | Starting program: …/work/diffutils-3.12/src/diff -a -u \
                Portfile-graphite2-312 Portfile-graphite2                       |               Portfile-graphite2-P312 Portfile-graphite2
                                                                                | [New Thread 0x1803 of process 55582]
                                                                                | [Thread 0x1803 of process 55582 exited]
                                                                                | [New Thread 0x1a03 of process 55582]
                                                                                | [Thread 0x1a03 of process 55582 exited]
                                                                                | [New Thread 0x1b03 of process 55582]
Reading symbols for shared libraries ..................+ done                   |
                                                                                |
Breakpoint 4, compare_files (parent=0x61000, detype=0x5e2b4, \                  | Thread 3 hit Breakpoint 4, compare_files (parent=0x100060520, detype=0x10004c164
                name0=0xbfffd8a1 "Portfile-graphite2-312", \                    |     name0=0x7ffeefbff5e9 "Portfile-graphite2-P312",
                name1=0xbfffd8b8 "Portfile-graphite2") at diff.c:1633           |     name1=0x7ffeefbff601 "Portfile-graphite2") at diff.c:1633
(gdb) n                                                                         | (gdb) n
(gdb) step                                                                      | (gdb) step
compare_prepped_files (parent=0x61000, cmp=0xbfffd218,                          | compare_prepped_files (parent=0x100060520, cmp=0x7ffeefbfed90, \
                                       open_flags=1073741824) at diff.c:1167    |                                          open_flags=16777216) at diff.c:1167
(gdb) cont                                                                      | (gdb) cont
Continuing.                                                                     | Continuing.
                                                                                |
Breakpoint 1, compare_prepped_files (parent=0x61000, \                          | Thread 3 hit Breakpoint 1, compare_prepped_files (parent=0x100060520,
                cmp=0xbfffd218, open_flags=1073741824) at diff.c:1372           |               cmp=0x7ffeefbfed90, open_flags=16777216) at diff.c:1372
(gdb) step                                                                      | (gdb) step
                                                                                |
Breakpoint 2, diff_2_files (cmp=0xbfffd218) at analyze.c:463                    | Thread 3 hit Breakpoint 2, diff_2_files (cmp=0x7ffeefbfed90) at analyze.c:463
(gdb) cont                                                                      | (gdb) cont
Continuing.                                                                     | Continuing.
                                                                                |
Breakpoint 3, diff_2_files (cmp=0xbfffd218) at analyze.c:578                    | Thread 3 hit Breakpoint 3, diff_2_files (cmp=0x7ffeefbfed90) at analyze.c:578
(gdb) step                                                                      | (gdb) step    # from 578 back to 575
                                                                                | (gdb) step                                            
build_script (filevec=0xbfffd218) at analyze.c:411                              | build_script (filevec=0x7ffeefbfed90) at analyze.c:411
(gdb) n                                                                         | (gdb) n                             
(gdb) n                                                                         | (gdb) n                             
(gdb) n                                                                         | (gdb) n                             
(gdb) n         # at line #418                                                  | (gdb) n               # at line #418
                                                                                | (gdb) n               # at line #420

So this OK for both until here, but here a difference now shows up:

(gdb) p i0                                                                      | (gdb) p i0                  
$1 = 7                                                                          | $1 = 7                              
(gdb) p i1                                                                      | (gdb) p i1                  
$2 = 7                                                                          | $2 = 7                              
(gdb) p *changed0                                                               | 
$3 = true                                                                       | 
(gdb) p *changed1                                                               | 
$4 = true                                                                       | 
(gdb) n         # at line #420                                                  | 
(gdb) n         # at line #422                                                  | 
(gdb) p changed0[6]                                                             | (gdb) p changed0[6]                 
$5 = true                                                                       | $3 = false                          
(gdb) p changed1[6]                                                             | (gdb) p changed1[6]                 
$6 = true                                                                       | $4 = false                          
(gdb) n         # at line #425                                                  | (gdb) n               # at line #433

On Tiger it's TRUE and on High Sierra it's FALSE, which is the correct value… (the "at line #xyz" comments report the line number in analyze.c to which GDB points.

I also examined the output of the C pre-processor: no difference. So some time before build_script() is called the wrong value is written into the component changed of both files' filevec or curr structs. Let's find out!

BTW, on High Sierra at first changed0[3] and changed1[3] are TRUE. At all other positions the value is FALSE.

--
Greetings

  Pete

These are my principles and if you don't like them... well, I have others.
				- Groucho Marx