Skip to content

Conversation

@Yikun
Copy link
Member

@Yikun Yikun commented May 20, 2021

What changes were proposed in this pull request?

Use > /dev/null to replace -q in shasum validation.

Why are the changes needed?

In PR #32505 , added the shasum check on maven. The shasum -a 512 -q -c xxx.sha is used to validate checksum, the -q args is for "don't print OK for each successfully verified file", but -q arg is introduce in shasum 6.x version.

So we got the Unknown option: q.

➜  ~ uname -a
Darwin MacBook.local 19.6.0 Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT 2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64 x86_64
➜  ~ shasum -v
5.84
➜  ~ shasum -q
Unknown option: q
Type shasum -h for help

it makes ARM CI failed:
[1] https://amplab.cs.berkeley.edu/jenkins/job/spark-master-test-maven-arm/

Does this PR introduce any user-facing change?

No

How was this patch tested?

shasum -a 512 -c wrong.sha > /dev/null return code 1 without print
shasum -a 512 -c right.sha > /dev/null return code 0 without print
e2e test:

rm -f build/apache-maven-3.6.3-bin.tar.gz
rm -r build/apache-maven-3.6.3-bin
mvn -v

@github-actions github-actions bot added the BUILD label May 20, 2021
@Yikun
Copy link
Member Author

Yikun commented May 20, 2021

cc @srowen

@SparkQA
Copy link

SparkQA commented May 20, 2021

build/mvn Outdated
# Assuming SHA512 here for now
echo "Veryfing checksum from ${local_checksum}" 1>&2
if ! shasum -a 512 -q -c "${local_checksum}" ; then
if ! shasum -a 512 -c "${local_checksum}" > /dev/null 2>&1 ; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we remove "2>&1"? So that the error message can be shown

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, just let wrong message print.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update the PR description, too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@SparkQA
Copy link

SparkQA commented May 20, 2021

@SparkQA
Copy link

SparkQA commented May 20, 2021

Test build #138734 has finished for PR 32604 at commit 3417c22.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@Yikun Yikun changed the title [SPARK-35458][BUILD] Use > /dev/null 2>&1 to replace -q in shasum [SPARK-35458][BUILD] Use > /dev/null to replace -q in shasum May 20, 2021
@maropu
Copy link
Member

maropu commented May 20, 2021

lgtm

Copy link
Member

@gengliangwang gengliangwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SparkQA
Copy link

SparkQA commented May 20, 2021

@SparkQA
Copy link

SparkQA commented May 20, 2021

@srowen
Copy link
Member

srowen commented May 20, 2021

Weird, I have 6.02 on my Macbook so it works. Yeah seems fine.

@srowen
Copy link
Member

srowen commented May 20, 2021

@Yikun you don't have to take this on here, but it was also noted that shasum may not be present, like on some Amazon Linux distros. We could also skip validation if it's not present by adding an additional test here.

@Yikun
Copy link
Member Author

Yikun commented May 20, 2021

Weird, I have 6.02 on my Macbook so it works. Yeah seems fine.

I think the -q arg is added in shasum 6.x, but I didn't see any release note about shasum.

I also found the ubuntu 18.04 arm is using shasum 5.x, so it raise unsupport message. And my Mac is shasum 5.x is also unsupport.

And i found it because the arm ci is breaked, so I thought > /dev/null is a better and safe way to address shasum different version behaviors.

@Yikun
Copy link
Member Author

Yikun commented May 20, 2021

@Yikun you don't have to take this on here, but it was also noted that shasum may not be present, like on some Amazon Linux distros. We could also skip validation if it's not present by adding an additional test here.

OK, got it, I'd like to also add a 'command -v shasum' to check the shasum is installed or not, before shasum check.

But i still think /dev/null is usefull to make 5.x and 6.x shasum work, and your idea?

@srowen
Copy link
Member

srowen commented May 20, 2021

I think I have shasum 6.x via brew so that's why I didn't catch it. Yes removing -q seems fine.
Yes the second idea is separate - just wondering if you had a second to add that during this change. I don't mind warning if it's not found, and proceeding.

@SparkQA
Copy link

SparkQA commented May 20, 2021

Test build #138749 has finished for PR 32604 at commit 23eee59.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@Yikun
Copy link
Member Author

Yikun commented May 20, 2021

Yes the second idea is separate - just wondering if you had a second to add that during this change. I don't mind warning if it's not found, and proceeding.

If it's not found, the build mvn would be breaked with exit 2. Then, the developer can install the shasum mannually.

So, command -v is not very important in here, I prefer to keep current change in here.

( Sorry for typing slowly in mobile phone, and if any other followup, I will address after 12 hours when I back to my dev PC, or you can feel free to help to change this pr. : ) )

@srowen
Copy link
Member

srowen commented May 20, 2021

The change here is fine. yes the whole idea would be to not fail outright, but, maybe you're right that we can't let people skip this step.

@srowen
Copy link
Member

srowen commented May 20, 2021

Jenkins test this please

@SparkQA
Copy link

SparkQA commented May 20, 2021

@SparkQA
Copy link

SparkQA commented May 20, 2021

Test build #138761 has finished for PR 32604 at commit 23eee59.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen srowen closed this in 38fbc0b May 20, 2021
srowen pushed a commit that referenced this pull request May 20, 2021
## What changes were proposed in this pull request?
Use ` > /dev/null` to replace `-q` in shasum validation.

### Why are the changes needed?
In PR #32505 , added the shasum check on maven. The `shasum -a 512 -q -c xxx.sha` is used to validate checksum, the `-q` args is for "don't print OK for each successfully verified file", but `-q` arg is introduce in shasum 6.x version.

So we got the `Unknown option: q`.

```
➜  ~ uname -a
Darwin MacBook.local 19.6.0 Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT 2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64 x86_64
➜  ~ shasum -v
5.84
➜  ~ shasum -q
Unknown option: q
Type shasum -h for help
```

it makes ARM CI failed:
[1] https://amplab.cs.berkeley.edu/jenkins/job/spark-master-test-maven-arm/

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
`shasum -a 512 -c wrong.sha  > /dev/null` return code 1 without print
`shasum -a 512 -c right.sha  > /dev/null` return code 0 without print
e2e test:
```
rm -f build/apache-maven-3.6.3-bin.tar.gz
rm -r build/apache-maven-3.6.3-bin
mvn -v
```

Closes #32604 from Yikun/patch-5.

Authored-by: Yikun Jiang <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
(cherry picked from commit 38fbc0b)
Signed-off-by: Sean Owen <[email protected]>
srowen pushed a commit that referenced this pull request May 20, 2021
## What changes were proposed in this pull request?
Use ` > /dev/null` to replace `-q` in shasum validation.

### Why are the changes needed?
In PR #32505 , added the shasum check on maven. The `shasum -a 512 -q -c xxx.sha` is used to validate checksum, the `-q` args is for "don't print OK for each successfully verified file", but `-q` arg is introduce in shasum 6.x version.

So we got the `Unknown option: q`.

```
➜  ~ uname -a
Darwin MacBook.local 19.6.0 Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT 2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64 x86_64
➜  ~ shasum -v
5.84
➜  ~ shasum -q
Unknown option: q
Type shasum -h for help
```

it makes ARM CI failed:
[1] https://amplab.cs.berkeley.edu/jenkins/job/spark-master-test-maven-arm/

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
`shasum -a 512 -c wrong.sha  > /dev/null` return code 1 without print
`shasum -a 512 -c right.sha  > /dev/null` return code 0 without print
e2e test:
```
rm -f build/apache-maven-3.6.3-bin.tar.gz
rm -r build/apache-maven-3.6.3-bin
mvn -v
```

Closes #32604 from Yikun/patch-5.

Authored-by: Yikun Jiang <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
(cherry picked from commit 38fbc0b)
Signed-off-by: Sean Owen <[email protected]>
@srowen
Copy link
Member

srowen commented May 20, 2021

Merged to master/3.1/3.0

@dongjoon-hyun
Copy link
Member

Let me rebase and check this, @srowen . Thanks, @srowen .

@dongjoon-hyun
Copy link
Member

Well, it's the same to me.

root@a0e001a6e50f:/spark# build/mvn clean
exec: curl --silent --show-error -L https://downloads.lightbend.com/scala/2.12.10/scala-2.12.10.tgz
exec: curl --silent --show-error -L https://www.apache.org/dyn/closer.lua/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz?action=download
exec: curl --silent --show-error -L https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz.sha512
Veryfing checksum from /spark/build/apache-maven-3.6.3-bin.tar.gz.sha512
build/mvn: line 81: shasum: command not found
Bad checksum from https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz.sha512

@dongjoon-hyun
Copy link
Member

dongjoon-hyun commented May 20, 2021

@Yikun and @srowen . We cannot enforce to install shasum additionally. That's another requirement.

If it's not found, the build mvn would be breaked with exit 2. Then, the developer can install the shasum mannually.

If we can ask the users to install additionally, why do we need to download Maven via wrapper on-demand by wasting lots of resources. We can just fail at Maven-enforcer plugin and add documents. It's not that easy to add another requirements.

@srowen
Copy link
Member

srowen commented May 20, 2021

Yes, this is not related to your issue - this makes it work with shasum 5.x

I don't know if I agree with your assessment here - AFAICT almost all distros have shasum, just stripped down ones like AWS Linux, so this is only a new requirements for a few developers (? I think). But I don't disagree with the conclusion, just warn and skip if not found.

flyrain pushed a commit to flyrain/spark that referenced this pull request Sep 21, 2021
## What changes were proposed in this pull request?
Use ` > /dev/null` to replace `-q` in shasum validation.

### Why are the changes needed?
In PR apache#32505 , added the shasum check on maven. The `shasum -a 512 -q -c xxx.sha` is used to validate checksum, the `-q` args is for "don't print OK for each successfully verified file", but `-q` arg is introduce in shasum 6.x version.

So we got the `Unknown option: q`.

```
➜  ~ uname -a
Darwin MacBook.local 19.6.0 Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT 2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64 x86_64
➜  ~ shasum -v
5.84
➜  ~ shasum -q
Unknown option: q
Type shasum -h for help
```

it makes ARM CI failed:
[1] https://amplab.cs.berkeley.edu/jenkins/job/spark-master-test-maven-arm/

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
`shasum -a 512 -c wrong.sha  > /dev/null` return code 1 without print
`shasum -a 512 -c right.sha  > /dev/null` return code 0 without print
e2e test:
```
rm -f build/apache-maven-3.6.3-bin.tar.gz
rm -r build/apache-maven-3.6.3-bin
mvn -v
```

Closes apache#32604 from Yikun/patch-5.

Authored-by: Yikun Jiang <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
(cherry picked from commit 38fbc0b)
Signed-off-by: Sean Owen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants