Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MRqf2-0001k2-PH for mharc-grub-devel@gnu.org; Fri, 17 Jul 2009 12:51:52 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MRqez-0001iB-C0 for grub-devel@gnu.org; Fri, 17 Jul 2009 12:51:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MRqeu-0001fb-3q for grub-devel@gnu.org; Fri, 17 Jul 2009 12:51:48 -0400 Received: from [199.232.76.173] (port=38436 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MRqet-0001fY-Sm for grub-devel@gnu.org; Fri, 17 Jul 2009 12:51:43 -0400 Received: from smarthost02.mail.zen.net.uk ([212.23.3.141]:36297) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MRqet-0007Re-3E for grub-devel@gnu.org; Fri, 17 Jul 2009 12:51:43 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost02.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1MRqer-0007PS-Gb for grub-devel@gnu.org; Fri, 17 Jul 2009 16:51:41 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1MRqeq-0006gf-00; Fri, 17 Jul 2009 17:51:40 +0100 Date: Fri, 17 Jul 2009 17:51:40 +0100 From: Colin Watson To: The development of GRUB 2 Message-ID: <20090717165140.GN11691@riva.ucam.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost02-IP: [82.69.40.219] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [PATCH] Fix when installing on pationless but partionable medium X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2009 16:51:49 -0000 On Fri, Jul 17, 2009 at 06:41:59PM +0200, Vladimir 'phcoder' Serbinenko wrote: > Sometimes a media that can be partioned isn't really partioned. E.g. > usb sticks. This is a patch to handle this situation. Unfortunately > such medium is often formated with a flavour of FAT which shares its > signature with MBR so it may be easily misidentified as > pc_partition_table. Furthermore the same signature is shared with > bootsectors including grub. One possibility is to try interpret disk > as known filesystems and see if we succeed. But the problem is that > the check for FAT are light and may result in false positives too. The > only more or less advanced check there is a check for FATXX string. > But I was about to propose to eliminate this check since I encountered > a FAT filesystem without this string on friend's SD card formatted > with symbian which he wanted to use as liveusb. Does anyone has a > better idea? When checking for an MBR filesystem label, parted checks whether each of partitions 1-4 has a boot indicator that's either 0 or 0x80, since as you point out checking for the FAT signature suffers false positives; I believe this algorithm matches that in the Linux kernel. Look at libparted/labels/dos.c:msdos_probe(), which is already FSF-copyrighted and GPLv3+. GRUB should use the same algorithm, and then the worst case is that things will fail consistently. -- Colin Watson [cjwatson@ubuntu.com]