Skip to content

Commit b807460

Browse files
committed
*: avoid more errors in nounset mode
Refs scop#44
1 parent 1293d7c commit b807460

File tree

9 files changed

+12
-12
lines changed

9 files changed

+12
-12
lines changed

bash_completion

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ _known_hosts_real()
16411641
kh=()
16421642

16431643
# ssh config files
1644-
if [[ -n $configfile ]]; then
1644+
if [[ -v configfile ]]; then
16451645
[[ -r $configfile ]] && config+=("$configfile")
16461646
else
16471647
for i in /etc/ssh/ssh_config ~/.ssh/config ~/.ssh2/config; do
@@ -1679,7 +1679,7 @@ _known_hosts_real()
16791679
done
16801680
fi
16811681

1682-
if [[ -z $configfile ]]; then
1682+
if [[ ! -v configfile ]]; then
16831683
# Global and user known_hosts files
16841684
for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \
16851685
/etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \

completions/_adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ _adb()
3333
fi
3434
done
3535

36-
if [[ ! $cmd ]]; then
36+
if [[ ! -v cmd ]]; then
3737
local tmp=()
3838
if [[ ! $cur || $cur == -* ]]; then
3939
tmp+=($(compgen -W '$(_parse_help "$1" help)' -- "$cur"))

completions/ant

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ _ant()
7777
fi
7878
done
7979
if ((i == cword)); then
80-
for i in $ANT_ARGS; do
80+
for i in ${ANT_ARGS-}; do
8181
if [[ $prev == -@(?(build)file|f) ]]; then
8282
buildfile=$i
8383
break

completions/apt-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ _apt_build()
1313
fi
1414
done
1515

16-
if [[ -n $special ]]; then
16+
if [[ -v special ]]; then
1717
case $special in
1818
install | source | info)
1919
COMPREPLY=($(_xfunc apt-cache _apt_cache_packages))

completions/carton

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ _carton()
2929
esac
3030
done
3131

32-
if [[ -z $command ]]; then
32+
if [[ ! -v command ]]; then
3333
_carton_commands "$1"
3434
return
3535
fi

completions/dmypy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ _dmypy()
2323
fi
2424
done
2525

26-
case $cmd in
26+
case ${cmd-} in
2727
check | run)
2828
_filedir '@(py|pyi)'
2929
return
@@ -35,7 +35,7 @@ _dmypy()
3535
return
3636
fi
3737

38-
if [[ ! $cmd ]]; then
38+
if [[ ! -v cmd ]]; then
3939
local cmds=$($1 --help 2>&1 |
4040
command sed -ne '/positional arguments/{p;n;p;q}' |
4141
command sed -ne 's/{\(.*\)}/\1/p')

completions/valgrind

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ _valgrind()
7070
;;
7171
# generic cases parsed from --help output
7272
--+([-A-Za-z0-9_]))
73-
local value=$($1 --help-debug $tool 2>/dev/null |
73+
local value=$($1 --help-debug ${tool-} 2>/dev/null |
7474
command sed -ne "s|^[[:blank:]]*$prev=\([^[:blank:]]\{1,\}\).*|\1|p")
7575
case $value in
7676
\<file*\>)
@@ -100,7 +100,7 @@ _valgrind()
100100
$split && return
101101

102102
if [[ $cur == -* ]]; then
103-
COMPREPLY=($(compgen -W '$(_parse_help "$1" "--help $tool")' \
103+
COMPREPLY=($(compgen -W '$(_parse_help "$1" "--help ${tool-}")' \
104104
-- "$cur"))
105105
[[ $COMPREPLY == *= ]] && compopt -o nospace
106106
return

completions/xrandr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _xrandr()
2424
break
2525
fi
2626
done
27-
if [[ $output ]]; then
27+
if [[ -v output ]]; then
2828
local modes=$("$1" | command sed -e "1,/^$output / d" \
2929
-e "/connected/,$ d" \
3030
-e "s/\([^[:space:]]\)[[:space:]].*/\1/")

test/t/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def assert_complete(
496496
# Back up environment and apply new one
497497
assert_bash_exec(
498498
bash,
499-
" ".join('%s%s="$%s"' % (env_prefix, k, k) for k in env.keys()),
499+
" ".join('%s%s="${%s-}"' % (env_prefix, k, k) for k in env.keys()),
500500
)
501501
assert_bash_exec(
502502
bash,

0 commit comments

Comments
 (0)