apache / kyuubi

Apache Kyuubi is a distributed and multi-tenant gateway to provide serverless SQL on data warehouses and lakehouses.
https://kyuubi.apache.org/
Apache License 2.0
2.09k stars 910 forks source link

[Bug] shell script about the var wrong #4057

Open davidyuan1223 opened 1 year ago

davidyuan1223 commented 1 year ago

Code of Conduct

Search before asking

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?

davidyuan1223 commented 1 year ago

I don't know the issue is right or wrong, should I fix that?