git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Word <argoday@argoday.com>,
	Markus Hitter <mah@jump-ing.de>,
	git@vger.kernel.org, jword@bloomberg.net
Subject: Re: Bug: git config does not respect read-only .gitconfig file
Date: Tue, 8 Nov 2016 22:34:41 -0500	[thread overview]
Message-ID: <20161109033441.hp4eyf5qahimrtr3@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqk2cdbg5v.fsf@gitster.mtv.corp.google.com>

On Tue, Nov 08, 2016 at 05:22:52PM -0800, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > Probably converting "rename(from, to)" to first check "access(to,
> > W_OK)". That's racy, but it's the best we could do.
> 
> Hmph, if these (possibly problematic) callers are all following the
> usual "lock, write to temp, rename" pattern, perhaps the lock_file()
> function can have access(path, W_OK) check before it returns a
> tempfile that has been successfully opened?

Yeah, that is a lot friendlier, as it prevents the caller from doing
work (which may even involve the user typing things!) when it is clear
that we would fail the final step anyway.

-Peff

  reply	other threads:[~2016-11-09  3:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-08 15:22 Bug: git config does not respect read-only .gitconfig file Jonathan Word
2016-11-08 16:49 ` Markus Hitter
2016-11-08 17:18   ` Jonathan Word
2016-11-08 20:01     ` Jeff King
2016-11-09  1:22       ` Junio C Hamano
2016-11-09  3:34         ` Jeff King [this message]
2016-11-09 13:51         ` Jonathan Word

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

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

  git send-email \
    --in-reply-to=20161109033441.hp4eyf5qahimrtr3@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=argoday@argoday.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jword@bloomberg.net \
    --cc=mah@jump-ing.de \
    /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.
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 NNTP newsgroup(s).