[PATCH 2 of 2 stable v2] tests: prevent Git system and global configuration from loading

Manuel Jacob me at manueljacob.de
Wed Apr 19 20:29:24 UTC 2023


On 19/04/2023 19.12, Mads Kiilerich wrote:
> On 19/04/2023 17:27, Manuel Jacob wrote:
>> On 19/04/2023 17.21, Manuel Jacob wrote:
>>> On Arch Linux:
>>>
>>> % git --version
>>> git version 2.40.0
>>> % GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null 
>>> EMAIL='foo at bar' git commit -m "committed new 0" --author "User ǝɯɐᴎ 
>>> <me at example.com>"
>>> Committer identity unknown
>>>
> 
>>> On CentOS 7:
>>>
>>> % git --version
>>> git version 2.36.5
>>> % GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null 
>>> EMAIL='foo at bar' git commit -m "committed new 0" --author "User ǝɯɐᴎ 
>>> <me at example.com>"
>>> Committer identity unknown
>>>
> 
>>> But with openSUSE Leap 15.4 with git 2.35.3, it works (uses $USER as 
>>> the name).
>>
>> Same on openSUSE Tumbleweed with git 2.40.0.
> 
> 
> 
> That's interesting obvervations - thanks. It seems like we are far from 
> a full understanding the problem we are trying to fix. There seems to be 
> a high risk that we make more assumptions that will be invalid on some 
> systems.
> 
> I verified that it works as I expect on my Fedora 38 system, both with 
> the system git 2.40.0 and with a git build from 
> https://github.com/git/git/ source . I don't really have access to other 
> systems.
> 
> It could be somewhat interesting if you could try to build git from 
> source on your failing systems. It could give a hint if it is some kind 
> of distro patching or build configuration that makes a difference. Or if 
> it is controlled by some other unknown factor.

Git infers the default user name from struct passwd’s pw_gecos 
attribute. That one happened to be empty for the users on the systems on 
which Git couldn’t infer a non-empty default user name.

> It could also be interesting to ask some git experts if they could 
> explain why for example 2.40.0 on Arch and openSUSE respond differently 
> - that is really a question of reliable scripting of git and has nothing 
> to do with Kallithea.
> 
> The code in https://github.com/git/git/blob/main/ident.c has many small 
> steps and it is not obvious what could make it behave differently.

Yes, the code is complex. I stepped through it with a debugger before to 
find out what’s happening. Then I decided that the inference is too 
complex and system-dependent and we should not let it get that far. 
That’s why I sent the patch setting everything uniformly via environment 
variables.

Although at some point I decided (for me) that digging into the details 
of the inference algorithm too much is not worth it to solve the 
problem, the approach chosen in this patch series was a deliberate 
choice insteads of trying around until it works (I’m just clarifying 
this in case you got a different perception).

I’ll resend the patch series with improved changeset descriptions and 
comments, to hopefully be clearer and less confusing.

> /Mads
> 
> 



More information about the kallithea-general mailing list