testing a loopback device without filesystem causes a crash
Dear all,
On fezie's request I am reporting a possible bug that I experienced when running the following:
loopback loop0 /path/to/myfile
if [ -e (loop0)/some/file ]; then
echo ok
fi
If /path/to/myfile does not contain a filesystem, grub2 crashes (there is a sudden restart) when I run the test.
The ls command works.
ls (loop0) => Device loop0: Unknown filesystem
Quoted 10 lines · ago
On fezie's request I am reporting a possible bug that I experienced when running the following:
loopback loop0 /path/to/myfile
if [ -e (loop0)/some/file ]; then
echo ok
fiIf /path/to/myfile does not contain a filesystem, grub2 crashes (there is a sudden restart) when I run the test.
The following patch fixes this. OK to commit?
2009-09-14 Colin Watson <[email protected]>
* commands/test.c (get_fileinfo): Return immediately if grub_fs_probe fails.
test.c +7 -0
@@ -88,6 +88,13 @@ test_parse (char **args, int *argn, int argc) } fs =grub_fs_probe (dev); +if (! fs) + { +grub_free (device_name); +grub_device_close (dev); +return ; + } + pathname =grub_strchr (path,')' );if (! pathname) pathname = path;
Signature · 1 line
Colin Watson [[email protected]]
Quoted 24 lines · Colin Watson
Quoted 10 lines · ago
On fezie's request I am reporting a possible bug that I experienced when running the following:
loopback loop0 /path/to/myfile
if [ -e (loop0)/some/file ]; then
echo ok
fiIf /path/to/myfile does not contain a filesystem, grub2 crashes (there is a sudden restart) when I run the test.
The following patch fixes this. OK to commit?
2009-09-14 Colin Watson <[email protected]>
*
commands/test.c(get_fileinfo): Return immediately ifgrub_fs_probefails.Index:
commands/test.c
===================================================================
test.c test_parse (char **args, int *argn, int argc) · line 97
Quoted 10 lines
test.c +7
-0@@ -88,6 +88,13 @@ test_parse (char **args, int *argn, int argc) } fs =grub_fs_probe (dev); +if (! fs) + { +grub_free (device_name); +grub_device_close (dev); +return ; + } +
Of course!
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."