@@ -25,9 +25,63 @@ This edition covers what happened during the months of September and October 202
2525### Reviews
2626-->
2727
28- <!-- -
28+
2929### Support
30- -->
30+
31+ + [[ Change
] Git build issue on NonStop
] ( https://lore.kernel.org/git/[email protected] / ) 32+
33+ Randall S. Becker reported on the mailing list that CI tests on the
34+ NonStop x86 platform were broken after the ` uintptr_t ` type started
35+ to be used in [ clar] ( https://github.com/clar-test/clar ) tests when
36+ displaying error messages in test failures (when pointer comparisons
37+ fail).
38+
39+ Peff, alias Jeff King, replied to Randall that ` uintptr_t ` was
40+ already used in many places in the regular code, and guessed the
41+ issue might come from how clar defined that type. He noted though
42+ that the line in the clar test where ` uintptr_t ` appeared also
43+ contained ` PRIxPTR ` which is a macro that is not used in the regular
44+ code. So he wondered if just replacing that macro with ` PRIuMAX `
45+ (which is often used) would be enough to fix the issue.
46+
47+ ` PRIxPTR ` , ` PRIuMAX ` and similar macros are format specifier macros
48+ from the C standard library (defined in ` <inttypes.h> ` ) that provide
49+ portable ways to print integer types using functions like ` printf() `
50+ across different platforms. They are all named in the same way, with
51+ ` PRI ` meaning ` printf ` , the next letter indicating the format, like
52+ ` x ` for hexadecimal and ` u ` for unsigned decimal, and the last part
53+ indicating the type, like ` PTR ` for pointer-sized integers, ` MAX `
54+ for maximum-width integers, ` 64 ` for 64-bit, etc.
55+
56+ Randall replied to Peff that replacing ` PRIxPTR ` with ` PRIuMAX `
57+ would work, and that he was going to try it.
58+
59+ Patrick Steinhardt also replied to Randall and Peff saying it would
60+ work, and asked Peff if he wanted to send that change.
61+
62+ Peff replied to Patrick that he'd be happy if Patrick sent the
63+ change, but noted that using ` PRIxMAX ` might be better than
64+ ` PRIuMAX ` as the code wanted to print hexadecimal values.
65+
66+ Patrick then reported to Peff that Peff's suggestion to use the
67+ ` PRIxMAX ` or ` PRIuMAX ` format specifier macros didn't work on 32 bit
68+ systems, because casting a pointer to an integer of different size
69+ (the pointer is 32 bits, but ` uintmax_t ` is 64 bits) fails.
70+
71+ Patrick proposed using ` %p ` as a format specifier saying it might be
72+ a better trade-off. The downside was that the output format would be
73+ unpredictable across platforms as ` %p ` doesn't have a standardized
74+ output format. So tests that validated the exact error message
75+ format would have to be dropped. But at least ` %p ` would work
76+ everywhere and produce stable output.
77+
78+ Junio Hamano, the Git maintainer, agreed with Patrick that ` %p ` was
79+ "the most appropriate solution".
80+
81+ Randall then confirmed that ` %p ` worked on NonStop x86 even if the
82+ man pages warned to the contrary.
83+
84+ The ` %p ` solution was eventually merged to the 'master' branch.
3185
3286<!-- -
3387## Developer Spotlight:
0 commit comments