{"thread":{"id":"46185","subject":"[BUG] git cherry-pick segfaults with local changes in working directory","startedAt":"2017-06-15T09:21:18Z","lastAt":"2017-06-15T13:03:37Z","messageCount":4,"participants":["Sebastian Dröge","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"322303","messageId":"1497517910.2239.105.camel@centricular.com","threadId":"46185","inReplyTo":null,"subject":"[BUG] git cherry-pick segfaults with local changes in working directory","fromName":"Sebastian Dröge","fromEmail":"sebastian@centricular.com","sentAt":"2017-06-15T09:11:50Z","receivedAt":"2017-06-15T09:21:18Z","isPatch":false,"sender":{"key":"sebastian@centricular.com","avatar":null},"body":"Hi,\n\nThis is with git 2.11.0 (Debian 2.11.0-4) and can be reproduced with\nthe packed checkout here:\n  https://people.freedesktop.org/~slomo/git-cherry-pick-segfault_gst-plugins-good.tar.xz\n\n$ tar xf git-cherry-pick-segfault_gst-plugins-good.tar.xz\n$ cd gst-plugins-good\n$ git cherry-pick 0421fb04470af90e8810e7e5e69955d3192896ba\nSegmentation fault (core dumped)\n\n\nWithout local changes (e.g. after \"git stash\") it works fine. Also note\nthat the commit that is cherry-picked does not contain any changes to\nfiles that have local changes.\n\n\nBacktrace below:\n\nThread 1 \"git\" received signal SIGSEGV, Segmentation fault.\nadd_index_entry_with_check (option=0, ce=0x0, istate=0x555555993900 <the_index>) at read-cache.c:1012\n1012\tread-cache.c: No such file or directory.\n(gdb) bt\n#0  add_index_entry_with_check (option=0, ce=0x0, istate=0x555555993900 <the_index>) at read-cache.c:1012\n#1  add_index_entry (istate=0x555555993900 <the_index>, ce=0x0, option=0) at read-cache.c:1061\n#2  0x0000555555646df6 in merge_content (o=o@entry=0x7fffffffd550, \n    path=path@entry=0x555555a461c0 \"docs/plugins/inspect/plugin-shout2send.xml\", o_oid=<optimized out>, \n    o_oid@entry=0x555555a42adc, o_mode=o_mode@entry=33188, a_oid=a_oid@entry=0x555555a42af4, \n    a_mode=a_mode@entry=33188, b_oid=0x555555a42b0c, b_mode=33188, rename_conflict_info=0x555555a45fa0)\n    at merge-recursive.c:1727\n#3  0x0000555555647a1d in process_entry (entry=<optimized out>, path=<optimized out>, o=0x7fffffffd550)\n    at merge-recursive.c:1885\n#4  merge_trees (o=o@entry=0x7fffffffd550, head=head@entry=0x5555559b7c98, merge=<optimized out>, \n    merge@entry=0x5555559b7c70, common=<optimized out>, common@entry=0x5555559b7cc0, \n    result=result@entry=0x7fffffffd530) at merge-recursive.c:1948\n#5  0x000055555568a248 in do_recursive_merge (opts=0x7fffffffdcc0, msgbuf=0x7fffffffd510, \n    head=0x7fffffffd620 \"\\246\\256՝s8J\\273ݵ\\241y\\303#j\\277\\211\\266\\\\\\n\\377\\177\", next_label=<optimized out>, \n    base_label=<optimized out>, next=<optimized out>, base=<optimized out>) at sequencer.c:389\n#6  do_pick_commit (command=TODO_PICK, commit=commit@entry=0x5555559a7c60, opts=opts@entry=0x7fffffffdcc0)\n    at sequencer.c:757\n#7  0x000055555568baa3 in single_pick (opts=0x7fffffffdcc0, cmit=0x5555559a7c60) at sequencer.c:1329\n#8  sequencer_pick_revisions (opts=0x7fffffffdcc0) at sequencer.c:1378\n#9  0x00005555555d34cf in run_sequencer (argc=1, argc@entry=2, argv=argv@entry=0x7fffffffe0c0, \n    opts=<optimized out>, opts@entry=0x7fffffffdcc0) at builtin/revert.c:178\n#10 0x00005555555d3928 in cmd_cherry_pick (argc=2, argv=0x7fffffffe0c0, prefix=<optimized out>)\n    at builtin/revert.c:203\n#11 0x0000555555566205 in run_builtin (argv=<optimized out>, argc=<optimized out>, p=<optimized out>)\n    at git.c:373\n#12 handle_builtin (argc=2, argv=0x7fffffffe0c0) at git.c:572\n#13 0x00005555555665a2 in run_argv (argv=0x7fffffffde60, argcp=0x7fffffffde6c) at git.c:630\n#14 cmd_main (argc=<optimized out>, argv=<optimized out>) at git.c:707\n#15 0x00005555555655d2 in main (argc=3, argv=0x7fffffffe0b8) at common-main.c:40\n\n-- \nSebastian Dröge, Centricular Ltd · http://www.centricular.com"},{"id":"322305","messageId":"20170615103215.45sp5adzu6zcorct@sigill.intra.peff.net","threadId":"46185","inReplyTo":"1497517910.2239.105.camel@centricular.com","subject":"Re: [BUG] git cherry-pick segfaults with local changes in working directory","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-15T10:32:16Z","receivedAt":"2017-06-15T10:32:23Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 15, 2017 at 12:11:50PM +0300, Sebastian Dröge wrote:\n\n> This is with git 2.11.0 (Debian 2.11.0-4) and can be reproduced with\n> the packed checkout here:\n>   https://people.freedesktop.org/~slomo/git-cherry-pick-segfault_gst-plugins-good.tar.xz\n> \n> $ tar xf git-cherry-pick-segfault_gst-plugins-good.tar.xz\n> $ cd gst-plugins-good\n> $ git cherry-pick 0421fb04470af90e8810e7e5e69955d3192896ba\n> Segmentation fault (core dumped)\n\nNote that the tarball doesn't have all the necessary objects. Its\n.git/objects/info/alternates points to another full clone of\ngit://anongit.freedesktop.org/gstreamer/gst-plugins-good.\n\nThe segfault was fixed in 55e9f0e5c (merge-recursive: handle NULL in\nadd_cacheinfo() correctly, 2016-11-26), which is in v2.11.1.\n\nCuriously, after the fix we print:\n\nerror: addinfo_cache failed for path 'docs/plugins/inspect/plugin-shout2send.xml'\n\nbut the cherry-pick succeeds anyway. I'm not sure if that's a bug or\nnot.\n\n-Peff\n"},{"id":"322308","messageId":"1497523056.2239.107.camel@centricular.com","threadId":"46185","inReplyTo":"20170615103215.45sp5adzu6zcorct@sigill.intra.peff.net","subject":"Re: [BUG] git cherry-pick segfaults with local changes in working directory","fromName":"Sebastian Dröge","fromEmail":"sebastian@centricular.com","sentAt":"2017-06-15T10:37:36Z","receivedAt":"2017-06-15T10:37:48Z","isPatch":false,"sender":{"key":"sebastian@centricular.com","avatar":null},"body":"Hi Jeff,\n\nThanks for the fast reply!\n\nOn Thu, 2017-06-15 at 06:32 -0400, Jeff King wrote:\n> On Thu, Jun 15, 2017 at 12:11:50PM +0300, Sebastian Dröge wrote:\n> \n> > This is with git 2.11.0 (Debian 2.11.0-4) and can be reproduced with\n> > the packed checkout here:\n> >   https://people.freedesktop.org/~slomo/git-cherry-pick-segfault_gst-plugins-good.tar.xz\n> > \n> > $ tar xf git-cherry-pick-segfault_gst-plugins-good.tar.xz\n> > $ cd gst-plugins-good\n> > $ git cherry-pick 0421fb04470af90e8810e7e5e69955d3192896ba\n> > Segmentation fault (core dumped)\n> \n> Note that the tarball doesn't have all the necessary objects. Its\n> .git/objects/info/alternates points to another full clone of\n> git://anongit.freedesktop.org/gstreamer/gst-plugins-good.\n\nAh good to know, I thought this only happens if you clone with\n--reference and not otherwise.\n\n> The segfault was fixed in 55e9f0e5c (merge-recursive: handle NULL in\n> add_cacheinfo() correctly, 2016-11-26), which is in v2.11.1.\n\nI can confirm that this also fixes my specific problem. Thanks!\n\n-- \nSebastian Dröge, Centricular Ltd · http://www.centricular.com"},{"id":"322319","messageId":"20170615130331.tak725h2i3fe7npw@sigill.intra.peff.net","threadId":"46185","inReplyTo":"1497523056.2239.107.camel@centricular.com","subject":"Re: [BUG] git cherry-pick segfaults with local changes in working directory","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-15T13:03:31Z","receivedAt":"2017-06-15T13:03:37Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 15, 2017 at 01:37:36PM +0300, Sebastian Dröge wrote:\n\n> > Note that the tarball doesn't have all the necessary objects. Its\n> > .git/objects/info/alternates points to another full clone of\n> > git://anongit.freedesktop.org/gstreamer/gst-plugins-good.\n> \n> Ah good to know, I thought this only happens if you clone with\n> --reference and not otherwise.\n\nIf you do a local-filesystem clone of a repository with alternates, the\nclone will have the same alternates. So I'm guessing you may have done\nsuch a clone of your --reference repository as part of preparing the\ntarball.\n\n-Peff\n"}]}