#541637 git-core: git push segfaults when push.default=tracking and on branch with no remote

Package:
git
Source:
git
Description:
fast, scalable, distributed revision control system
Submitter:
Nigel McNie
Date:
2015-05-08 01:39:04 UTC
Severity:
normal
#541637#5
Date:
2009-08-15 01:43:44 UTC
From:
To:
nigel@sivlex:~/work/tks$ git push
Segmentation fault
nigel@sivlex:~/work/tks$ cat .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = git+ssh://git.catalyst.net.nz/git/public/tks.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[branch "tks2"]
    remote = origin
    merge = refs/heads/tks2
[push]
    default = tracking
[branch "reporting"]
    merge = refs/heads/reporting

I got to this point after I created the 'reporting' branch. I pushed it with git push origin reporting, then the next attempt at git push told me I needed to set push.default to something. I set it to tracking, after which git push would fail with fatal: The current branch reporting is not tracking anything. Then I went into .git/config, and added just the merge line you see above for the branch, and git pushed -- segmentation fault.

#541637#10
Date:
2009-09-18 19:58:44 UTC
From:
To:
Hi, can you please check whether this is fixed with the current version
in Debian/unstable?

Thanks, Gerrit.

#541637#23
Date:
2010-08-20 04:02:16 UTC
From:
To:
Hi Nigel,

Nigel McNie wrote:
[...]
[...]

Puzzling.  The [push] default setting was not introduced until git 1.6.3.

Maybe this happened on a different machine from the one you reported the
bug on?

Unfortunately I wasn't able to reproduce it locally with git 1.7.2.2.

Still, thanks for the report,
Jonathan

#541637#28
Date:
2015-05-08 01:37:55 UTC
From:
To:
Today, that is 6 years after initial report ;)

here are the detail when running with git from current master
v2.4.0-53-g8440f74

Starting program: /home/yoh/proj/misc/git/git push origin master
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x000000000046de8d in map_refspec (ref=0x7fffffffe10a "master", remote=0x863810, local_refs=0x86c260) at builtin/push.c:63
63          if (branch->merge_nr == 1 && branch->merge[0]->src) {
(gdb) print branch
$1 = (struct branch *) 0x83dba0
(gdb) print (branch->merge_nr)
$2 = 1
(gdb) print (branch->merge[0]->src)
Cannot access memory at address 0x0
*(gdb) print (branch->merge[0])
Cannot access memory at address 0x0
*(gdb) print (branch->merge)
$3 = (struct refspec **) 0x0


when I added a remote for that (origin) branch -- push went fine.