git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git --file doesn't override $HOME in version 1.8.1.2

From
Thomas Rast <trast@inf.ethz.ch>
Date
Jul 9, 2013, 11:49 UTC
Message-ID
<87mwpweywu.fsf@linux-k42r.v.cablecom.net>
In-Reply-To
<C8A88C530F38AE47B22BDC434090CBB0ED26E0@IT-EXMB01-HKI.it.local>
Sarajärvi Tony <Tony.Sarajarvi@digia.com> writes:
Show 10 quoted lines
> Using Ubuntu 13.04 with Git 1.8.1.2 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"'
> 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.
>
> If the same command is run directly from terminal as root, it works as well.

To elaborate (I briefly talked to Sarajärvi on IRC): this isn't about the fatal error; we downgraded this to a nonfatal error in 4698c8f (config: allow inaccessible configuration under $HOME, 2013-04-12).

Rather, it's very strange that 'git config --file foo' tries to look at any config file other than 'foo'. In a git repo:

  $ strace git config --file fooconfig test.var 2>&1 | grep 'open.*config'
  open("/home/thomas/.gitconfig", O_RDONLY) = 3
  open(".git/config", O_RDONLY)           = 3
  open("/home/thomas/.gitconfig", O_RDONLY) = 3
  open(".git/config", O_RDONLY)           = 3
  open("fooconfig", O_RDONLY)             = 3

I haven't looked into the code yet. Probably it's simply following the usual code paths to discover a repo and read its config. However, with the --file option, it shouldn't.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Sarajärvi TonyNext: Jeff King
Message 2 of 5 in “Git --file doesn't override $HOME in version 1.8.1.2”
  1. Sarajärvi TonyJul 9, 2013
  2. Thomas RastJul 9, 2013
  3. Jeff KingJul 9, 2013
  4. Junio C HamanoJul 9, 2013
  5. Sarajärvi TonyJul 9, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.