mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
tests/int: fix runc_spec for set -u
Older bash versions treats variable as unset if nothing has been
assigned to it. Here is an example from CentOS 7 system:
[kir@localhost ~]$ bash -u -c 'x() { local args=(); echo "${args[@]}"; }; x'
bash: args[@]: unbound variable
[kir@localhost ~]$ echo $BASH_VERSION
4.2.46(2)-release
Rewrite to work around this.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -59,12 +59,10 @@ function __runc() {
|
||||
|
||||
# Wrapper for runc spec.
|
||||
function runc_spec() {
|
||||
local args=()
|
||||
if [ "$ROOTLESS" -ne 0 ]; then
|
||||
args+=("--rootless")
|
||||
fi
|
||||
local rootless=""
|
||||
[ "$ROOTLESS" -ne 0 ] && rootless="--rootless"
|
||||
|
||||
runc spec "${args[@]}"
|
||||
runc spec $rootless
|
||||
|
||||
# Always add additional mappings if we have idmaps.
|
||||
if [[ "$ROOTLESS" -ne 0 ]] && [[ "$ROOTLESS_FEATURES" == *"idmap"* ]]; then
|
||||
|
||||
Reference in New Issue
Block a user