{"thread":{"id":"53331","subject":"git-rebase v2.26.2 - \"--root --empty drop\" doesn't work and \"--root --fork-point $somegibberish\" gets SIGSEGV","startedAt":"2020-04-27T12:28:27Z","lastAt":"2020-04-27T15:46:21Z","messageCount":2,"participants":["Berg, Alexander","Elijah Newren"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"396330","messageId":"3910b39cf7c7419eb5b87c7aeb871e11@atos.net","threadId":"53331","inReplyTo":null,"subject":"git-rebase v2.26.2 - \"--root --empty drop\" doesn't work and \"--root --fork-point $somegibberish\" gets SIGSEGV","fromName":"Berg, Alexander","fromEmail":"alexander.berg@atos.net","sentAt":"2020-04-27T12:20:52Z","receivedAt":"2020-04-27T12:28:27Z","isPatch":false,"sender":{"key":"alexander.berg@atos.net","avatar":null},"body":"Dear *,\n\nAFAIS there are (at least) two bugs in git-rebase at the moment.\nThose findings below occured on a simple branch, without an upstream.\n\nIf you wish to rebase history and drop all empty commits, e.g.\n    git rebase --root --empty drop\nthose empty commits are still in place after the operation comletes.\nWith git v2.14.xx this operation (\"--drop-empty\") drops those empty\ncommits as expected.\nIs there a new option to be used here or something?\nOr is it just broken?\n\n\nAs I've experimented with some new options for the above command,\nit seems that user input checking isn't done properly for \"--fork-point\".\nI've tried\n    git rebase --root --empty drop --fork-point --rebase-merges\n(yes, --fork-point usage is wrong here) and got\n    Segmentation fault (core dumped)\n\nA colleague of mine looked into this:\n    $ gdb /bin/git                                                                                                                                         \n    (gdb) set args rebase --root --empty drop --fork-point --rebase-merges\n    (gdb) run                                                                                                                                              \n    Starting program: /bin/git rebase --root --empty drop --fork-point --rebase-merges                                                                     \n    [Thread debugging using libthread_db enabled]                                                                                                          \n    Using host libthread_db library \"/lib64/libthread_db.so.1\".                                                                                            \n                                                                                                                                                           \n    Program received signal SIGSEGV, Segmentation fault.                                                                                                   \n    is_per_worktree_ref (refname=0x0) at refs.c:725                                                                                                        \n    725                     starts_with(refname, \"refs/bisect/\") ||                                                                                        \n    Missing separate debuginfos, use: debuginfo-install glibc-2.17-292.el7.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-18.el7.x86_64                         \n    (gdb) bt                                                                                                                                               \n    #0  is_per_worktree_ref (refname=0x0) at refs.c:725                                                                                                    \n    #1  ref_type (refname=refname@entry=0x0) at refs.c:760                                                                                                 \n    #2  0x00000000005739c9 in files_reflog_path (refs=0x90ce30, sb=0x7fffffffc5e0, refname=0x0) at refs/files-backend.c:176                                \n    #3  0x000000000057402a in files_for_each_reflog_ent (ref_store=<optimized out>, refname=0x0, fn=0x4d4d20 <collect_one_reflog_ent>, cb_data=0x7fffffffc640)\n        at refs/files-backend.c:2060                                                                                                                       \n    #4  0x00000000004d4f4b in get_fork_point (refname=0x0, commit=0x91cff0) at commit.c:933                                                                \n    #5  0x0000000000475e69 in cmd_rebase (argc=0, argv=0x7fffffffdd20, prefix=<optimized out>) at builtin/rebase.c:2082                                    \n    #6  0x0000000000406cd0 in run_builtin (argv=0x7fffffffdd20, argc=6, p=0x8b3f40 <commands+2016>) at git.c:444                                           \n    #7  handle_builtin (argc=6, argv=argv@entry=0x7fffffffdd20) at git.c:674                                                                               \n    #8  0x0000000000407bee in run_argv (argv=0x7fffffffda80, argcp=0x7fffffffda8c) at git.c:741                                                            \n    #9  cmd_main (argc=6, argc@entry=7, argv=0x7fffffffdd20, argv@entry=0x7fffffffdd18) at git.c:872                                                       \n    #10 0x0000000000406910 in main (argc=7, argv=0x7fffffffdd18) at common-main.c:52                                                                       \n    (gdb) list                                                                                                                                             \n    720                                                                                                                                                    \n    721     static int is_per_worktree_ref(const char *refname)                                                                                            \n    722     {                                                                                                                                              \n    723             return !strcmp(refname, \"HEAD\") ||                                                                                                     \n    724                     starts_with(refname, \"refs/worktree/\") ||                                                                                      \n    725                     starts_with(refname, \"refs/bisect/\") ||                                                                                        \n    726                     starts_with(refname, \"refs/rewritten/\");                                                                                       \n    727     }                                                                                                                                              \n    728                                                                                                                                                    \n    729     static int is_pseudoref_syntax(const char *refname)                                                                                            \n    (gdb)\n\n\nWith kind regards,\n    Alex\n"},{"id":"396341","messageId":"CABPp-BEBQD1Rzaur7M5Uc8OyEidA08RkkjfXmCPm5qx6aUgE_A@mail.gmail.com","threadId":"53331","inReplyTo":"3910b39cf7c7419eb5b87c7aeb871e11@atos.net","subject":"Re: git-rebase v2.26.2 - \"--root --empty drop\" doesn't work and \"--root --fork-point $somegibberish\" gets SIGSEGV","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2020-04-27T15:46:06Z","receivedAt":"2020-04-27T15:46:21Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi Alex,\n\nOn Mon, Apr 27, 2020 at 5:30 AM Berg, Alexander <alexander.berg@atos.net> wrote:\n>\n> Dear *,\n>\n> AFAIS there are (at least) two bugs in git-rebase at the moment.\n> Those findings below occured on a simple branch, without an upstream.\n>\n> If you wish to rebase history and drop all empty commits, e.g.\n>     git rebase --root --empty drop\n> those empty commits are still in place after the operation comletes.\n> With git v2.14.xx this operation (\"--drop-empty\") drops those empty\n> commits as expected.\n> Is there a new option to be used here or something?\n> Or is it just broken?\n\nFrom the documentation:\n\n--empty={drop,keep,ask}::\n        How to handle commits that are not empty to start and are not\n        clean cherry-picks of any upstream commit, but which become\n        empty after rebasing (because they contain a subset of already\n        upstream changes).\n\nWith 2.26.2, to drop commits that _start_ empty, you'd use an\ninteractive rebase and remove the 'pick' lines associated with those\ncommits.  In 2.27, we'll mark such commits with an \"# empty\" trailer,\nand will also provide the --no-keep-empty flag to just automatically\ndrop them.  (See\nhttps://lore.kernel.org/git/3a5bedc68d696f19ab8eb40d1af8abd42172219f.1586573068.git.gitgitgadget@gmail.com/,\nor check out the 'next' branch of git.git if you'd like to try it\nsooner.)\n\n> As I've experimented with some new options for the above command,\n> it seems that user input checking isn't done properly for \"--fork-point\".\n> I've tried\n>     git rebase --root --empty drop --fork-point --rebase-merges\n> (yes, --fork-point usage is wrong here) and got\n>     Segmentation fault (core dumped)\n>\n> A colleague of mine looked into this:\n>     $ gdb /bin/git\n>     (gdb) set args rebase --root --empty drop --fork-point --rebase-merges\n>     (gdb) run\n>     Starting program: /bin/git rebase --root --empty drop --fork-point --rebase-merges\n>     [Thread debugging using libthread_db enabled]\n>     Using host libthread_db library \"/lib64/libthread_db.so.1\".\n>\n>     Program received signal SIGSEGV, Segmentation fault.\n>     is_per_worktree_ref (refname=0x0) at refs.c:725\n>     725                     starts_with(refname, \"refs/bisect/\") ||\n>     Missing separate debuginfos, use: debuginfo-install glibc-2.17-292.el7.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-18.el7.x86_64\n>     (gdb) bt\n>     #0  is_per_worktree_ref (refname=0x0) at refs.c:725\n>     #1  ref_type (refname=refname@entry=0x0) at refs.c:760\n>     #2  0x00000000005739c9 in files_reflog_path (refs=0x90ce30, sb=0x7fffffffc5e0, refname=0x0) at refs/files-backend.c:176\n>     #3  0x000000000057402a in files_for_each_reflog_ent (ref_store=<optimized out>, refname=0x0, fn=0x4d4d20 <collect_one_reflog_ent>, cb_data=0x7fffffffc640)\n>         at refs/files-backend.c:2060\n>     #4  0x00000000004d4f4b in get_fork_point (refname=0x0, commit=0x91cff0) at commit.c:933\n>     #5  0x0000000000475e69 in cmd_rebase (argc=0, argv=0x7fffffffdd20, prefix=<optimized out>) at builtin/rebase.c:2082\n>     #6  0x0000000000406cd0 in run_builtin (argv=0x7fffffffdd20, argc=6, p=0x8b3f40 <commands+2016>) at git.c:444\n>     #7  handle_builtin (argc=6, argv=argv@entry=0x7fffffffdd20) at git.c:674\n>     #8  0x0000000000407bee in run_argv (argv=0x7fffffffda80, argcp=0x7fffffffda8c) at git.c:741\n>     #9  cmd_main (argc=6, argc@entry=7, argv=0x7fffffffdd20, argv@entry=0x7fffffffdd18) at git.c:872\n>     #10 0x0000000000406910 in main (argc=7, argv=0x7fffffffdd18) at common-main.c:52\n>     (gdb) list\n>     720\n>     721     static int is_per_worktree_ref(const char *refname)\n>     722     {\n>     723             return !strcmp(refname, \"HEAD\") ||\n>     724                     starts_with(refname, \"refs/worktree/\") ||\n>     725                     starts_with(refname, \"refs/bisect/\") ||\n>     726                     starts_with(refname, \"refs/rewritten/\");\n>     727     }\n>     728\n>     729     static int is_pseudoref_syntax(const char *refname)\n>     (gdb)\n>\n>\n> With kind regards,\n>     Alex\n\nThanks for the report; when the tests finish at\nhttps://github.com/git/git/pull/771, I'll submit the patch to the\nlist.\n\nElijah\n"}]}