build: warn when generating man pages for binaries built from a dirty branch #20468

pull tylerchambers wants to merge 1 commits into bitcoin:master from tylerchambers:fix-20412 changing 4 files +44 −21
  1. tylerchambers commented at 9:41 PM on November 23, 2020: contributor
    • Adjusted --version flag behavior in bitcoind and bitcoin-wallet to have the same behavior.
    • Added --version flag to bitcoin-tx to match.
    • Added functionality in gen-manpages.sh to error when attempting to generate man pages for binaries built from a dirty branch.

    mitigates problem with issue #20412

  2. DrahtBot added the label Build system on Nov 23, 2020
  3. DrahtBot added the label Scripts and tools on Nov 23, 2020
  4. tylerchambers commented at 11:37 PM on November 23, 2020: contributor

    Just noticed the failing checks. On mobile, not sure how to mark as in progress, will investigate.

  5. fanquake added the label Waiting for author on Nov 23, 2020
  6. laanwj commented at 9:21 AM on November 24, 2020: member

    Thank you! Need to test this but changes look good to me at first sight.

    Implementing -version consistency across the tools makes sense too.

  7. laanwj commented at 9:22 AM on November 24, 2020: member

    Travis failure is boring (due to trailing whitespace)

    This diff appears to have added new lines with trailing whitespace.
    The following changes were suspected:
    diff --git a/contrib/devtools/gen-manpages.sh b/contrib/devtools/gen-manpages.sh
    @@ -20,0 +21,15 @@ BITCOINQT=${BITCOINQT:-$BINDIR/qt/bitcoin-qt}
    +then
    diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
    @@ -100,6 +101,9 @@ static int AppInitRawTx(int argc, char* argv[])
    +
    diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp
    @@ -45,10 +46,12 @@ static bool WalletAppInit(int argc, char* argv[])
    +                    "Usage:\n"
    ^---- failure generated from test/lint/lint-whitespace.sh
    
  8. in src/bitcoind.cpp:62 in 0f8b95bc05 outdated
      62 | -        } else {
      63 | -            strUsage += "\nUsage:  bitcoind [options]                     Start " PACKAGE_NAME "\n";
      64 | -            strUsage += "\n" + args.GetHelpMessage();
      65 | +        if (!args.IsArgSet("-version")) {
      66 | +            strUsage += FormatParagraph(LicenseInfo()) + "\n"
      67 | +                "\nUsage:  bitcoind [options]                     Start " PACKAGE_NAME "\n"
    


    decryp2kanon commented at 5:59 PM on November 24, 2020:

    nit: whitespace issue on lint

  9. tylerchambers marked this as a draft on Nov 24, 2020
  10. tylerchambers commented at 8:26 PM on November 24, 2020: contributor

    fixed linting issues, we should be good to go now. thanks!

  11. tylerchambers marked this as ready for review on Nov 24, 2020
  12. luke-jr commented at 8:36 PM on November 24, 2020: member

    Concept NACK. No reason manpages shouldn't generate for any given checkout...

    Maybe making sure the binaries match the current git describe would be okay.

    Perhaps CI checks?

  13. tylerchambers commented at 8:50 PM on November 24, 2020: contributor

    @luke-jr ci checks would be good.

    How does everyone feel about a warning/notification echoed out instead of returning early?

    The warning to prevent accidental check-ins + the CI checks should get the desired effect while allowing man page generation at any point.

  14. luke-jr commented at 12:33 AM on November 25, 2020: member

    A warning sounds fine to me too.

  15. fanquake removed the label Waiting for author on Nov 25, 2020
  16. laanwj commented at 8:09 AM on November 25, 2020: member

    @luke-jr The problem is accidentally checking in manual pages with a -dirty tag. This happened to me a few times and more times almost. This is why I'd like this behavior in. These scripts are part of our release process and should assist our release process by preventing common mistakes.

    (I mean, the non-determinism implied by generating the pages from a state of the tree that was never checked in in the first place, isn't that wrong by default?)

  17. laanwj commented at 8:12 AM on November 25, 2020: member

    CI checks are way too late. And I don't really want to do anything complicated with git check-in hooks either. This script seems to be the best place to ensure it.

    But sure, I'm okay with adding a way to bypass the check if you really want to. For say, testing the script it could make sense.

  18. luke-jr commented at 3:27 PM on November 25, 2020: member

    @laanwj The runtime warning from gen-manpages would hopefully be enough to alert the user not to commit it?

  19. Warn when binaries are built from a dirty branch.
    Adjusted version flag behavior in bitcoin-tx, bitcoin-wallet, and
    bitcoind to match. Added functionality in gen-manpages.sh to warning when
    attempting to generate man pages for binaries built from a dirty
    branch.
    6690adba08
  20. tylerchambers renamed this:
    build: don't allow manpages to be generated for binaries built from a dirty branch
    build: warn when generating man pages for binaries built from a dirty branch
    on Nov 28, 2020
  21. tylerchambers commented at 11:48 PM on November 28, 2020: contributor

    updated to warn instead of outright fail, which should solve some of the problem in the original issue while still providing flexibility, should one want to generate man pages for bins built from a dirty branch.

  22. laanwj commented at 9:49 AM on December 7, 2020: member

    Tested ACK 6690adba08006739da0060eb4937126bdfa1181a

    $ BUILDDIR="$PWD/build" contrib/devtools/gen-manpages.sh
    $ cd build
    $ make -j4
    …
    $ cd ..
    $ BUILDDIR="$PWD/build" contrib/devtools/gen-manpages.sh
    
    WARNING: the following binaries were built from a dirty tree:
    
    /…/bitcoin/build/src/bitcoind
    /…/bitcoin/build/src/bitcoin-cli
    /…/bitcoin/build/src/bitcoin-tx
    /…/bitcoin/build/src/bitcoin-wallet
    /…/bitcoin/build/src/qt/bitcoin-qt
    
    man pages generated from dirty binaries should NOT be committed.
    To properly generate man pages, please commit your changes to the above binaries, rebuild them, then run this script again.
    

    Yea seems strong enough warning. Thanks for working on this!

  23. laanwj merged this on Dec 7, 2020
  24. laanwj closed this on Dec 7, 2020

  25. sidhujag referenced this in commit 6673bf1512 on Dec 7, 2020
  26. hebasto commented at 4:55 PM on February 24, 2021: member

    ~NACK, this change makes command line options help unavailable for bitcoind.~

  27. hebasto commented at 5:43 PM on February 24, 2021: member

    I had a broken setup. Sorry for noise.

  28. DrahtBot locked this on Aug 16, 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-13 21:14 UTC

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