Subject: Re: [PATCH v3 5/5] submodule: error out if gitdir name is too long

From: Adrian Ratiu <[email-masked]>
Date: Tue, 21 Oct 2025 16:13:36 +0300

On Tue, 21 Oct 2025, Patrick Steinhardt <[email-masked]> wrote:
> On Mon, Oct 06, 2025 at 02:25:18PM +0300, Adrian Ratiu wrote: 
>> diff --git a/compat/posix.h b/compat/posix.h index 
>> 067a00f33b..aa050fd58c 100644 --- a/compat/posix.h +++ 
>> b/compat/posix.h @@ -250,6 +250,14 @@ char *gitdirname(char *); 
>>  #define NAME_MAX 255 #endif  
>> +#ifdef NO_PATHCONF +#ifndef _PC_NAME_MAX +#define _PC_NAME_MAX 
>> 1 /* dummy value, only used for git_pathconf */ 
> 
> Are there platforms that have pathconf(3) but not _PC_NAME_MAX? 

AFAIK no, because they're both part of POSIX and in all known 
implementations they are both defined.

> 
>> +#endif +#define pathconf(a,b) git_pathconf(a,b) +long 
>> git_pathconf(const char *path, int name); +#endif + 
>>  typedef uintmax_t timestamp_t; #define PRItime PRIuMAX #define 
>>  parse_timestamp strtoumax 
> 
> Let's adapt this to our coding guidelines to make this easier to 
> parse: 
> 
>  - Nested C preprocessor directives are indented after the hash 
>  by one 
>    space per nesting level. 
> 
> 	#if FOO # include <foo.h> # if BAR #  include <bar.h> # 
> endif #endif 

Thanks, however I'm inclining towards dropping this commit in v4 
as Junio and Peff suggested, since it doesn't add anything other 
than the nice error message, so we can let each OS fail with its 
own message like they did before this patch. 

We could bring it back when/if we decide to implement sharding /
trimming, i.e. to address the TODO in the patch, that way it's more
useful.