util-linux/bash-completion-fix-few-bash-set-u-issues.patch

158 lines
5.0 KiB
Diff
Raw Normal View History

2019-09-30 11:19:16 -04:00
From c6f0bdfecc7b1bbadc644eb8f625473c34fe7cae Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
Date: Thu, 5 Apr 2018 20:56:53 +0100
Subject: [PATCH 033/686] bash-completion: fix few bash set -u issues
This is the same fix as in reference commit, and the same reason. Just
correct few files missed earlier.
Reference: abbcec4fc9c8d7fb835b4eafd1bc9d82acbf0056
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
bash-completion/chcpu | 4 ++--
bash-completion/lsblk | 10 +++++-----
bash-completion/lscpu | 2 +-
bash-completion/lslogins | 2 +-
bash-completion/lsns | 2 +-
bash-completion/mount | 2 +-
bash-completion/setpriv | 2 +-
bash-completion/taskset | 2 +-
8 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/bash-completion/chcpu b/bash-completion/chcpu
index 33991f4..0d96c25 100644
--- a/bash-completion/chcpu
+++ b/bash-completion/chcpu
@@ -12,7 +12,7 @@ _chcpu_module()
CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline)
for WORD in $(eval echo $CPULIST_ALL); do
if ! [[ $prefix == *"$WORD"* ]]; then
- CPULIST="$WORD $CPULIST"
+ CPULIST="$WORD ${CPULIST:-""}"
fi
done
compopt -o nospace
@@ -26,7 +26,7 @@ _chcpu_module()
CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online)
for WORD in $(eval echo $CPULIST_ALL); do
if ! [[ $prefix == *"$WORD"* ]]; then
- CPULIST="$WORD $CPULIST"
+ CPULIST="$WORD ${CPULIST:-""}"
fi
done
compopt -o nospace
diff --git a/bash-completion/lsblk b/bash-completion/lsblk
index 4fef8fc..bd86f9f 100644
--- a/bash-completion/lsblk
+++ b/bash-completion/lsblk
@@ -20,15 +20,15 @@ _lsblk_module()
prefix="${cur%$realcur}"
for I in /sys/dev/block/*; do
J=${I##*/}
- MAJOR_ALL="$MAJOR_ALL ${J%%:*}"
+ MAJOR_ALL="${MAJOR_ALL:-""} ${J%%:*}"
done
- for WORD in $MAJOR_ALL; do
+ for WORD in ${MAJOR_ALL:-""}; do
if ! [[ $prefix == *"$WORD"* ]]; then
- MAJOR="$WORD $MAJOR"
+ MAJOR="$WORD ${MAJOR:-""}"
fi
done
compopt -o nospace
- COMPREPLY=( $(compgen -P "$prefix" -W "$MAJOR" -S ',' -- $realcur) )
+ COMPREPLY=( $(compgen -P "$prefix" -W "${MAJOR:-""}" -S ',' -- $realcur) )
return 0
;;
'-o'|'--output')
@@ -37,7 +37,7 @@ _lsblk_module()
prefix="${cur%$realcur}"
for WORD in $LSBLK_COLS_ALL; do
if ! [[ $prefix == *"$WORD"* ]]; then
- LSBLK_COLS="$WORD $LSBLK_COLS"
+ LSBLK_COLS="$WORD ${LSBLK_COLS:-""}"
fi
done
compopt -o nospace
diff --git a/bash-completion/lscpu b/bash-completion/lscpu
index d16af35..69337ac 100644
--- a/bash-completion/lscpu
+++ b/bash-completion/lscpu
@@ -15,7 +15,7 @@ _lscpu_module()
CONFIGURED ONLINE MAXMHZ MINMHZ"
for WORD in $OPTS_ALL; do
if ! [[ $prefix == *"$WORD"* ]]; then
- OPTS="$WORD $OPTS"
+ OPTS="$WORD ${OPTS:-""}"
fi
done
compopt -o nospace
diff --git a/bash-completion/lslogins b/bash-completion/lslogins
index 967b644..795b5d8 100755
--- a/bash-completion/lslogins
+++ b/bash-completion/lslogins
@@ -35,7 +35,7 @@ _lslogins_module()
prefix="${cur%$realcur}"
for WORD in $LSLOGINS_COLS_ALL; do
if ! [[ $prefix == *"$WORD"* ]]; then
- LSLOGINS_COLS="$WORD $LSLOGINS_COLS"
+ LSLOGINS_COLS="$WORD ${LSLOGINS_COLS:-""}"
fi
done
compopt -o nospace
diff --git a/bash-completion/lsns b/bash-completion/lsns
index 8cf0a31..035f43b 100644
--- a/bash-completion/lsns
+++ b/bash-completion/lsns
@@ -14,7 +14,7 @@ _lsns_module()
prefix="${cur%$realcur}"
for WORD in $LSNS_COLS_ALL; do
if ! [[ $prefix == *"$WORD"* ]]; then
- LSNS_COLS="$WORD $LSNS_COLS"
+ LSNS_COLS="$WORD ${LSNS_COLS:-""}"
fi
done
compopt -o nospace
diff --git a/bash-completion/mount b/bash-completion/mount
index 9a33913..c7e4bea 100644
--- a/bash-completion/mount
+++ b/bash-completion/mount
@@ -15,7 +15,7 @@ _mount_module()
prefix="${cur%$realcur}"
for WORD in $TYPES; do
if ! [[ $prefix == *"$WORD"* ]]; then
- TYPE_COLS="$WORD $TYPE_COLS"
+ TYPE_COLS="$WORD ${TYPE_COLS:-""}"
fi
done
compopt -o nospace
diff --git a/bash-completion/setpriv b/bash-completion/setpriv
index 8ab9e07..bf4737a 100644
--- a/bash-completion/setpriv
+++ b/bash-completion/setpriv
@@ -38,7 +38,7 @@ _setpriv_module()
GIDS_ALL=$(getent group | awk -F: '{print $3}')
for WORD in $GIDS_ALL; do
if ! [[ $prefix == *"$WORD"* ]]; then
- GIDS="$WORD $GIDS"
+ GIDS="$WORD ${GIDS:-""}"
fi
done
compopt -o nospace
diff --git a/bash-completion/taskset b/bash-completion/taskset
index 453b17b..7c9a7bd 100644
--- a/bash-completion/taskset
+++ b/bash-completion/taskset
@@ -12,7 +12,7 @@ _taskset_module()
CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online)
for WORD in $(eval echo $CPULIST_ALL); do
if ! [[ $prefix == *"$WORD"* ]]; then
- CPULIST="$WORD $CPULIST"
+ CPULIST="$WORD ${CPULIST:-""}"
fi
done
compopt -o nospace
--
1.8.3.1