-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-24710 Incorrect checksum calculation in saveVersion.sh #2056
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,34 +30,34 @@ nativeOutputDirectory="$2/native/utils/" | |
| pushd . | ||
| cd .. | ||
|
|
||
| user=`whoami | sed -n -e 's/\\\/\\\\\\\\/p'` | ||
| user=$(whoami | sed -n -e "s/\\\/\\\\\\\\/p") | ||
| if [ "$user" == "" ] | ||
| then | ||
| user=`whoami` | ||
| user=$(whoami) | ||
| fi | ||
| date=`date` | ||
| cwd=`pwd` | ||
| date=$(date) | ||
| cwd=$(pwd) | ||
| if [ -d .svn ]; then | ||
| revision=`(svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p') || true` | ||
| url=`(svn info | sed -n -e 's/^URL: \(.*\)/\1/p') || true` | ||
| revision=$( (svn info | sed -n -e "s/Last Changed Rev: \(.*\)/\1/p") || true) | ||
| url=$( (svn info | sed -n -e 's/^URL: \(.*\)/\1/p') || true) | ||
| elif [ -d .git ]; then | ||
| revision=`git log -1 --no-show-signature --pretty=format:"%H" || true` | ||
| hostname=`hostname` | ||
| revision=$(git log -1 --no-show-signature --pretty=format:"%H" || true) | ||
| hostname=$(hostname) | ||
| url="git://${hostname}${cwd}" | ||
| fi | ||
| if [ -z "${revision}" ]; then | ||
| echo "[WARN] revision info is empty! either we're not in VCS or VCS commands failed." >&2 | ||
| revision="Unknown" | ||
| url="file://$cwd" | ||
| fi | ||
| if ! [ -x "$(command -v openssl)" ]; then | ||
| if ! [ -x "$(command -v openssl)" ]; then | ||
| if ! [ -x "$(command -v gpg)" ]; then | ||
| srcChecksum="Unknown" | ||
| else | ||
| srcChecksum=`find hbase-*/src/main/ | grep -e "\.java" -e "\.proto" | LC_ALL=C sort | xargs gpg --print-md sha512 | gpg --print-md sha512 | cut -d ' ' -f 1` | ||
| srcChecksum=$(find hbase-*/src/main/ | grep -e "\.java" -e "\.proto" | LC_ALL=C sort xargs gpg --print-md sha512 | gpg --print-md sha512 | tr '\n' ' ' | sed 's/[[:space:]]*//g') | ||
petersomogyi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fi | ||
| else | ||
| srcChecksum=`find hbase-*/src/main/ | grep -e "\.java" -e "\.proto" | LC_ALL=C sort | xargs openssl dgst -sha512 | openssl dgst -sha512 | cut -d ' ' -f 1` | ||
| srcChecksum=$(find hbase-*/src/main/ | grep -e "\.java" -e "\.proto" | LC_ALL=C sort xargs openssl dgst -sha512 | openssl dgst -sha512 | sed 's/^.* //') | ||
|
||
| fi | ||
| popd | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous use of
cuthere at the end is surprising. It took only the first block...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on history it was used for
md5andmd5sumcommands but it wasn't removed when SHA512 was introduced in saveVersion.sh.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
tr -d '[:space:]'work? It's simpler and shorter thantr '\n' ' ' | sed 's/[[:space:]]*//g'There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get a different output from your command, an extra %.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's weird. I did not see in my macOS and Ubuntu Linux. But since this is not reliable, I guess we can stay with your script
trandsed- which works for me on both macOS and Ubuntu.