doc: Add a note about backporting #17159

pull carnhofdaki wants to merge 1 commits into bitcoin:master from carnhofdaki:cdk/doc-backports changing 1 files +25 −0
  1. carnhofdaki commented at 10:15 AM on October 16, 2019: contributor

    See laanwj's comment in #17158 #17158 (comment)

  2. carnhofdaki commented at 10:16 AM on October 16, 2019: contributor

    @laanwj So what do you think about adding this note to the documentation?

  3. laanwj commented at 10:18 AM on October 16, 2019: member

    I think it is a good idea to add information about backporting (when to backport, how to backport) to the documentation, but I'm not sure a disconnected note only saying what not to do is the best way.

  4. laanwj added the label Docs on Oct 16, 2019
  5. carnhofdaki commented at 10:32 AM on October 16, 2019: contributor

    In this case we could see that the backport was clearly requested, so "when to backport" was easy. "How to backport" was as you commented an automated conflict-free cherry-pick. Which leads me to following idea of text:


    Backporting is done whenever the fix needs to be present in a release branch (e.g. a security issue) or on request. If the backport is trivial and can be cherry-picked automatically, just request a "Needs backport" tag for the original issue or PR. If backport needs any conflict resolution, create the PR manually and wait for comments.

    The commit message of a backport should additionally contain following two lines in the end:

    Github-Pull: #<original issue/PR number>
    Rebased-From: <sha checksum of the code already merged into master branch>
    

    What do you think @laanwj ? I am not force-pushing yet and ready to close this PR if needed.

    Edit: "add" [a tag] "to" → "request" [a tag] "for" Edit: Added text from #17159 (comment) Edit: fixed missing l - "additionally"

  6. laanwj commented at 2:02 PM on October 16, 2019: member

    Looks good to me, thanks!

    Another thing to mention maybe is to only create a backport PR (when necessary) after the original PR was merged into master. This makes sure that the latest version of the code is backported, so makes review easier (no moving target).

  7. carnhofdaki force-pushed on Oct 16, 2019
  8. carnhofdaki force-pushed on Oct 16, 2019
  9. in CONTRIBUTING.md:317 in 2d16914404 outdated
     308 | @@ -309,6 +309,25 @@ about:
     309 |      when someone else is asking for feedback on their code, and universe balances out.
     310 |  
     311 |  
     312 | +Backporting
     313 | +-----------
     314 | +
     315 | +After the original PR was merged into master, backporting is done only
     316 | +when necessary - the fix either needs to be present in a release branch
     317 | +(e.g. a security issue) or on request.
    


    hebasto commented at 4:36 PM on October 16, 2019:
    (e.g., a security issue) or on request.
    

    carnhofdaki commented at 12:15 PM on October 17, 2019:

    Thank you. A nice one. I actually learned something. https://www.dailywritingtips.com/comma-after-i-e-and-e-g/

  10. in CONTRIBUTING.md:319 in 2d16914404 outdated
     314 | +
     315 | +After the original PR was merged into master, backporting is done only
     316 | +when necessary - the fix either needs to be present in a release branch
     317 | +(e.g. a security issue) or on request.
     318 | +If the backport is trivial and can be cherry-picked automatically,
     319 | +just request a "Needs backport" tag for the original PR.
    


    hebasto commented at 4:39 PM on October 16, 2019:
    just request a "Needs backport" label for the original PR.
    

    carnhofdaki commented at 12:17 PM on October 17, 2019:

    Done in 7c5ce792ef498598bd57780d42938139dbcd58e7 and will be squashed in the end.

  11. hebasto changes_requested
  12. hebasto commented at 4:41 PM on October 16, 2019: member

    Concept ACK 2d169144049da82d2db81efc872cb2e2b6eddea5.

    Also backport.py script could be mentioned.

  13. laanwj requested review from fanquake on Oct 17, 2019
  14. in CONTRIBUTING.md:320 in 2d16914404 outdated
     315 | +After the original PR was merged into master, backporting is done only
     316 | +when necessary - the fix either needs to be present in a release branch
     317 | +(e.g. a security issue) or on request.
     318 | +If the backport is trivial and can be cherry-picked automatically,
     319 | +just request a "Needs backport" tag for the original PR.
     320 | +If backport needs any conflict resolution, create the PR manually and
    


    promag commented at 9:15 AM on October 17, 2019:

    Could mention that the PR must be for a specific branch, not master. Also, a PR may be needed for each version where the backport makes sense.

    nit, drop "wait for comments"?


    carnhofdaki commented at 12:19 PM on October 17, 2019:

    Why a specific branch, not master? I understand that my development is done on a specific branch in my forked repo, but I ask for the Pull Request to master.

    "wait for comments" dropped in 1d9ffdd2432f9a89f77204505b221616cf74b704 and will be squashed in the end


    carnhofdaki commented at 12:22 PM on October 17, 2019:

    Backports are done when something is already in master (that is the practice of Linux development, where git itself comes from; in contrary to what Android or other BSP developers tend to do - they add specific hardware patches to a stable branch, making master run away quickly and then they are unable to catch up so after the device is not sold anymore, one can hardly find a current kernel and Android build for it...)


    hebasto commented at 12:26 PM on October 17, 2019:

    Why a specific branch, not master? I understand that my development is done on a specific branch in my forked repo, but I ask for the Pull Request to master.

    Commits are backported from the master branch to a specific branch, e.g., 0.18 or 0.19; not to the master branch.


    carnhofdaki commented at 12:28 PM on October 17, 2019:

    @promag @hebasto OK, sorry. I totally misunderstood the comment.


    carnhofdaki commented at 12:31 PM on October 17, 2019:

    @promag What do you think about 2aa9503ea ?

  15. in CONTRIBUTING.md:323 in 2d16914404 outdated
     318 | +If the backport is trivial and can be cherry-picked automatically,
     319 | +just request a "Needs backport" tag for the original PR.
     320 | +If backport needs any conflict resolution, create the PR manually and
     321 | +wait for comments.
     322 | +
     323 | +The commit message of a backport should additionally contain following
    


    promag commented at 9:15 AM on October 17, 2019:

    Each commit message of a backport ...


    carnhofdaki commented at 12:25 PM on October 17, 2019:

    Thanks. Fixed in 163fe28c54105fdde687cc49c51e635d6e483ccb and will be squashed later into the final commit.

  16. in CONTRIBUTING.md:328 in 2d16914404 outdated
     323 | +The commit message of a backport should additionally contain following
     324 | +two lines in the end:
     325 | +
     326 | +```
     327 | +Github-Pull: #<original issue/PR number>
     328 | +Rebased-From: <sha checksum of the code already merged into master branch>
    


    promag commented at 9:16 AM on October 17, 2019:

    commit hash of the respective merged commit?


    carnhofdaki commented at 12:26 PM on October 17, 2019:

    Fixed in 842aa85aa ...

  17. promag commented at 9:17 AM on October 17, 2019: member

    Concept ACK. Could link to an example PR?

  18. carnhofdaki commented at 12:33 PM on October 17, 2019: contributor

    Also backport.py script could be mentioned. @hebasto please have a look at 28537b729 and tell me what you think

    Edit: I actually removed the redundant header, see e52ac9c36

  19. carnhofdaki force-pushed on Oct 17, 2019
  20. carnhofdaki force-pushed on Oct 17, 2019
  21. in CONTRIBUTING.md:327 in e52ac9c367 outdated
     322 | +
     323 | +Each commit message of a backport should additionally contain following
     324 | +two lines in the end:
     325 | +
     326 | +```
     327 | +Github-Pull: #<original issue/PR number>
    


    fanquake commented at 12:50 PM on October 17, 2019:

    This should only ever be a PR number.

    Github-Pull: #<PR number>
    
  22. in CONTRIBUTING.md:328 in e52ac9c367 outdated
     323 | +Each commit message of a backport should additionally contain following
     324 | +two lines in the end:
     325 | +
     326 | +```
     327 | +Github-Pull: #<original issue/PR number>
     328 | +Rebased-From: <commit hash of the respective merged commit>
    


    fanquake commented at 12:50 PM on October 17, 2019:
    Rebased-From: <commit hash of the original commit>
    

    carnhofdaki commented at 5:44 AM on October 20, 2019:

    Done. 57379c8a5


    carnhofdaki commented at 5:44 AM on October 20, 2019:

    Aah, I just realized this "Commit suggestion" button :-) Will try it next time.

  23. in CONTRIBUTING.md:331 in e52ac9c367 outdated
     326 | +```
     327 | +Github-Pull: #<original issue/PR number>
     328 | +Rebased-From: <commit hash of the respective merged commit>
     329 | +```
     330 | +
     331 | +For more automation, please see the [backport.py script](
    


    fanquake commented at 2:24 PM on October 17, 2019:
    Also see the [backport.py script](
    
  24. promag commented at 7:52 PM on October 18, 2019: member

    I mean adding an example, like #16189.

  25. fanquake commented at 7:16 PM on October 19, 2019: member

    I'd re-write the text to be something like:

    Security and bug fixes can be backported from master to release branches. If the backport is non-trivial, it may be appropriate to open an additional PR, to backport the change, only after the original PR has been merged. Otherwise, backports will be done in batches by maintainers.

    A backport should contain the following metadata in the commit body:

    Github-Pull ...
    

    Also, this PR does not need backporting.

  26. carnhofdaki force-pushed on Oct 20, 2019
  27. carnhofdaki force-pushed on Oct 20, 2019
  28. carnhofdaki commented at 6:02 AM on October 20, 2019: contributor

    I mean adding an example, like #16189. @promag Added. Have a look.

  29. carnhofdaki commented at 6:03 AM on October 20, 2019: contributor

    I'd re-write the text to be something like:

    Security and bug fixes can be backported from master to release branches. If the backport is non-trivial, it may be appropriate to open an additional PR, to backport the change, only after the original PR has been merged. Otherwise, backports will be done in batches by maintainers.

    A backport should contain the following metadata in the commit body:

    Github-Pull ...
    

    Also, this PR does not need backporting. @fanquake Text changed. Have a look.

  30. in CONTRIBUTING.md:320 in b69a091456 outdated
     315 | +Security and bug fixes can be backported from `master` to release
     316 | +branches.
     317 | +If the backport is non-trivial, it may be appropriate to open an
     318 | +additional PR, to backport the change, only after the original PR
     319 | +has been merged.
     320 | +Otherwise, backports will be done in batches by maintainers.
    


    luke-jr commented at 6:42 AM on October 20, 2019:

    This is intended to be a new policy?


    carnhofdaki commented at 10:35 AM on October 20, 2019:

    As far as I understood, we are just describing the commonly used, but yet uncodified process. Or is it something new @laanwj ?


    fanquake commented at 2:35 PM on October 20, 2019:

    This is intended to be a new policy?

    It's not a new policy, just what happens in reality (when looking at bulk backports). However if this is controversial just drop the sentence.


    laanwj commented at 10:31 AM on October 30, 2019:

    Maybe mention that the Needs backport (...) labels are a tracking tool for maintainers and not meant as a TODO for the author of the PR. This has confused a few people.


    carnhofdaki commented at 12:47 PM on October 30, 2019:

    @laanwj see 4d47775c1


    carnhofdaki commented at 12:48 PM on October 30, 2019:
    diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
    index d38e44c47..f36f29dcf 100644
    --- a/CONTRIBUTING.md
    +++ b/CONTRIBUTING.md
    @@ -317,7 +317,9 @@ branches.
     If the backport is non-trivial, it may be appropriate to open an
     additional PR, to backport the change, only after the original PR
     has been merged.
    -Otherwise, backports will be done in batches by maintainers.
    +Otherwise, backports will be done in batches by maintainers and
    +the maintainers will use the proper `Needs backport (...)` labels
    +when needed (the original author does not need to worry).
    
     A backport should contain the following metadata in the commit body:
    
    
  31. in CONTRIBUTING.md:324 in b69a091456 outdated
     317 | +If the backport is non-trivial, it may be appropriate to open an
     318 | +additional PR, to backport the change, only after the original PR
     319 | +has been merged.
     320 | +Otherwise, backports will be done in batches by maintainers.
     321 | +
     322 | +A backport should contain the following metadata in the commit body:
    


    luke-jr commented at 6:42 AM on October 20, 2019:

    ... unless a straightforward merge of the original branch is possible.


    carnhofdaki commented at 10:38 AM on October 20, 2019:

    Why would a straightforward merge of something which has different checksum in master branch not contain a pointer to the parent (original commit in master)?

    Please provide some git command line examples on how to find the equivalent commit in master, given a release commit. If possible and if I understand correctly. Thank you.


    laanwj commented at 9:58 AM on October 23, 2019:

    Sometimes it's possible to base a new commit on a commit before the branch split (e.g. between 0.19 and master). If nothing conflicts in between, it can be a clean merge to both branches (unclean merges are rejected by the CI checks). This is quite rare, though, and I'm not sure mentioning it here is important. If you're enough of a git guru to do this, you don't need it mentioned here.


    carnhofdaki commented at 4:26 PM on October 29, 2019:

    @laanwj I see. @luke-jr Was this ^^ what you meant?

    I still think that one commit has to be the first one (in linear time) and merged into master. Then any other cherry-pick, no matter if there were conflicts, should IMHO contain a reference to the original unless it is easy in git to find out the original (first) patch on which this "backport" is based...


    laanwj commented at 10:33 AM on October 30, 2019:

    Yes, no matter how they're represented in git, changes should still be merged first into master. This is to make absolutely sure that the future major release contains everything.


    carnhofdaki commented at 1:09 PM on October 30, 2019:

    Right. My point was just if there is a better way to find "parent" (i.e. original upstream patch) but I found there is not because even in Linux kernel development (and I suppose they know how to use git given it was born there) they always write a comment in a backported patch:

    commit <hash> upstream.
    

    See this backported patch which is backport of this original patch in master and the only difference between those two is the added comment:

    --- patchorig   2019-10-30 14:00:51.058777980 +0100
    +++ backport    2019-10-30 14:00:30.865990235 +0100
    @@ -1,9 +1,11 @@
    -commit 3dd550a2d365
    +commit 9f8dd40c68c1
     Author: Alan Stern <stern@rowland.harvard.edu>
     Date:   Wed Sep 4 11:56:27 2019 -0400
    
         USB: usbcore: Fix slab-out-of-bounds bug during device reset
    
    +    commit 3dd550a2d36596a1b0ee7955da3b611c031d3873 upstream.
    +
         The syzbot fuzzer provoked a slab-out-of-bounds error in the USB core:
    
         BUG: KASAN: slab-out-of-bounds in memcmp+0xa6/0xb0 lib/string.c:904
    

    So maybe I totally misunderstood @luke-jr and was solving some non-issue here, but I learned a lot. Thanks!


    luke-jr commented at 3:59 PM on November 4, 2019:

    Yes, bugfixes are best when based immediately on top of the commit introducing the bug, in which case it is a clean merge to all affected branches.

    Sometimes that's not possible and a cherry-pick is needed instead, but when it is possible, it should be preferred.

    (Linux doesn't set a good example in this regard.)

  32. luke-jr changes_requested
  33. carnhofdaki force-pushed on Oct 23, 2019
  34. carnhofdaki force-pushed on Oct 23, 2019
  35. carnhofdaki force-pushed on Oct 23, 2019
  36. carnhofdaki force-pushed on Oct 30, 2019
  37. in CONTRIBUTING.md:321 in 4d47775c16 outdated
     316 | +branches.
     317 | +If the backport is non-trivial, it may be appropriate to open an
     318 | +additional PR, to backport the change, only after the original PR
     319 | +has been merged.
     320 | +Otherwise, backports will be done in batches by maintainers and
     321 | +the maintainers will use the proper `Needs backport (...)` labels
    


    luke-jr commented at 4:01 PM on November 4, 2019:

    Maybe just remove "maintainers" here?


  38. fanquake commented at 5:41 AM on January 5, 2020: member

    This looks ok now. @carnhofdaki can you squash.

  39. carnhofdaki commented at 12:51 PM on January 6, 2020: contributor

    @fanquake Sure. Thank you for info.

  40. doc: Add a note about backporting
    See laanwj's comment in #17158
    https://github.com/bitcoin/bitcoin/pull/17158#issuecomment-542627090
    
    Co-Authored-By: Wladimir J. van der Laan <laanwj@protonmail.com>
    Co-Authored-By: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
    Co-Authored-By: João Barbosa <joao.paulo.barbosa@gmail.com>
    Co-Authored-By: Michael <fanquake@gmail.com>
    Co-Authored-By: Luke Dashjr <luke-jr+git@utopios.org>
    2a6bce482c
  41. carnhofdaki force-pushed on Jan 6, 2020
  42. MarcoFalke merged this on Mar 11, 2020
  43. MarcoFalke closed this on Mar 11, 2020

  44. sidhujag referenced this in commit 526ad42cf4 on Mar 11, 2020
  45. carnhofdaki deleted the branch on May 24, 2020
  46. sidhujag referenced this in commit 7dbebb804d on Nov 10, 2020
  47. PastaPastaPasta referenced this in commit 7896d6a03b on Jun 27, 2021
  48. PastaPastaPasta referenced this in commit 1e894c69d1 on Jun 28, 2021
  49. PastaPastaPasta referenced this in commit 4da4a06461 on Jun 29, 2021
  50. PastaPastaPasta referenced this in commit 3bf483e539 on Jul 1, 2021
  51. PastaPastaPasta referenced this in commit 690c5f7120 on Jul 1, 2021
  52. PastaPastaPasta referenced this in commit eee2295f38 on Jul 14, 2021
  53. PastaPastaPasta referenced this in commit 545139e5c1 on Jul 14, 2021
  54. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 18:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me