> -----Original Message-----
> From: Junio C Hamano [mailto:gits...@pobox.com]
> Sent: 9. heinäkuuta 2013 15:01
> To: Sarajärvi Tony
> Cc: git@vger.kernel.org
> Subject: Re: Git --file doesn't override $HOME in version
> Sarajärvi Tony <tony.saraja...@digia.com> writes:
> > Using Ubuntu 13.04 with Git I stumbled upon a problem using Puppet.
> >
> > In Puppet we launch Git with the command: '/usr/bin/git config --file
> /home/qt/.gitconfig --get "user.name" "Qt Continuous Integration System"'
> Hmph.  What does this even mean?
>     git config --get user.name "Qt CIS"

Our puppet configuration is available for anyone here:

We check with 'unless' if the user.name has been set to what we expect it to 
be. The return value is different from Git if I typo the name.

root@dev-ubuntu1304-x64-01:~# git config --file /home/qt/.gitconfig --get 
user.name "Qt Continuous Integration Systed"
root@dev-ubuntu1304-x64-01:~# echo $?
root@dev-ubuntu1304-x64-01:~# git config --file /home/qt/.gitconfig --get 
user.name "Qt Continuous Integration System"
Qt Continuous Integration System
root@dev-ubuntu1304-x64-01:~# echo $?

> I have a feeling that the command will exit with an error status 1.
> > However, puppet logs: "fatal: unable to access
> > '/root/.config/git/config': Permission denied".
> >
> > Puppet is run as root, so HOME points to /root, but still -file
> > should override the environment variable.
> Probably.
> > If the same command is run directly from terminal as root, it works as well.
> I am not sure what you mean by "works as well".  It behaves
> differently and does not fail the same way?
Must have been writing something else and changed my mind :) I was trying to 
say that everything works when run from the command line. The permission denied 
appears when running with Puppet. And Puppet is run as root. And even if Puppet 
was run as some other user, I still don't think that Git should be trying to 
use anything from /root, as we're giving it the --file parameter. As if Puppet 
removed the whole --file parameter altogether. But as it works with a newer or 
older version of Git, it can't be dropping the parameter out. Root user is the 
only one with HOME set to /root, so it must be getting that value from root's 
HOME variable.

> > With the problem didn't reoccur.
> That is probably due to b1c418e1 (Merge branch
> 'jn/config-ignore-inaccessible' into maint, 2013-06-09)
> But it is puzzling.
> The "error out upon an inaccessible configuration file in usual
> places" check we had since v1.8.1.1 was meant to make sure that you
> will not be missing a basic configuration before running any command
> (including "git config" itself).  As "root", you shouldn't even have
> triggered the "unable to access: Permission denined" in the first
> place.  There is something else going on.

That is also weird, agreed.

Reply via email to