Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Dec 7, 2020
Merged

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

merged 1 commit into from Dec 7, 2020

Conversation

tylerchambers
Copy link
Contributor

@tylerchambers tylerchambers commented Nov 23, 2020

  • 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

@tylerchambers
Copy link
Contributor Author

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

@laanwj
Copy link
Member

laanwj commented Nov 24, 2020

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

Implementing -version consistency across the tools makes sense too.

@laanwj
Copy link
Member

laanwj commented Nov 24, 2020

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

@tylerchambers tylerchambers marked this pull request as draft November 24, 2020 18:49
@tylerchambers
Copy link
Contributor Author

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

@tylerchambers tylerchambers marked this pull request as ready for review November 24, 2020 20:26
@luke-jr
Copy link
Member

luke-jr commented Nov 24, 2020

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?

@tylerchambers
Copy link
Contributor Author

@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.

@luke-jr
Copy link
Member

luke-jr commented Nov 25, 2020

A warning sounds fine to me too.

@laanwj
Copy link
Member

laanwj commented Nov 25, 2020

@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?)

@laanwj
Copy link
Member

laanwj commented Nov 25, 2020

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.

@luke-jr
Copy link
Member

luke-jr commented Nov 25, 2020

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

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.
@tylerchambers tylerchambers changed the title 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 Nov 28, 2020
@tylerchambers
Copy link
Contributor Author

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.

@laanwj
Copy link
Member

laanwj commented Dec 7, 2020

Tested ACK 6690adb

$ 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!

@laanwj laanwj merged commit f3e1768 into bitcoin:master Dec 7, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 7, 2020
@hebasto
Copy link
Member

hebasto commented Feb 24, 2021

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

@hebasto
Copy link
Member

hebasto commented Feb 24, 2021

I had a broken setup. Sorry for noise.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants