Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OHxGh-0007Xx-GV for mharc-grub-devel@gnu.org; Fri, 28 May 2010 06:58:23 -0400 Received: from [140.186.70.92] (port=36949 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHxGe-0007VP-Qf for grub-devel@gnu.org; Fri, 28 May 2010 06:58:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHxGd-0008Uz-G7 for grub-devel@gnu.org; Fri, 28 May 2010 06:58:20 -0400 Received: from smarthost01.mail.zen.net.uk ([212.23.3.140]:56825) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHxGd-0008Ui-7o for grub-devel@gnu.org; Fri, 28 May 2010 06:58:19 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost01.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1OHxGW-0000HY-Si; Fri, 28 May 2010 10:58:13 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) id 1OHxGV-00011O-00; Fri, 28 May 2010 11:58:11 +0100 Date: Fri, 28 May 2010 11:58:11 +0100 From: Colin Watson To: Bastian Blank Message-ID: <20100528105810.GA3713@riva.ucam.org> References: <20091012112213.GA5962@wavehammer.waldi.eu.org> <1255349103.3204.53.camel@fz.local> <20100519093222.GA7219@wavehammer.waldi.eu.org> <4BF3B3AB.4020606@gmail.com> <20100519105515.GA8866@wavehammer.waldi.eu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100519105515.GA8866@wavehammer.waldi.eu.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost01-IP: [82.69.40.219] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Vladimir =?utf-8?Q?'=CF=86-coder=2Fphcoder'?= Serbinenko , grub-devel@gnu.org, 550704@bugs.debian.org, Felix Zielcke Subject: Re: Bug#550704: grub-pc - Needs to handle symlinks in /dev/mapper X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 May 2010 10:58:22 -0000 I'm not interested (any more) in deciding whether I think it's more correct for entries under /dev/mapper to be symlinks or real block devices (and indeed recent versions of udev do seem to be moving towards the former). This isn't something on which it's important for GRUB to take a stance one way or the other; we should just work with both. Fortunately this is quite straightforward. Here's a patch, which I've also pushed as a bzr branch to people/cjwatson/mapper-symlink. 2010-05-28 Colin Watson Make grub-probe work with symbolic links under /dev/mapper as well as with real block devices. The Linux world seems to be (at best) in transition here, and GRUB shouldn't get caught in the middle. * kern/emu/getroot.c (find_root_device): Follow symbolic links under /dev/mapper. === modified file 'kern/emu/getroot.c' --- kern/emu/getroot.c 2010-05-06 03:15:39 +0000 +++ kern/emu/getroot.c 2010-05-28 10:51:50 +0000 @@ -126,9 +126,20 @@ find_root_device (const char *dir, dev_t /* Ignore any error. */ continue; - if (S_ISLNK (st.st_mode)) - /* Don't follow symbolic links. */ + if (S_ISLNK (st.st_mode)) { +#ifdef __linux__ + if (strcmp (dir, "mapper") == 0) { + /* Follow symbolic links under /dev/mapper/; the canonical name + may be something like /dev/dm-0, but the names under + /dev/mapper/ are more human-readable and so we prefer them if + we can get them. */ + if (stat (ent->d_name, &st) < 0) + continue; + } else +#endif /* __linux__ */ + /* Don't follow other symbolic links. */ continue; + } if (S_ISDIR (st.st_mode)) { -- Colin Watson [cjwatson@ubuntu.com]