Thread (1 message) 1 message, 1 author, 2022-09-17

Re: [BUG] Non-portable Construct Introduced in diagnose.c (dirent) at v2.38.0-rc0

From: Junio C Hamano <hidden>
Date: 2022-09-17 00:46:26

Victoria Dye [off-list ref] writes:
rsbecker@nexbridge.com wrote:
quoted
The dirent d_type field is not available on every system. This was
introduced at 2.38.0-rc0 in diagnose.c

diagnose.c, line 79: error(1565): struct "dirent" has no field "d_type"

  		    e->d_type == DT_DIR && strlen(e->d_name) == 2 &&

(3 more issues in diagnose exist of this form).

The code should use the  NO_D_TYPE_IN_DIRENT knob to detect whether this is
an existing field as defined in cache.h.
Also, even if d_type member exists in the dirent struct, the value
can be DT_UNKNOWN and the code should be prepared to fall back to do
lstat() on the path in such a case.

dir.c::resolve_dtype() can be looked at for inspiration but only for
inspiration and not for copying (because it is about tracked working
tree paths, the function does a lot more than what diagnose.c wants
to).
Apologies for missing that, I'll try to send a patch fixing it either later
today or sometime Monday.
Thanks, both of you.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help