[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#616733: os-prober: Does not detect MS-DOS reliably



Package: os-prober
Version: 1.42
Severity: normal


Configuration:
- system is partitioned as follows:
  /dev/sda1 = Linux /boot
  /dev/sda2 = DOS 6.22
  /dev/sda3 = extended partition
  /dev/sda5 = Linux LVM PV, containing swap and Linux filesystems
- /dev/sda2 is mounted on /dos 
  (so the DOS 6.22 system directory is "/dos/dos" )

Commands issued as root:
# cd /root
# update-grub2
# cd /dos
# update-grub2

Expected results:
update-grub2 runs grub-mkconfig, which uses os-prober via
/etc/grub.d/30_os-prober script. It finds the DOS partition and adds it to
GRUB boot menu. The results should be the same no matter in which directory
update-grub2 is run.

Actual results:
When the current directory is /root, the DOS partition is not detected.
When the current directory is /dos, the DOS partition is detected
successfully.

# cd /root
# update-grub2
Found linux image: /boot/vmlinuz-2.6.36.4-c7
Found initrd image: /boot/initrd.img-2.6.36.4-c7
Found linux image: /boot/vmlinuz-2.6.32-5-686
Found initrd image: /boot/initrd.img-2.6.32-5-686
Found memtest86 image: /memtest86.bin
Found memtest86+ image: /memtest86+.bin
done
# cd /dos
# update-grub2
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.36.4-c7
Found initrd image: /boot/initrd.img-2.6.36.4-c7
Found linux image: /boot/vmlinuz-2.6.32-5-686
Found initrd image: /boot/initrd.img-2.6.32-5-686
Found memtest86 image: /memtest86.bin
Found memtest86+ image: /memtest86+.bin
Found MS-DOS 5.x/6.x/Win3.1 on /dev/sda2
done
 

Analysis:
os-prober's MS-DOS test in /usr/lib/os-probes/mounted/20microsoft does not
use an absolute path when it verifies that "dos" is a directory.
Patch attached.

Further suggestions:
Testing for the presence of "dos" directory is not a very reliable test for
MS-DOS: the directory might exist also on systems updated from MS-DOS/Win3.1
to Windows 9x, and the name of the MS-DOS system directory was relatively
easy to customize.

A better test would be to look for initial boot files: "IO.SYS" and
"MSDOS.SYS": their location is fixed at the root of the MS-DOS/Windows
system partition.

Step 1) If both IO.SYS and MSDOS.SYS exist, and no other versions of
MS-Windows are detected, the OS is either MS-DOS/Win3.1 or
Windows 9x/ME.

Step 2) If MSDOS.SYS is a binary, the OS is MS-DOS/Win3.1;
if MSDOS.SYS contains only text with CRLF line terminators 
(although not necessarily ASCII only: localized versions may have
included national characters in CP850 or other Microsoft
proprietary extended-ASCII encodings), the OS is Windows 9x/ME.


-- System Information:
Debian Release: 6.0
  APT prefers squeeze-updates
  APT policy: (500, 'squeeze-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.36.4-c7
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages os-prober depends on:
ii  libc6                         2.11.2-10  Embedded GNU C Library: Shared lib

os-prober recommends no packages.

os-prober suggests no packages.

-- no debconf information
--- /usr/lib/os-probes/mounted/20microsoft.distrib	2010-08-27 02:39:38.000000000 +0300
+++ /usr/lib/os-probes/mounted/20microsoft	2011-03-07 00:33:43.000000000 +0200
@@ -64,7 +64,7 @@
 		fi
 	fi
 # MS-DOS
-elif [ -d "$(item_in_dir dos "$2")" ]; then
+elif [ -d "$2"/"$(item_in_dir dos "$2")" ]; then
 	long="MS-DOS 5.x/6.x/Win3.1"
 	short=MS-DOS
 # 95/98/Me

Reply to: