git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Victoria Dye <vdye@github.com>
Cc: rsbecker@nexbridge.com, 'Git Mailing List' <git@vger.kernel.org>
Subject: Re: [BUG] Non-portable Construct Introduced in diagnose.c (dirent) at v2.38.0-rc0
Date: Fri, 16 Sep 2022 17:46:19 -0700	[thread overview]
Message-ID: <xmqqtu56eskk.fsf@gitster.g> (raw)
In-Reply-To: <5d02d3b8-dc79-a2d8-f5e1-129d2228ff23@github.com> (Victoria Dye's message of "Fri, 16 Sep 2022 16:11:23 -0700")

Victoria Dye <vdye@github.com> writes:

> rsbecker@nexbridge.com wrote:
>> 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.


      parent reply	other threads:[~2022-09-17  0:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-16 23:04 [BUG] Non-portable Construct Introduced in diagnose.c (dirent) at v2.38.0-rc0 rsbecker
2022-09-16 23:11 ` Victoria Dye
2022-09-16 23:14   ` rsbecker
2022-09-17  0:46   ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqtu56eskk.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rsbecker@nexbridge.com \
    --cc=vdye@github.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).