Avoid false positives in MS-DOS detection by also looking for autoexec.bat. Closes...
authorJoey Hess <joey@kitenet.net>
Mon, 12 Mar 2012 15:31:07 +0000 (11:31 -0400)
committerJoey Hess <joey@kitenet.net>
Mon, 12 Mar 2012 15:37:35 +0000 (11:37 -0400)
/dos is not an unheard of directory to have on a linux system -- we used
to put our dual-boot mount point there in 1995 -- and when mounted by
grub-mount, the filesystem type is not available to limit detection of
MS-DOS to only relevant filesystems.

Work around this problem by also requiring an /autoexec.bat or a
/config.sys. While not all MS-DOS systems have one of these files,
any MS-DOS system that a user is likely to care about showing up
in their boot menu probably does.
(IIRC not all MS-DOS systems even have a /dos!)

I also took a brief look at the other tests that allows fuse mount through.
Many of them, like 83haiku check for enough different items that the
chances of a false positive are very low even absent a filesystem type
confirmation. The most worrying are 20macosx, which only checks for
/mach_kernel, and 30utility, which only checks for /f11.sys.

Those should probably be tightened down, or a way found to check the actual
filesystem type when using grub-mount.

debian/changelog
os-probes/mounted/x86/20microsoft

index 2e52ce0..78dfd5f 100644 (file)
@@ -11,6 +11,10 @@ os-prober (1.50) UNRELEASED; urgency=low
   * Add support to detect BSD systems. Thanks to Gavrilin Andrey
     <gaal.dev@gmail.com> for the patch (refs: #659208).
 
+  [ Joey Hess ]
+  * Avoid false positives in MS-DOS detection by also looking for
+    autoexec.bat. Closes: #663540 
+
  -- Joey Hess <joeyh@debian.org>  Tue, 13 Dec 2011 17:54:33 -0400
 
 os-prober (1.49) unstable; urgency=low
index f270cbd..f491e86 100755 (executable)
@@ -82,7 +82,7 @@ fi
 
 # MS-DOS
 if [ -z "$found" ] && item_in_dir -q dos "$2" &&
-     [ -d "$2"/"$(item_in_dir dos "$2")" ]; then
+     (item_in_dir -q autoexec.bat "$2" || item_in_dir -q config.sys "$2"); then
        long="MS-DOS 5.x/6.x/Win3.1"
        short=MS-DOS