Bug#745731: initialize FSTYPE variable
Package: initramfs-tools
Version: 0.115
Severity: normal
Tags: patch
On the hppa platform the fstype program from klibc crashed (details in Bug#745660) which exposed a problem in the
get_fstype() shell function in file scripts/functions.
In this script, fstype is called like this:
eval $(fstype "${FS}" 2> /dev/null)
if [ "$FSTYPE" = "unknown" ] ....
Since fstype crashed and returned nothing in the variable "FSTYPE", FSTYPE stayed empty instead of the value "unknown" and as such no further analysis via blkid was done.
I think it makes sense to pre-initialize FSTYPE to the value "unknown" before calling fstype. That way the program logic will continue correctly if something with the fstype program is wrong.
Attached script fixes this.
Please apply.
Signed-off-by: Helge Deller <deller@gmx.de>
diff -up ./scripts/functions.org ./scripts/functions
--- ./scripts/functions.org 2014-04-24 15:44:54.104641201 +0200
+++ ./scripts/functions 2014-04-24 15:45:35.809485678 +0200
@@ -307,6 +307,7 @@ get_fstype ()
# blkid has a more complete list of file systems,
# but fstype is more robust
+ FSTYPE="unknown"
eval $(fstype "${FS}" 2> /dev/null)
if [ "$FSTYPE" = "unknown" ] && command -v blkid >/dev/null 2>&1 ; then
FSTYPE=$(blkid -o value -s TYPE "${FS}")
Reply to: