aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZev Weiss <zev@bewilderbeest.net>2017-03-21 20:07:48 -0500
committerZev Weiss <zev@bewilderbeest.net>2017-03-21 20:07:48 -0500
commit046266a2f776b770e18115d8c9a764c9498b78a8 (patch)
tree962b944ce44a1578d674612d48817f5913bd7a8d
parent3be28dc57a7f0698d290e9e8686aa7e0fbec0801 (diff)
downloadvirtme-046266a2f776b770e18115d8c9a764c9498b78a8.tar.gz
virtme-init: avoid a warning from bash
As of version 4.4 bash now warns about null bytes in command substitutions. Sidestep it here by using sed to strip the null terminator off the contents of 9pnet_virtio's mount_tag sysfs attributes. Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
-rwxr-xr-xvirtme/guest/virtme-init5
1 files changed, 4 insertions, 1 deletions
diff --git a/virtme/guest/virtme-init b/virtme/guest/virtme-init
index f7f1069..0a17c2b 100755
--- a/virtme/guest/virtme-init
+++ b/virtme/guest/virtme-init
@@ -19,7 +19,10 @@ mount -t sysfs -o nosuid,noexec,nodev sys /sys/
declare -A mount_tags
for i in /sys/bus/virtio/drivers/9pnet_virtio/virtio*/mount_tag; do
- mount_tags["`cat "$i"`"]=1
+ # mount_tag is terminated with a NUL byte, which leads to a
+ # "command substitution: ignored null byte in input" warning from
+ # bash; use sed instead of a bare 'cat' here to strip it off.
+ mount_tags["`sed '$s/\x00$//;' "$i"`"]=1
done
kver="`uname -r`"