apache / apache/kyuubi

[Bug] shell script about the var wrong

Open
#4,057 1 comment 0 reactions 0 assignees View on GitHub
kind:bug priority:major
Dominant language
Scala
Stars
2.4k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

### Search before asking

- [X] I have searched in the [issues](https://github.com/apache/incubator-kyuubi/issues?q=is%3Aissue) and found no similar issues.

### Describe the bug

description: I'm trying to solve the issue about #2062 , the job is to add shell style check util to the GitHub action, I try to add that in my fork project, when test the shellcheck, I found some script syntax errors
1. it's about /bin/stop-application.sh , the reason is $# is a int type, if we want compare, we should us -lt\-gt, but the script us < or >
2. it's about /bin/kyuubi, we use exit -1, I know if we not use the code 0, it always report failed, but in shell, the right number is 0-255
3. it's about bin/docker-image-tool.sh, we should use #* replace #@

```
In bin/docker-image-tool.sh line 230:
if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
^--^ SC2199: Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @).
^--^ SC2199: Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @).
```

```
In bin/kyuubi line 33:
if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
^--^ SC2199: Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @).
^--^ SC2199: Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @)
In bin/kyuubi line 51:
exit -1
^-- SC2242: Can only exit with status 0-255. Other data should be written to stdout/stderr.
```

```
In bin/stop-application.sh line 19:
if [[ $# < 1 ]] ; then
^-- SC2071: < is for string comparisons. Use -lt instead.
```

I think we should fix the bug in fix #206

### Affects Version(s)

master

### Kyuubi Server Log Output

_No response_

### Kyuubi Engine Log Output

_No response_

### Kyuubi Server Configurations

_No response_

### Kyuubi Engine Configurations

_No response_

### Additional context

_No response_

### Are you willing to submit PR?

- [X] Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
- [ ] No. I cannot submit a PR at this time.

Contributor guide

Open the contributing guide

Research direction

Start by running ShellCheck against bin/stop-application.sh, bin/kyuubi, and bin/docker-image-tool.sh and compare the output with the diagnostics in the issue. Review each reported line and the surrounding argument handling, then confirm that the listed warnings and errors are gone and the shell-style check can pass in the GitHub Action.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, shell
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.