From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Eric Sunshine" <sunshine@sunshineco.com>,
"Eric Wong" <normalperson@yhbt.net>,
"Karsten Blees" <karsten.blees@gmail.com>,
"Stefan Beller" <stefanbeller@gmail.com>,
"Torsten Bögershausen" <tboegi@web.de>,
"Matthieu Moy" <Matthieu.Moy@imag.fr>,
"Git List" <git@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] create_default_files(): don't set u+x bit on $GIT_DIR/config
Date: Mon, 17 Nov 2014 17:19:08 +0100 [thread overview]
Message-ID: <546A1FFC.60605@alum.mit.edu> (raw)
In-Reply-To: <xmqqbno5zvdm.fsf@gitster.dls.corp.google.com>
On 11/17/2014 04:42 PM, Junio C Hamano wrote:
> Michael Haggerty <mhagger@alum.mit.edu> writes:
>
>> This seems like a one-off bug caused by a specific instance of odd code.
>> It could only recur if somebody were to remove the line that I added,
>> which would be a *very* odd mistake to make given that its purpose is
>> pretty obvious.
>
> Or some other code that comes _after_ your new code touches the
> file.
>
> You cannot anticipate what mistake others make.
And yet we do so all the time, adding tests for the things we consider
most likely to break in the future and omitting them for breakages that
seem unlikely. Otherwise, what frees us from the obligation to add a '!
test -x "$GIT_DIR/config"' following every single git operation?
But it's OK with me, we can add a test.
> Shouldn't something like this be sufficient?
>
> t/t0001-init.sh | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> index e62c0ff..acdc1df 100755
> --- a/t/t0001-init.sh
> +++ b/t/t0001-init.sh
> @@ -12,6 +12,13 @@ check_config () {
> echo "expected a directory $1, a file $1/config and $1/refs"
> return 1
> fi
> +
> + if ! test_have_prereq POSIXPERM || test -x "$1/config"
> + then
> + echo "$1/config is executable?"
> + return 1
> + fi
> +
> bare=$(cd "$1" && git config --bool core.bare)
> worktree=$(cd "$1" && git config core.worktree) ||
> worktree=unset
>
I think the logic should be
if test_have_prereq POSIXPERM && test -x "$1/config"
, right? If the system doesn't have POSIXPERM, then aren't all bets off
regarding file permissions?
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
next prev parent reply other threads:[~2014-11-17 16:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-16 7:21 [PATCH v2 0/2] Don't make $GIT_DIR executable Michael Haggerty
2014-11-16 7:21 ` [PATCH v2 1/2] create_default_files(): don't set u+x bit on $GIT_DIR/config Michael Haggerty
2014-11-16 19:08 ` Junio C Hamano
2014-11-17 9:35 ` Michael Haggerty
2014-11-17 1:40 ` Eric Sunshine
2014-11-17 9:08 ` Torsten Bögershausen
2014-11-17 11:32 ` Michael Haggerty
2014-11-17 9:46 ` Michael Haggerty
2014-11-17 15:42 ` Junio C Hamano
2014-11-17 16:19 ` Michael Haggerty [this message]
2014-11-17 16:43 ` Junio C Hamano
2014-11-16 7:21 ` [PATCH v2 2/2] config: clear the executable bits (if any) " Michael Haggerty
2014-11-16 8:06 ` Johannes Sixt
2014-11-17 9:03 ` Michael Haggerty
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=546A1FFC.60605@alum.mit.edu \
--to=mhagger@alum.mit.edu \
--cc=Matthieu.Moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=karsten.blees@gmail.com \
--cc=normalperson@yhbt.net \
--cc=stefanbeller@gmail.com \
--cc=sunshine@sunshineco.com \
--cc=tboegi@web.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).