[CRIU] [PATCH] scripts: fix strings comparison in systemd-autofs-restart.sh

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Tue May 24 08:08:05 PDT 2016


Otherwise the following errors can be triggered:

/usr/libexec/criu/scripts/systemd-autofs-restart.sh: line 64: [: =: unary
operator expected
/usr/libexec/criu/scripts/systemd-autofs-restart.sh: line 77: [: =: unary
operator expected

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 scripts/systemd-autofs-restart.sh |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/systemd-autofs-restart.sh b/scripts/systemd-autofs-restart.sh
index 58c0bf4..0eec52c 100755
--- a/scripts/systemd-autofs-restart.sh
+++ b/scripts/systemd-autofs-restart.sh
@@ -37,7 +37,7 @@ fi
 JOIN_CT="$NS_ENTER -t $CRTOOLS_INIT_PID -m -u -p"
 
 # Skip container, if it's not systemd based
-[ $($JOIN_CT basename -- $(readlink /proc/1/exe)) == "systemd" ] || exit 0
+[ "$($JOIN_CT basename -- $(readlink /proc/1/exe))" == "systemd" ] || exit 0
 
 AUTOFS_SERVICES="proc-sys-fs-binfmt_misc.automount"
 
@@ -61,7 +61,7 @@ function check_fs_type {
 
 	while IFS='' read -r line || [[ -n "$line" ]]; do
 		# Skip those entries which do not match the mountpoint
-		[ $(echo $line | awk '{print $5;}') = $mountpoint ] || continue
+		[ "$(echo $line | awk '{print $5;}')" = "$mountpoint" ] || continue
 
 		local mnt_id=$(echo $line | awk '{print $1;}')
 		local mnt_parent_id=$(echo $line | awk '{print $2;}')
@@ -74,7 +74,7 @@ function check_fs_type {
 		top_mount_fs_type=$mnt_fs_type
 	done < "/proc/$CRTOOLS_INIT_PID/mountinfo"
 
-	[ $top_mount_fs_type = $fs_type ]
+	[ "$top_mount_fs_type" = "$fs_type" ]
 }
 
 function bind_mount {



More information about the CRIU mailing list