From 65817eec76afb48eac1e0430307b788246bdf96b Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 31 May 2011 09:17:59 +0100 Subject: [PATCH] * Backport from upstream, removing the need for Breaks: udev (<< 168-1): - Don't stat devices unless we have to. --- debian/changelog | 2 + debian/control | 2 +- debian/patches/lazy_stat.patch | 73 ++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + debian/rules | 8 ---- 5 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 debian/patches/lazy_stat.patch diff --git a/debian/changelog b/debian/changelog index 6f520ef82..3d0d884cb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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). diff --git a/debian/control b/debian/control index 7daea76c8..290121baa 100644 --- a/debian/control +++ b/debian/control @@ -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. diff --git a/debian/patches/lazy_stat.patch b/debian/patches/lazy_stat.patch new file mode 100644 index 000000000..b2cdfd2fc --- /dev/null +++ b/debian/patches/lazy_stat.patch @@ -0,0 +1,73 @@ +Description: Don't stat devices unless we have to +Author: Vladimir Serbinenko +Author: Colin Watson +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; + } + diff --git a/debian/patches/series b/debian/patches/series index 904aece2e..d06120de7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -17,3 +17,4 @@ branch_embed-sectors.patch branch_fuse.patch mkrescue_efi_modules.patch mkconfig_loopback.patch +lazy_stat.patch diff --git a/debian/rules b/debian/rules index 975ae8958..8bc4cb39c 100755 --- a/debian/rules +++ b/debian/rules @@ -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