* Backport from upstream, removing the need for Breaks: udev (<< 168-1):

- Don't stat devices unless we have to.
This commit is contained in:
Colin Watson 2011-05-31 09:17:59 +01:00
parent 25953e02ea
commit 65817eec76
5 changed files with 77 additions and 9 deletions

2
debian/changelog vendored
View File

@ -2,6 +2,8 @@ grub2 (1.99-6) UNRELEASED; urgency=low
[ Colin Watson ]
* Update Vcs-* fields for Alioth changes.
* Backport from upstream, removing the need for Breaks: udev (<< 168-1):
- Don't stat devices unless we have to.
[ Debconf translations ]
* Catalan (Jordi Mallach).

2
debian/control vendored
View File

@ -72,7 +72,7 @@ Recommends: os-prober (>= 1.33)
Suggests: multiboot-doc, grub-emu, xorriso (>= 0.5.6.pl00), desktop-base (>= 4.0.6)
# See bugs #435983 and #455746
Conflicts: mdadm (<< 2.6.7-2)
Breaks: lupin-support (<< 0.30), ${udev-Breaks}
Breaks: lupin-support (<< 0.30)
Multi-Arch: foreign
Description: GRand Unified Bootloader (common files)
This package contains common files shared by the distinct flavours of GRUB.

73
debian/patches/lazy_stat.patch vendored Normal file
View File

@ -0,0 +1,73 @@
Description: Don't stat devices unless we have to
Author: Vladimir Serbinenko <phcoder@gmail.com>
Author: Colin Watson <cjwatson@ubuntu.com>
Bug-Debian: http://bugs.debian.org/627587
Forwarded: yes
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3318
Last-Update: 2011-05-31
Index: b/grub-core/kern/emu/getroot.c
===================================================================
--- a/grub-core/kern/emu/getroot.c
+++ b/grub-core/kern/emu/getroot.c
@@ -358,7 +358,7 @@
if (S_ISLNK (st.st_mode)) {
#ifdef __linux__
- if (strcmp (dir, "mapper") == 0) {
+ if (strcmp (dir, "mapper") == 0 || strcmp (dir, "/dev/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
@@ -609,20 +609,27 @@
if (os_dev)
{
- if (stat (os_dev, &st) >= 0)
- dev = st.st_rdev;
- else
- grub_util_error ("cannot stat `%s'", os_dev);
- free (os_dev);
+ char *tmp = os_dev;
+ os_dev = canonicalize_file_name (os_dev);
+ free (tmp);
}
- else
+
+ if (os_dev)
{
- if (stat (dir, &st) >= 0)
- dev = st.st_dev;
- else
- grub_util_error ("cannot stat `%s'", dir);
+ if (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) != 0)
+ return os_dev;
+ if (stat (os_dev, &st) < 0)
+ grub_util_error ("cannot stat `%s'", os_dev);
+ free (os_dev);
+ dev = st.st_rdev;
+ return grub_find_device ("/dev/mapper", dev);
}
+ if (stat (dir, &st) < 0)
+ grub_util_error ("cannot stat `%s'", dir);
+
+ dev = st.st_dev;
+
#ifdef __CYGWIN__
/* Cygwin specific function. */
os_dev = grub_find_device (dir, dev);
Index: b/grub-core/kern/emu/hostdisk.c
===================================================================
--- a/grub-core/kern/emu/hostdisk.c
+++ b/grub-core/kern/emu/hostdisk.c
@@ -1420,7 +1420,8 @@
if (tree)
dm_tree_free (tree);
free (path);
- char *ret = grub_find_device (NULL, (major << 8) | minor);
+ char *ret = grub_find_device ("/dev/mapper",
+ (major << 8) | minor);
return ret;
}

View File

@ -17,3 +17,4 @@ branch_embed-sectors.patch
branch_fuse.patch
mkrescue_efi_modules.patch
mkconfig_loopback.patch
lazy_stat.patch

8
debian/rules vendored
View File

@ -253,14 +253,6 @@ override_dh_installdocs:
override_dh_strip:
dh_strip -X/usr/bin/grub-emu
override_dh_gencontrol:
ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes))
echo 'udev-Breaks=' >>debian/grub-common.substvars
else
echo 'udev-Breaks=udev (<< 168-1)' >>debian/grub-common.substvars
endif
dh_gencontrol
override_dh_auto_clean:
-rm -rf build
-rm -f contrib grub-core/contrib