git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Thomas Rast <trast@inf.ethz.ch>
To: "Sarajärvi Tony" <Tony.Sarajarvi@digia.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Git --file doesn't override $HOME in version 1.8.1.2
Date: Tue, 9 Jul 2013 13:49:21 +0200	[thread overview]
Message-ID: <87mwpweywu.fsf@linux-k42r.v.cablecom.net> (raw)
In-Reply-To: <C8A88C530F38AE47B22BDC434090CBB0ED26E0@IT-EXMB01-HKI.it.local> ("Sarajärvi Tony"'s message of "Tue, 9 Jul 2013 11:05:46 +0000")

Sarajärvi Tony <Tony.Sarajarvi@digia.com> writes:

> 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

  reply	other threads:[~2013-07-09 11:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 11:05 Git --file doesn't override $HOME in version 1.8.1.2 Sarajärvi Tony
2013-07-09 11:49 ` Thomas Rast [this message]
2013-07-09 19:24   ` Jeff King
2013-07-09 12:00 ` Junio C Hamano
2013-07-09 12:12   ` Sarajärvi Tony

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwpweywu.fsf@linux-k42r.v.cablecom.net \
    --to=trast@inf.ethz.ch \
    --cc=Tony.Sarajarvi@digia.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).