From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 3932F1F453 for ; Sat, 26 Jan 2019 13:59:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726084AbfAZN7T (ORCPT ); Sat, 26 Jan 2019 08:59:19 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43181 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbfAZN7T (ORCPT ); Sat, 26 Jan 2019 08:59:19 -0500 Received: by mail-wr1-f65.google.com with SMTP id r10so13063309wrs.10 for ; Sat, 26 Jan 2019 05:59:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6ncKA7/JGXf94OWfmqJf8EzhFrju5KAHtjmWSrkWzAM=; b=JPWu0pU5nmNkL9uInDDmpUJY19KYZyp6HJJKIE3kBiP0+hmR/8nkotyqZl7Qt7maZt VDtorEPJJBhLMn6pLUorTTKYa/CQPcfbtQjqjSFDxZOX1IKHwB+IqF2UjSakLssSV8Kd sFYVZ/DAJs1nziNUN3I3PaS3gzWhR6ROvZSguKamgPn7cI/cBnFJb7AkZx/uTkhGmIHM XvwomBItb7N7QgRDBiLLtQpFkiwiC1OfWNSdAVxt3v3B8O5PBOhZwGbqb1tMhAVtWyMM gNxF9hDozmVPRWVthsV2gWSqaBa8Em6CTmcUjpt0wq0cMKDQpcFagX2LcRudpauvcTGf cqtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=6ncKA7/JGXf94OWfmqJf8EzhFrju5KAHtjmWSrkWzAM=; b=JAFz/9afA/1kSS/Aat9kqh+KkaVFYVjqsdCRF44DcN4YRtVAFSPJYsarGetNL3CBdd ktBU/AdBZKkirG1shasGKvJZo7GmINhn+4ny7aYxOP2bXPHYBKy64U53M9qfr4PsKs50 dbSdwZv3Uzlh3EoxWA2izd9HQrcKYjX779YLDkKHe8W5ocXNyzouf0okT+VwbWn1cLdM yEBTK3a7Yr2HHfJCwRQn72hsWI764jVTc5OXCiQwxPqTDyWHpSLLkH0Bb0Hbjo7VWBzr 2yGJZJp0OFc5W3UXbujc5bfRRTgf/qObWCVkoxux6EwrLe9GXNlwb6s30kuneWfBFEIu 3ung== X-Gm-Message-State: AJcUuke2MSJTyZs2S9pNK8shXqRJB5XIlhciu1FIOuQwzzx5tHJYT4nK fczozpmzwfLaQkFaK5HK3yk= X-Google-Smtp-Source: ALg8bN42XucSRcSbboeQGfhxiL5yiQ6g5X2RXXbf6oeQZAMfnfR3E9vGp4m5mQ2nSmZtSrQ8ZP2kew== X-Received: by 2002:a5d:6aca:: with SMTP id u10mr14741743wrw.310.1548511156394; Sat, 26 Jan 2019 05:59:16 -0800 (PST) Received: from [192.168.0.104] (atoulouse-658-1-2-163.w86-222.abo.wanadoo.fr. [86.222.145.163]) by smtp.gmail.com with ESMTPSA id k128sm91476774wmd.37.2019.01.26.05.59.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Jan 2019 05:59:15 -0800 (PST) Subject: Re: [PATCH v2] rebase: move state_dir to tmp prior to deletion To: Ben Woosley , git@vger.kernel.org References: <01020168891b1a3e-140bd175-a8cb-4379-a114-de68b1cac5d6-000000@eu-west-1.amazonses.com> <0102016889a9145a-83604d85-036b-409b-a3d2-2eb1ef2c5b95-000000@eu-west-1.amazonses.com> Cc: Johannes Schindelin From: Alban Gruin Openpgp: preference=signencrypt Autocrypt: addr=alban.gruin@gmail.com; prefer-encrypt=mutual; keydata= mQINBFcsWp4BEAC6dalBNr/CZCvvfeARylnjAaZCxMPwUHXAyf4xotA59sNcyVmaFQ6KxQEs R20CSJhO6HqCh4bR9/994vdc4cGuNaWf82eYRYzqCzwFWvFJHj83QgDR2cjtz4frKpj3jSFJ No3KBlMmpU8yvSnYaCxjqHxBB+fZwkmmONj/57KdFRU83DvDllQdAxXfxEavL3qUKjVbld29 o82M2xsN8ZN5KTw7rAMHcigYVnlrgP50euxz3WvfrV+Mky2W7q7m5rTK7eXqOKhewsKcxo0I AP+H0Nt91YTmMIAX2Ba25IfHI99kUCLpbHX9xdvj5UH1SZsG84APahdI3CXYibfYIS+qssoo 72qj7eBIoCFbVS4Q5AINxojio32orGBDE8CaCy3EzTF+vwJ+h4uUKrTX4wyUMy8nXS0UxZqD aQsS7Di6LdAHu+4uf064mXdgjehJ2uHAydFnCThMoxckRoSZ70iCPwgconhNrnuTmunJ43BF YjAurjg8y3WrMPJuJaI42q0sYbAX21XeayyMI8dzoNwyG6s+v0Udb/uxdYnHhsGx1oXjYCeR nyBdVwdMLWFP4XmJH7JueGUZ37TLh719ME6HYRpfM3sh915ywPxKxQYmGC9iXRThXdGK7ipq hJM5RtMq4QPGg+/ShgTZaDdFuMnG8Zrq6W+O29h9NB5rQ/UvBwARAQABtCNBbGJhbiBHcnVp biA8YWxiYW4uZ3J1aW5AZ21haWwuY29tPokCcAQTAQIAWgIbAwIeAQIXgAULBwgJCgQVCAkK BRYAAQIDHxhoa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MaWh6lE3XQ/bgx3 yl/kHs42wTS/M6EylpBS10/RLxLF1TKK39xgGXtzRz86lqxz9IIEcLpOXsNi2ieoVOfykgbG lvAXpIk/WT7BKd1ncK71sTuBGWpnytCjlTFHM6Lp70yZT9TAKaBevkn5JaSlhv4/QcfJtTgJ HkyVQTh250fC9P/9C9azPjnxB9hnBktfiihx+wISlDARk/X+JCZfJrM= Message-ID: <5c40a594-d23c-dfb5-18fe-2ac6fa9b3865@gmail.com> Date: Sat, 26 Jan 2019 14:59:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <0102016889a9145a-83604d85-036b-409b-a3d2-2eb1ef2c5b95-000000@eu-west-1.amazonses.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr-FR Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi Ben, Le 26/01/2019 à 11:16, Ben Woosley a écrit : > From: Ben Woosley > > To avoid partial deletion / zombie rebases. > > Example behavior under partial deletion, after > Ctrl-Cing out of a standard rebase: > > $ git rebase target > First, rewinding head to replay your work on top of it... > Applying: [...] > ^C > $ git status > rebase in progress; onto (null) > You are currently rebasing. > (all conflicts fixed: run "git rebase --continue") > > Changes to be committed: > (use "git reset HEAD ..." to unstage) > [...] > $ git rebase --continue > error: could not read '.git/rebase-apply/head-name': No such file or directory > $ git rebase --abort > error: could not read '.git/rebase-apply/head-name': No such file or directory > > Others report this issue here: > https://stackoverflow.com/questions/3685001/git-how-to-fix-corrupted-interactive-rebase > --- > git-legacy-rebase.sh | 17 ++++++++++++++--- > git-rebase--preserve-merges.sh | 2 +- > 2 files changed, 15 insertions(+), 4 deletions(-) > This patch does not cover the new builtin rebase, even though it’s also affected by this bug. I ran in two bugs trying to reproduce this issue with the builtin: 1. Right after invoking `git rebase $target', $target was checked out but the state directory has not been written yet, leaving the user on the target without any possibility of aborting the rebase. I think it’s because the checkout is done by builtin/rebase.c, whereas the state directory is created by git-rebase--am -- and it might not be created at all! 2. If I wait a little bit, I have the same bug as yours. I tried to reproduce the issue on master (16a465bc01, "Third batch after 2.20") and builtin.userebase set to false, without success. It seems this issue has been fixed in the shell version, but not in the builtin version -- and it seems that you are using the latter, so it won’t solve your problem anyway. Try `git -c rebase.usebuiltin=false rebase --abort', and the state directory will be removed without any errors. Things are a bit different with interactive rebase: it checks out the target branch, then create its state directory. Only the first issue can happen, and you have to be very unlucky to run into it. The same goes for rebase -p. > diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh > index b4c7dbfa575d3..832a211c925c3 100755 > --- a/git-legacy-rebase.sh > +++ b/git-legacy-rebase.sh > @@ -128,11 +128,22 @@ read_basic_state () { > } > } > > +remove_rebase_state () { > + removal_dir=$(mktemp -d -t "git-rebase-state-XXXXXX") > + if test -d "$removal_dir" > + then > + mv "$state_dir" "$removal_dir" > + else > + removal_dir="$state_dir" > + fi > + rm -rf "$removal_dir" > +} > + > finish_rebase () { > rm -f "$(git rev-parse --git-path REBASE_HEAD)" > apply_autostash && > { git gc --auto || true; } && > - rm -rf "$state_dir" > + remove_rebase_state > } > > run_interactive () { > @@ -194,7 +205,7 @@ run_specific_rebase () { > elif test $ret -eq 2 # special exit status for rebase -p > then > apply_autostash && > - rm -rf "$state_dir" && > + remove_rebase_state && > die "Nothing to do" > fi > exit $ret > @@ -439,7 +450,7 @@ abort) > exit > ;; > quit) > - exec rm -rf "$state_dir" > + remove_rebase_state > ;; > edit-todo) > run_specific_rebase > diff --git a/git-rebase--preserve-merges.sh b/git-rebase--preserve-merges.sh > index afbb65765d461..146b52df14928 100644 > --- a/git-rebase--preserve-merges.sh > +++ b/git-rebase--preserve-merges.sh > @@ -226,7 +226,7 @@ Once you are satisfied with your changes, run > > die_abort () { > apply_autostash > - rm -rf "$state_dir" > + remove_rebase_state > die "$1" > } > > > -- > https://github.com/git/git/pull/569 > It seems that you tried to implement the solution proposed in the stackoverflow thread you linked. Unfortunately, if it fixed something, it has a problem: it won’t bring you back to the commit where you called `git rebase', unlike a `git rebase --abort' on a uncorrupted rebase state. This is what happens when aborting a corrupted rebase with the shell version of rebase. I think it’s because git-rebase--am will only create a state directory if it has a problem (ie. a conflict or the user hits ^C). So, there is definitely a problem with git-rebase--am, but this does not address it. -- Alban