You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/07/13 12:36:03 UTC

[GitHub] [hbase] petersomogyi opened a new pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

petersomogyi opened a new pull request #2056:
URL: https://github.com/apache/hbase/pull/2056


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] petersomogyi merged pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
petersomogyi merged pull request #2056:
URL: https://github.com/apache/hbase/pull/2056


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] ndimiduk commented on a change in pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
ndimiduk commented on a change in pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#discussion_r455181612



##########
File path: hbase-common/src/saveVersion.sh
##########
@@ -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')
   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/^.* //')

Review comment:
       Oh, this is the example from your comment on JIRA, a difference between the mac and linux versions of `openssl dgst`. Disregard.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] petersomogyi commented on a change in pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
petersomogyi commented on a change in pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#discussion_r455189133



##########
File path: hbase-common/src/saveVersion.sh
##########
@@ -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`

Review comment:
       Based on history it was used for `md5` and `md5sum` commands but it wasn't removed when SHA512 was introduced in saveVersion.sh.
   
   ```
   root@8224f4c69e6f:/# echo "foo" | md5sum
   d3b07384d113edec49eaa6238ad5ff00  -
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] liuml07 commented on a change in pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
liuml07 commented on a change in pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#discussion_r457739472



##########
File path: hbase-common/src/saveVersion.sh
##########
@@ -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`

Review comment:
       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 `tr` and `sed` - which works for me on both macOS and Ubuntu.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] liuml07 commented on a change in pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
liuml07 commented on a change in pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#discussion_r457739472



##########
File path: hbase-common/src/saveVersion.sh
##########
@@ -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`

Review comment:
       That's wired. I did not see in my macOS and Ubuntu Linux. But since this is not reliable, I guess we can stay with your script `tr` and `sed` - which works for me on both macOS and Ubuntu.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] ndimiduk commented on a change in pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
ndimiduk commented on a change in pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#discussion_r455177715



##########
File path: hbase-common/src/saveVersion.sh
##########
@@ -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`

Review comment:
       Previous use of `cut` here at the end is surprising. It took only the first block...

##########
File path: hbase-common/src/saveVersion.sh
##########
@@ -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')

Review comment:
       I think dropping the `|` between `sort` and `xargs` is a bug. I believe this calculates the sha512 of the sort error message, not the sha512 of the sha512s of the contents of all the files.
   
   On a mac anyway, I get
   
   ```
   $ find hbase-common/src/main/ | grep -e "\.java" | LC_ALL=C sort xargs gpg --print-md sha512
   sort: unrecognized option `--print-md'
   Usage: sort [-bcCdfigMmnrsuz] [-kPOS1[,POS2] ... ] [+POS1 [-POS2]] [-S memsize] [-T tmpdir] [-t separator] [-o outfile] [--batch-size size] [--files0-from file] [--heapsort] [--mergesort] [--radixsort] [--qsort] [--mmap] [--parallel thread_no] [--human-numeric-sort] [--version-sort] [--random-sort [--random-source file]] [--compress-program program] [file ...]
   $ find hbase-common/src/main/ | grep -e "\.java" | LC_ALL=C sort xargs openssl dgst -sha512
   sort: invalid option -- a
   Usage: sort [-bcCdfigMmnrsuz] [-kPOS1[,POS2] ... ] [+POS1 [-POS2]] [-S memsize] [-T tmpdir] [-t separator] [-o outfile] [--batch-size size] [--files0-from file] [--heapsort] [--mergesort] [--radixsort] [--qsort] [--mmap] [--parallel thread_no] [--human-numeric-sort] [--version-sort] [--random-sort [--random-source file]] [--compress-program program] [file ...]
   ```

##########
File path: hbase-common/src/saveVersion.sh
##########
@@ -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')
   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/^.* //')

Review comment:
       what is the purpose of the final `sed`? I see no difference.
   
   ```
   $ echo "foo" | openssl dgst -sha512 | sed 's/^.* //'
   0cf9180a764aba863a67b6d72f0918bc131c6772642cb2dce5a34f0a702f9470ddc2bf125c12198b1995c233c34b4afd346c54a2334c350a948a51b6e8b4e6b6
   $ echo "foo" | openssl dgst -sha512
   0cf9180a764aba863a67b6d72f0918bc131c6772642cb2dce5a34f0a702f9470ddc2bf125c12198b1995c233c34b4afd346c54a2334c350a948a51b6e8b4e6b6
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] Apache-HBase commented on pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#issuecomment-658893173






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] liuml07 commented on a change in pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
liuml07 commented on a change in pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#discussion_r456574712



##########
File path: hbase-common/src/saveVersion.sh
##########
@@ -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`

Review comment:
       Does `tr -d '[:space:]'` work? It's simpler and shorter than `tr '\n' ' ' | sed 's/[[:space:]]*//g'`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] Apache-HBase commented on pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#issuecomment-657691292


   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   0m 32s |  Docker mode activated.  |
   | -0 :warning: |  yetus  |   0m  3s |  Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck  |
   ||| _ Prechecks _ |
   ||| _ master Compile Tests _ |
   ||| _ Patch Compile Tests _ |
   ||| _ Other Tests _ |
   |  |   |   1m 40s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | Client=19.03.12 Server=19.03.12 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-2056/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/2056 |
   | Optional Tests |  |
   | uname | Linux 02af3fbb5174 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / 3bd54217a0 |
   | Max. process+thread count | 42 (vs. ulimit of 12500) |
   | modules | C: hbase-common U: hbase-common |
   | Console output | https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-2056/1/console |
   | versions | git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] Apache-HBase commented on pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#issuecomment-658893345


   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   0m 34s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files found.  |
   | +0 :ok: |  shelldocs  |   0m  0s |  Shelldocs was not available.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any @author tags.  |
   ||| _ master Compile Tests _ |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  shellcheck  |   0m  0s |  The patch generated 0 new + 0 unchanged - 10 fixed = 0 total (was 10)  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace issues.  |
   ||| _ Other Tests _ |
   | +1 :green_heart: |  asflicense  |   0m 12s |  The patch does not generate ASF License warnings.  |
   |  |   |   1m 46s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | Client=19.03.12 Server=19.03.12 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-2056/2/artifact/yetus-general-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/2056 |
   | Optional Tests | dupname asflicense shellcheck shelldocs |
   | uname | Linux 2b002e7bec9d 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / 2505c7760d |
   | Max. process+thread count | 42 (vs. ulimit of 12500) |
   | modules | C: hbase-common U: hbase-common |
   | Console output | https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-2056/2/console |
   | versions | git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) shellcheck=0.4.6 |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] petersomogyi commented on a change in pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
petersomogyi commented on a change in pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#discussion_r457390607



##########
File path: hbase-common/src/saveVersion.sh
##########
@@ -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`

Review comment:
       I get a different output from your command, an extra %.
   ```
   find hbase-*/src/main/ | grep -e "\.java" -e "\.proto" | LC_ALL=C sort | xargs gpg --print-md sha512 | gpg --print-md sha512 | tr -d '[:space:]'
   3BF4CCC275112769C7AB0EDC302793FB81005BDC9681E1604BD965918363FC93311FC60B24000563DD4D3EFDA10685F549721A28428F23487813A7397FBC9BD0%
   ind 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'
   3BF4CCC275112769C7AB0EDC302793FB81005BDC9681E1604BD965918363FC93311FC60B24000563DD4D3EFDA10685F549721A28428F23487813A7397FBC9BD0
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] Apache-HBase commented on pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#issuecomment-657690725


   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   0m 30s |  Docker mode activated.  |
   | -0 :warning: |  yetus  |   0m  3s |  Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck  |
   ||| _ Prechecks _ |
   ||| _ master Compile Tests _ |
   ||| _ Patch Compile Tests _ |
   ||| _ Other Tests _ |
   |  |   |   1m 30s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | Client=19.03.12 Server=19.03.12 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-2056/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/2056 |
   | Optional Tests |  |
   | uname | Linux 80a0d3c99aea 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / 3bd54217a0 |
   | Max. process+thread count | 46 (vs. ulimit of 12500) |
   | modules | C: hbase-common U: hbase-common |
   | Console output | https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-2056/1/console |
   | versions | git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] liuml07 commented on pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
liuml07 commented on pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#issuecomment-659935497


   LGTM


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] Apache-HBase commented on pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#issuecomment-657689593


   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   0m 29s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files found.  |
   | +0 :ok: |  shelldocs  |   0m  0s |  Shelldocs was not available.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any @author tags.  |
   ||| _ master Compile Tests _ |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  shellcheck  |   0m  1s |  The patch generated 0 new + 0 unchanged - 10 fixed = 0 total (was 10)  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace issues.  |
   ||| _ Other Tests _ |
   | +1 :green_heart: |  asflicense  |   0m 13s |  The patch does not generate ASF License warnings.  |
   |  |   |   2m  0s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | Client=19.03.12 Server=19.03.12 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-2056/1/artifact/yetus-general-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/2056 |
   | Optional Tests | dupname asflicense shellcheck shelldocs |
   | uname | Linux db9b5a7138d5 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / 3bd54217a0 |
   | Max. process+thread count | 47 (vs. ulimit of 12500) |
   | modules | C: hbase-common U: hbase-common |
   | Console output | https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-2056/1/console |
   | versions | git=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) shellcheck=0.4.6 |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [hbase] petersomogyi commented on a change in pull request #2056: HBASE-24710 Incorrect checksum calculation in saveVersion.sh

Posted by GitBox <gi...@apache.org>.
petersomogyi commented on a change in pull request #2056:
URL: https://github.com/apache/hbase/pull/2056#discussion_r455187162



##########
File path: hbase-common/src/saveVersion.sh
##########
@@ -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')

Review comment:
       Yes, dropping `|` is a bug, let me fix it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org