public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Collin Funk <collin.funk1@gmail•com>
Cc: git@vger•kernel.org,
	"Carlo Marcelo Arenas Belón" <carenas@gmail•com>,
	"Jacob Keller" <jacob.keller@gmail•com>
Subject: Re: [PATCH] cocci: do not directly access the .d_type member in struct dirent
Date: Wed, 18 Jun 2025 12:29:45 -0700	[thread overview]
Message-ID: <xmqqsejwetli.fsf@gitster.g> (raw)
In-Reply-To: <87ldposxyk.fsf@gmail.com> (Collin Funk's message of "Wed, 18 Jun 2025 11:31:47 -0700")

Collin Funk <collin.funk1@gmail•com> writes:

> Junio C Hamano <gitster@pobox•com> writes:
>
>> In "struct dirent", the presence of the .d_type member should not be
>> assumed and the code should instead use DTYPE() macro, with possibly
>> a fallback check to determine the type of the file.
>>
>> Add a rule to catch direct access to the .d_type member and use
>> DTYPE() macro instead, except in the emulation code paths that work
>> on platforms that do have the member.  This is probably not sufficient
>> to notice the lack of necessary fallback code.
>>
>> Signed-off-by: Junio C Hamano <gitster@pobox•com>
>
> This change looks good to me. Atleast it will catch code that fails to
> build on niche platforms, even if it cannot validate existing backup
> code.

I do not think it is necessarily a good idea to allow building a
binary that is known to silently misbehave, though.

> Reviewed-by: Collin Funk <collin.funk1@gmail•com>
>
> Your fix for the 'git diff --no-index' looks correct [1]. I'll build libcurl
> on an AIX machine I have access to in order to test (not an
> administrator on it).

I do not think you need libcurl if you only want to test the diff
--no-index change, but anyway, thanks.

  reply	other threads:[~2025-06-18 19:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18 17:55 [PATCH] cocci: matching (multiple) identifiers Junio C Hamano
2025-06-18 18:07 ` [PATCH] cocci: do not directly access the .d_type member in struct dirent Junio C Hamano
2025-06-18 18:31   ` Collin Funk
2025-06-18 19:29     ` Junio C Hamano [this message]
2025-06-18 19:45       ` Collin Funk

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=xmqqsejwetli.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=carenas@gmail$(echo .)com \
    --cc=collin.funk1@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=jacob.keller@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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