]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Remove readability checks (too many false negatives).
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 13 Sep 2010 20:18:03 +0000 (22:18 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 13 Sep 2010 20:18:03 +0000 (22:18 +0200)
* util/grub-install.in: Remove readability checks.
* util/grub-mkconfig.in: Likewise.
* util/grub.d/10_hurd.in: Likewise.
* util/grub.d/10_kfreebsd.in: Likewise.
* util/grub.d/10_linux.in: Likewise.
* util/grub-mkconfig_lib.in (is_path_readable_by_grub): Revert to old
way.

ChangeLog
util/grub-install.in
util/grub-mkconfig.in
util/grub-mkconfig_lib.in
util/grub.d/10_hurd.in
util/grub.d/10_kfreebsd.in
util/grub.d/10_linux.in

index 555ed77119ae538e2b671c3c14f318836e581d0d..10ba630290f7a9ad79a14d0d391cf3ec90c601f5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-13  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Remove readability checks (too many false negatives).
+
+       * util/grub-install.in: Remove readability checks.
+       * util/grub-mkconfig.in: Likewise.
+       * util/grub.d/10_hurd.in: Likewise.
+       * util/grub.d/10_kfreebsd.in: Likewise.
+       * util/grub.d/10_linux.in: Likewise.
+       * util/grub-mkconfig_lib.in (is_path_readable_by_grub): Revert to old
+       way.
+
 2010-09-13  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Enable acpi shutdown on all ACPI platforms.
index ef1778b2a51960799a3ca2bae7a51d94e0335af8..92271a15a60109b4097b981592aea2dfd1cf7cb1 100644 (file)
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Install GRUB on your drive.
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
 #
 # GRUB is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -327,7 +327,8 @@ if test "x$fs_module" = x -a "x$modules" = x; then
 fi
 
 # Then the partition map module.  In order to support partition-less media,
-# this command is allowed to fail.
+# this command is allowed to fail (--target=fs already grants us that the
+# filesystem will be accessible).
 partmap_module=
 for x in `$grub_probe --target=partmap --device ${grub_device} 2> /dev/null`; do
    partmap_module="$partmap_module part_$x";
@@ -405,24 +406,9 @@ case "${target_cpu}-${platform}" in
     *) mkimage_target=i386-coreboot;
 esac
 
-# Verify readability of a few critical files
-for file in grubenv normal.mod ; do
-    if is_path_readable_by_grub ${grubdir}/${file} ${grub_device} ${relative_grubdir}/${file} ; then : ; else
-        echo "GRUB is unable to read ${grubdir}/${file}" >&2
-        exit 1
-    fi
-done
-
 if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
     $grub_mkimage ${config_opt} -O ${mkimage_target} --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
 
-    # This is a temporary workaround; it can be merged back into the check
-    # above once the install branch is merged.
-    if is_path_readable_by_grub ${grubdir}/core.img ${grub_device} ${relative_grubdir}/core.img ; then : ; else
-        echo "GRUB is unable to read ${grubdir}/core.img" >&2
-        exit 1
-    fi
-
     # Now perform the installation.
     $grub_setup ${setup_verbose} ${setup_force} --directory=${grubdir} --device-map=${device_map} \
         ${install_device} || exit 1
index fa84c63d1059e7fc619a2baaa147fcca40fcffa9..c3b4c3398197988c148eafd567f6d62b8d814385 100644 (file)
@@ -303,14 +303,6 @@ for i in ${grub_mkconfig_dir}/* ; do
   esac
 done
 
-# Verify readability of ${grub_cfg}.new
-if test "x${grub_cfg}" != "x"; then
-  if is_path_readable_by_grub ${grub_cfg}.new ; then : ; else
-    echo "GRUB is unable to read ${grubdir}/${file}" >&2
-    exit 1   
-  fi
-fi
-
 if test "x${grub_cfg}" != "x" ; then
   # none of the children aborted with error, install the new grub.cfg
   mv -f ${grub_cfg}.new ${grub_cfg}
index 6d4f9f3bb32ddcdb5fc9ca4bb3ed17db2cc73f65..9a77d1bdf749bc9c880c3f885cfa6b2aac782079 100644 (file)
@@ -30,9 +30,6 @@ fi
 if test "x$grub_mkrelpath" = x; then
   grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
 fi
-if test "x$grub_fstest" = x; then
-  grub_fstest=${bindir}/`echo grub-fstest | sed ${transform}`
-fi
 
 if $(which gettext >/dev/null 2>/dev/null) ; then
   gettext="gettext"
@@ -53,24 +50,14 @@ make_system_path_relative_to_its_root ()
 is_path_readable_by_grub ()
 {
   path=$1
-  device=$2
-  relpath=$3
 
   # abort if path doesn't exist
   if test -e $path ; then : ;else
     return 1
   fi
 
-  if [ "${device}" = "" ] ; then
-    device=$(${grub_probe} --target=device $path)
-  fi
-  if [ "${relpath}" = "" ] ; then
-    relpath=$(${grub_mkrelpath} $path)
-  fi
-
-  # abort if file read through GRUB doesn't match file read through system
-  # facilities
-  if ${grub_fstest} $device cmp $relpath $path > /dev/null 2>&1 ; then : ; else
+  # abort if file is in a filesystem we can't read
+  if ${grub_probe} -t fs $path > /dev/null 2>&1 ; then : ; else
     return 1
   fi
 
index d8cc7aea43bfcc83bab79f5b40468c4c3aa002ae..350eb30a8a0057b5b1c8bf9f524381a325a05a3e 100644 (file)
@@ -41,14 +41,6 @@ for i in /boot/gnumach* ; do
     basename=`basename $i`
     dirname=`dirname $i`
     rel_dirname=`make_system_path_relative_to_its_root $dirname`
-
-    if ! is_path_readable_by_grub ${dirname}/${basename} \
-        ${GRUB_DEVICE_BOOT} \
-        ${rel_dirname}/${basename} ; then
-      echo "${dirname}/${basename} is not readable by GRUB" >&2
-      exit 1
-    fi
-
     echo "Found GNU Mach: $i" >&2
     kernels="${kernels} ${rel_dirname}/${basename}"
     at_least_one=true
index bf1632bd6e779737ca3d09e4700ab2f6423667fe..e39423999d4b75fb473c4656035b9bbaf597e18a 100644 (file)
@@ -44,7 +44,7 @@ load_kfreebsd_module ()
   mod="$1"
   allow_fail="$2"
 
-  if ! is_path_readable_by_grub "${module_dir}/${mod}.ko" ; then
+  if ! test -e "${module_dir}/${mod}.ko" ; then
     if [ "${allow_fail}" = "true" ] ; then
       # Return silently
       return
@@ -77,13 +77,6 @@ kfreebsd_entry ()
     prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
   fi
 
-  if ! is_path_readable_by_grub ${dirname}/${basename} \
-      ${GRUB_DEVICE_BOOT} \
-      ${rel_dirname}/${basename} ; then
-    echo "${dirname}/${basename} is not readable by GRUB" >&2
-    exit 1
-  fi
-
   printf '%s\n' "${prepare_boot_cache}"
   cat << EOF
        echo                    '$(printf "$(gettext_quoted "Loading kernel of FreeBSD %s ...")" ${version})'
@@ -102,13 +95,7 @@ EOF
     zfs)
       load_kfreebsd_module opensolaris false
 
-      if ! is_path_readable_by_grub ${dirname}/zfs/zpool.cache \
-          ${GRUB_DEVICE_BOOT} \
-          ${rel_dirname}/zfs/zpool.cache ; then
-        echo "${dirname}/zfs/zpool.cache is not readable by GRUB" >&2
-        exit 1
-      fi
-
+      ls "${dirname}/zfs/zpool.cache" > /dev/null
       printf '%s\n' "${prepare_boot_cache}"
   cat << EOF
        kfreebsd_module         ${rel_dirname}/zfs/zpool.cache type=/boot/zfs/zpool.cache
index 765a7fab6d6b848eeb300cf3a35da028e4b52fad..14b85c7f131ef3b513154a0d7fe3b125de26c0ef 100644 (file)
@@ -83,15 +83,6 @@ EOF
 EOF
   fi
 
-  for i in ${basename} ${initrd} ; do
-    if ! is_path_readable_by_grub ${dirname}/${i} \
-        ${GRUB_DEVICE_BOOT} \
-        ${rel_dirname}/${i} ; then
-      echo "${dirname}/${i} is not readable by GRUB" >&2
-      exit 1
-    fi
-  done
-
   if [ -z "${prepare_boot_cache}" ]; then
     prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
   fi