Bug#560125: freebsd-utils: Insufficient quoting in init.d script
while debugging some stuff, I stumbled upon this:
| /etc/init.d/freebsd-utils: line 88: [: !=: unary operator expected
Indeed, the $(readlink …) part isn't quoted so if it returns nothing,
the test operates on “ != "/proc/mounts"” with a missing argument. That
may happen during debootstrapping.
Please find attached a trivial patch against glibc-bsd's trunk to fix
[ As a side note: One may wonder, but even though the script is “set
-e”, later instructions are executed anyway (I was interested in such
As another (more interesting) side-note, that can break (I guess)
depending on the partitioning(?):
| + ln -f /proc/mounts /etc/mtab
| ln: creating hard link `/etc/mtab' => `/proc/mounts': Invalid cross-device link
I guess another bugreport about that is in order.
>From add2852d086fdfd78d55d5fecefcc99755d9b94f Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <firstname.lastname@example.org>
Date: Wed, 9 Dec 2009 06:09:49 +0100
Subject: [PATCH] Fix quoting in init script.
Content-Type: text/plain; charset=UTF-8
$(readlink …) may return an empty string, resulting in a missing
freebsd-utils/debian/freebsd-utils.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/freebsd-utils/debian/freebsd-utils.init b/freebsd-utils/debian/freebsd-utils.init
index 4924bb0..07ab0cf 100644
@@ -85,7 +85,7 @@ case "$1" in
- if [ $(readlink /etc/mtab) != "/proc/mounts" ] ; then
+ if [ "$(readlink /etc/mtab)" != "/proc/mounts" ] ; then
echo "Warning: replacing /etc/mtab by a symlink to /proc/mounts."
rm -f /etc/mtab
ln -f /proc/mounts /etc/mtab