# git-push segfault

6 messages from 2010-02-24 to 2010-02-24. Participants: Dale Rowley, Jeff King, Andreas Krey.
Thread: https://gitlist.dev/t/22789

## Dale Rowley, 2010-02-24 03:46

Subject: git-push segfault
Message-ID: <loom.20100224T043557-954@post.gmane.org>
URL: https://gitlist.dev/e/loom.20100224T043557-954%40post.gmane.org

```
Steps to reproduce:

git clone /path/to/some/repo
cd repo
git config --unset branch.master.remote
git push
(seg fault)

I'm using version 1.7.0.

Dale

```

## Dale Rowley, 2010-02-24 06:02

Subject: Re: git-push segfault
Message-ID: <loom.20100224T062506-877@post.gmane.org>
URL: https://gitlist.dev/e/loom.20100224T062506-877%40post.gmane.org
In-Reply-To: <loom.20100224T043557-954@post.gmane.org>

```
Dale Rowley <ddrowley3 <at> juno.com> writes:

> git config --unset branch.master.remote
> git push

Yes, those 2 commands don't make much sense. I should have mentioned that this
was just the simplest way to reproduce the problem. My original and more
realistic scenario:

git clone /path/to/some/repo
cd repo
git remote add remote1 <url>
git remote add remote2 <url>
git config --unset branch.master.remote
git push remote1
(seg fault)

The reason for unsetting branch.master.remote was to force git to complain and
abort if I accidentally typed 'git push' instead of 'git push <remote>' (I
wanted to avoid accidentally pushing to the wrong remote repo).

Dale

```

## Jeff King, 2010-02-24 06:36

Subject: Re: git-push segfault
Message-ID: <20100224063606.GB12796@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20100224063606.GB12796%40coredump.intra.peff.net
In-Reply-To: <loom.20100224T043557-954@post.gmane.org>

```
On Wed, Feb 24, 2010 at 03:46:37AM +0000, Dale Rowley wrote:

> Steps to reproduce:
> 
> git clone /path/to/some/repo
> cd repo
> git config --unset branch.master.remote
> git push
> (seg fault)
> 
> I'm using version 1.7.0.

I can't reproduce here, using the following script:

-- >8 --
#!/bin/sh

rm -rf parent child

mkdir parent && (
  cd parent &&
  git init
) &&
git clone parent child &&
cd child &&
git config --unset branch.master.remote &&
git push
-- 8< --

Does that trigger the problem for you? If not, can you show what is
different between your earlier reproduction recipe and this one?

-Peff

```

## Andreas Krey, 2010-02-24 08:22

Subject: Re: git-push segfault
Message-ID: <20100224082214.GA31559@inner.home.ulmdo.de>
URL: https://gitlist.dev/e/20100224082214.GA31559%40inner.home.ulmdo.de
In-Reply-To: <20100224063606.GB12796@coredump.intra.peff.net>

```
On Wed, 24 Feb 2010 01:36:06 +0000, Jeff King wrote:
...
> #!/bin/sh
...
> git clone parent child &&
> cd child &&

How about 'set -xe' instead of all the &&?

Andreas

```

## Jeff King, 2010-02-24 09:23

Subject: Re: git-push segfault
Message-ID: <20100224092356.GA28959@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20100224092356.GA28959%40coredump.intra.peff.net
In-Reply-To: <20100224082214.GA31559@inner.home.ulmdo.de>

```
On Wed, Feb 24, 2010 at 09:22:14AM +0100, Andreas Krey wrote:

> On Wed, 24 Feb 2010 01:36:06 +0000, Jeff King wrote:
> ...
> > #!/bin/sh
> ...
> > git clone parent child &&
> > cd child &&
> 
> How about 'set -xe' instead of all the &&?

I long ago stopped trying to remember all of the places where "-e" works
and where it doesn't, and just use explicit "&&" (or "|| exit 1"). For
example, the subshell in my recipe needs an explicit error check under
dash, but will exit correctly using bash. I seem to recall there are
some other gotchas, but it has been a long time since I looked.

At any rate, this is not even code for inclusion in git. It is "please
cut and paste this and tell me if it breaks". So I am not too worried
about style.

-Peff

```

## Andreas Krey, 2010-02-24 10:49

Subject: Re: git-push segfault
Message-ID: <20100224104911.GA24765@inner.home.ulmdo.de>
URL: https://gitlist.dev/e/20100224104911.GA24765%40inner.home.ulmdo.de
In-Reply-To: <20100224092356.GA28959@coredump.intra.peff.net>

```
On Wed, 24 Feb 2010 04:23:57 +0000, Jeff King wrote:
> On Wed, Feb 24, 2010 at 09:22:14AM +0100, Andreas Krey wrote:
...
> > How about 'set -xe' instead of all the &&?
...
> At any rate, this is not even code for inclusion in git.

That was why I was asking. In throwaway scripts -e as well as -x is
rather practical (esp. the latter); I wouldn't use that in 'real'
scripts. Probably it's better not to set a bad example in posted
throwaway scripts, though. :-)

Andreas

```
