Age | Commit message (Collapse) | Author | Files | Lines |
|
Variable attribute 'local' is not POSIX but is LSB supported.
It is available in other shells such as ash or dash.
And in ksh, local is the default scope of functions vaiables.
Though, the syntax "local var=XX" is only supported and found in bash.
Sadly, this is not detected by checkbashims.
- fix "local var=XX" bashisms
- add a manual command in tox.ini to detect them in the CI
https://wiki.ubuntu.com/DashAsBinSh#local
https://wiki.ubuntu.com/DashAsBinSh#declare_or_typeset
https://stackoverflow.com/questions/12000949/scope-of-variables-in-ksh
Issue-ID: OOM-2643
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: Iff26e50cd352eeb760d923a4740a6f92184fe0f2
|
|
- add checkbahims to tox.ini default profiles
- remove -f options to unforce bashisms detection in explicit bash
scripts and to differentiate treatments between bash and sh
- migrate #!/bin/bash shebangs to #!/bin/sh for scripts without bashisms
The following scripts have not been migrated since they still use
bashisms difficult to migrate (mostly arrays - more details below)
./kubernetes/common/mariadb-init/resources/config/db_init.sh
./kubernetes/portal/components/portal-mariadb/resources/config/ \
mariadb/docker-entrypoint.sh
./kubernetes/helm/plugins/deploy/deploy.sh
./kubernetes/helm/plugins/undeploy/undeploy.sh
./kubernetes/sdnc/components/sdnc-prom/resources/bin/ensureSdncActive.sh
$ find . -not -path '*/\.*' -name *.sh -exec checkbashisms -f {} + 2>&1\
| grep line | cut -d' ' -f 7- | sort | uniq -c | sort -k1,1nr
18 (bash arrays, ${name[0|*|@]}):
2 (declare):
1 ($FUNCNAME):
1 (shopt):
1 (trap with ERR|DEBUG|RETURN):
https://mywiki.wooledge.org/Bashism#Arrays
https://mywiki.wooledge.org/Bashism#Special_Variables
https://mywiki.wooledge.org/Bashism#Builtins
https://www.oilshell.org/release/0.5.alpha2/test/spec.wwz/builtin-trap.html
Issue-ID: OOM-2643
Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Change-Id: Id06ad1d45004321a293bdd26038d8da5f7b6b4ac
|
|
with the following command
$ find . -not -path '*/\.*' -name *.sh -exec sed -i 's/\t/ /g' {} +
then realign manually what deserves it and in particular,
unindent some EOF scripting tags so they do not trigger errors.
Issue-ID: OOM-2643
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: Ibfa463ec8083d5a39de18a54d9c1d8746710fe03
|
|
pointed out by checkbashisms
Issue-ID: OOM-264
Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Change-Id: Ief3b2595a55f0e7a0a2e7ab05857848c99ce42f9
|
|
pointed out by checkbashisms
$ mycmd=$(tox -e checkbashisms
| grep '(\[\[ foo \]\] should be \[ foo \])'
| sed -e "s@^[^.]*\(.[^ ]*\) line \([0-9]*\) .*@sed -i '\2s/\\\[\\\[\\\(
[^]]*\\\)\\\]\\\]/[\\\1]/g' \1;@")
$ eval $mycmd
plus fix manually quoting hells induced and bash specific regex
and multi-conditions
Issue-ID: OOM-2643
Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Change-Id: Ie7ca5b71938fae22c200b7fead418618160fbe19
|
|
pointed out by checkbashisms.
$ mycmd=$(tox -e checkbashisms | grep "^possible .*'function' is useless
" | sed -e "s@^[^.]*\(.[^ ]*\) line \([0-9]*\) .*@sed -i -e '\2s/functio
n \\\([^ ()]*\\\) *(\\\?)\\\?/\\\1 ()/\' -e '\2s/(){/() {/' \1;@")
$ eval $mycmd
Issue-ID: OOM-2643
Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Change-Id: Ic41c8ba8288b7a90db9f5775cd601c09ff2ab663
|
|
Change-Id: I1dc5a109d6a98ce5f281f3cec07d423bfbb2565a
Issue-ID: OOM-603
Signed-off-by: mayankg2703 <mayank.gupta@amdocs.com>
|
|
Issue-ID: OOM-328
Change-Id: I7a646f53df0ac11cf3c1895243f905b7fe210b3c
Signed-off-by: mayankg2703 <mayank.gupta@amdocs.com>
|