From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1QoPjW-0004dp-0X for mharc-grub-devel@gnu.org; Tue, 02 Aug 2011 20:54:50 -0400 Received: from eggs.gnu.org ([140.186.70.92]:36951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoPjT-0004cL-5T for grub-devel@gnu.org; Tue, 02 Aug 2011 20:54:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QoPjQ-0000Fo-Lt for grub-devel@gnu.org; Tue, 02 Aug 2011 20:54:47 -0400 Received: from ausc60ps301.us.dell.com ([143.166.148.206]:4595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoPjQ-0000FP-IQ for grub-devel@gnu.org; Tue, 02 Aug 2011 20:54:44 -0400 X-Loopcount0: from 10.9.160.253 Message-ID: <4E389C50.3080001@dell.com> Date: Tue, 02 Aug 2011 19:54:40 -0500 From: Mario Limonciello Organization: Dell Inc. User-Agent: Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110627 Thunderbird/5.0 MIME-Version: 1.0 To: "grub-devel@gnu.org" Subject: [PATCH] Use realpath to clean up arguments to grub-probe X-Enigmail-Version: 1.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig373271C0FFA05763EDC59698" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 143.166.148.206 Cc: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 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: Wed, 03 Aug 2011 00:54:48 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig373271C0FFA05763EDC59698 Content-Type: multipart/mixed; boundary="------------040407040502070405030602" This is a multi-part message in MIME format. --------------040407040502070405030602 Content-Type: multipart/alternative; boundary="------------090905000405050602020702" --------------090905000405050602020702 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I've found that the EFI grub-install command can fail to properly figure = out devices when using the --root-directory command. This seems to be ro= oted from a call to grub-probe with a ".." in the path. This is fixed by using realpath to clean up the path passed in grub-probe= =2E Please see the attached patch. Thanks, --=20 *Mario Limonciello* Linux Engineer *Dell*| OS Engineering --------------090905000405050602020702 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi,

I've found that the EFI grub-install command can fail to properly figure out devices when using the --root-directory command.=C2=A0 Thi= s seems to be rooted from a call to grub-probe with a ".." in the path.

This is fixed by using realpath to clean up the path passed in grub-probe.=C2=A0 Please see the attached patch.

Thanks,

--
Mario Limonciello
Linux Engineer
Dell | OS Engineering
--------------090905000405050602020702-- --------------040407040502070405030602 Content-Type: text/x-diff; name="realpath.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="realpath.patch" =3D=3D=3D modified file 'ChangeLog' --- ChangeLog 2011-07-26 15:19:47 +0000 +++ ChangeLog 2011-08-03 00:48:10 +0000 @@ -1,3 +1,8 @@ +2011-08-02 Mario Limonciello + + * util/grub-probe.c: Use realpath to clean up directory arguments + including '..' such as that used in grub-install for EFI. + 2011-07-26 Colin Watson =20 * configure.ac: The Loongson port requires grub-mkfont due to its =3D=3D=3D modified file 'util/grub-probe.c' --- util/grub-probe.c 2011-04-25 12:52:07 +0000 +++ util/grub-probe.c 2011-08-03 00:53:57 +0000 @@ -42,6 +42,9 @@ #include #include #include +#ifdef HAVE_LIMITS_H +#include +#endif =20 #define _GNU_SOURCE 1 #include @@ -181,7 +184,15 @@ #endif } else - device_name =3D grub_guess_root_device (path); + { +#ifdef PATH_MAX + grub_path =3D xmalloc (PATH_MAX); + realpath (path, grub_path); +#else + grub_path =3D realpath(path, NULL); +#endif + device_name =3D grub_guess_root_device (grub_path); + } =20 if (! device_name) grub_util_error ("cannot find a device for %s (is /dev mounted?)", p= ath); --------------040407040502070405030602-- --------------enig373271C0FFA05763EDC59698 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk44nFQACgkQ2CrZjkA73Yv/0QCfWpGo/jIgJjTNwHSaBOvTxyJB XyAAn20sbOiiT70sG7tpoNynfFKC3cN8 =AvUx -----END PGP SIGNATURE----- --------------enig373271C0FFA05763EDC59698--