Using the precompiled git-annex distribution, I have encountered a problem which looks like this:
git -c foo.bar=baz annex sync
error: bogus format in GIT_CONFIG_PARAMETERS
fatal: unable to parse command-line config
git-annex: user error (git ["config","--null","--list"] exited 128)
I believe I understand what is causing this, and it's not a bug with git-annex. But I thought it would be worth reporting here in case anyone else encounters similar issues in the future.
On my system I have three different git installations:
- The one in
/usr/bin/git
etc. provided by the distribution package (version 2.28.0) - One I've compiled myself in my home directory from a recent upstream
master
, accessible via~/bin/git
(version 2.30.1.490.ge54fde04c8.dirty) - The one embedded in the git-annex bundle obtained from the above link, which I've put under
~/software/scm/git-annex.static/
(~/software/scm/git-annex.static/shimmed/git/git --version
reports version 2.30.1)
Normally ~/bin
is near the front of my $PATH
, so my hand-compiled git is used whenever I run git some-command
. If I place the following executable script at ~/bin/git-show-config-params
:
#!/bin/sh
echo "$GIT_CONFIG_PARAMETERS"
then it can be seen there's a difference between the versions in how GIT_CONFIG_PARAMETERS
is constructed:
% ~/bin/git -c foo.bar=baz show-config-params
'foo.bar'='baz'
% /usr/bin/git -c foo.bar=baz show-config-params
'foo.bar=baz'
% ~/software/scm/git-annex.static/shimmed/git/git -c foo.bar=baz show-config-params
'foo.bar=baz'
This appears to be due to commit 294e949fa from 2021-01-25 which first appeared in the tag v2.31.0-rc0
.
This commit is also required in order to successfully parse the new format:
% GIT_CONFIG_PARAMETERS="'foo.bar'='baz'" ~/software/scm/git-annex.static/shimmed/git/git branch
error: bogus format in GIT_CONFIG_PARAMETERS
fatal: unable to parse command-line config
% GIT_CONFIG_PARAMETERS="'foo.bar'='baz'" /usr/bin/git branch
error: bogus format in GIT_CONFIG_PARAMETERS
fatal: unable to parse command-line config
% GIT_CONFIG_PARAMETERS="'foo.bar'='baz'" ~/bin/git branch
git-annex
* master
synced/git-annex
synced/master
So now we can fully understand the cause: when I run
git -c foo.bar=baz annex sync
it first invokes the newer hand-compiled git with this patch, resulting in GIT_CONFIG_PARAMETERS
being set to 'foo.bar'='baz'
. That environment variable is then passed through various wrappers to ~/software/scm/git-annex.static/shimmed/git/git
, which does not know how to parse the new format, hence the bogus format
error.
The solution is to avoid using the newer development version of git as the "outer" git, since it's not backwards compatible in this respect. If the two versions were switched around, i.e. the older one setting GIT_CONFIG_PARAMETERS
and the newer parsing it, that would have worked fine, but of course that's not how the git annex
wrapper system works.
The git-annex.linux directory from the bundle does include a git, so if you put that directory in PATH first, it will avoid the problem.
This should be a fairly transient problem, since the git-annex bundle is built with the version of git from debian unstable. Once the new git version gets released, it should fairly quickly get in there and the incompatability will stop being a problem.
10.20220624-1~ndall+1
which comes withgit
2.30.2
and system-wide I have2.35.1
. Need to remember such a wisdom by heart unless may be the standalone build could somehow alert/complain into my face@yarik you're building git-annex standalone with the git from Debian stable right? If you updated it to a newer git 2.34 from backports, you would not have this problem.
Of the standalone builds of git-annex that I made, I think only the i386ancient one has an old enough git to have this problem. And probably people using that one will not have a recent version of git in the system and so won't be affected.