File os-prober-dont-load-all-fs-module-and-dont-test-mount.patch of Package os-prober.1605

Index: os-prober-1.61/os-probes/common/50mounted-tests
===================================================================
--- os-prober-1.61.orig/os-probes/common/50mounted-tests
+++ os-prober-1.61/os-probes/common/50mounted-tests
@@ -40,19 +40,13 @@ elif [ -z "$types" ]; then
 		debug "$1 is a LUKS partition; skipping"
 		exit 0
 	fi
-	for type in $(grep -v nodev /proc/filesystems); do
-		# hfsplus filesystems are mountable as hfs. Try hfs last so
-		# that we can tell the difference.
-		if [ "$type" = hfs ]; then
-			delaytypes="${delaytypes:+$delaytypes }$type"
-		elif [ "$type" = fuseblk ]; then
-			if type ntfs-3g >/dev/null 2>&1; then
-				types="${types:+$types }ntfs-3g"
-			fi
-		else
-			types="${types:+$types }$type"
-		fi
-	done
+
+	# Simply skip such partition is better than trying to detect
+	# it by blinded test mounts with all kinds of kernel file system,
+	# that would lead to unwanted consequence like kernel oops and
+	# risk to corrupt your system and data.
+	debug "$1 is a partition without file system; skipping"
+	exit 0
 fi
 
 tmpmnt=/var/lib/os-prober/mount
@@ -144,7 +138,7 @@ if type grub2-mount >/dev/null 2>&1 && \
 	fi
 else
 	ro_partition "$partition"
-	for type in $types $delaytypes; do
+	for type in $types; do
 		if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then
 			debug "mounted as $type filesystem"
 			mounted=1
Index: os-prober-1.61/os-probes/init/common/10filesystems
===================================================================
--- os-prober-1.61.orig/os-probes/init/common/10filesystems
+++ os-prober-1.61/os-probes/init/common/10filesystems
@@ -1,39 +1,21 @@
 #!/bin/sh
 # Make sure filesystems are available.
-set +e	# ignore errors from modprobe
+set -e
 
-FILESYSTEMS='ext2 ext3 ext4 reiserfs xfs jfs msdos vfat ntfs minix hfs hfsplus qnx4 ufs btrfs'
-# fuse is needed to make grub2-mount work.
-FILESYSTEMS="$FILESYSTEMS fuse"
-# The Ubuntu kernel udebs put a number of filesystem modules in
-# fs-{core,secondary}-modules. It's fairly cheap to check for these too.
-FILESYSTEMS="$FILESYSTEMS fs-core fs-secondary"
-
-if [ ! -e /var/lib/os-prober/modules ]; then
-	# Check for anna-install to make it easier to use os-prober outside
-	# d-i.
-	if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then
-		for fs in $FILESYSTEMS; do
-			ANNA_QUIET=1 DEBIAN_FRONTEND=none \
-			log-output -t os-prober \
-				anna-install "$fs-modules" || true
-		done
-		depmod -a >/dev/null 2>&1 || true
-	fi
+# Make sure fuse is available for grub2-mount
+# As long as we use grub2-mount, we use grub2's own file system modules
+# to mount the partitiion and the operation don't require kernel support
+# other than fuse.
+if ! cat /proc/filesystems | grep nodev | cut -f2 | grep -qw fuse; then
+	modprobe fuse 2>&1 | logger -t os-prober
+fi
 
-	for fs in $FILESYSTEMS; do
-		case "$fs" in
-			fs-*)
-				;;
-			*)
-				modprobe "$fs" 2>/dev/null | logger -t os-prober
-				;;
-		esac
-	done
+# Regarding file systems not supported by grub2, or systems simply don't
+# have grub2-mount, will use linux 'mount' utility. This will require
+# kernel file system module to work, but still we don't need to modprobe
+# all of them before mount, because mount() syscall will take care of it
+# by __request_module the needed kernel module and we should leave it do
+# that for us in order to have only needed modules get loaded. 
+#
+# Still if you want any kernel module loaded, add them here.
 
-	# We only want to keep this state inside d-i, so this is as good a
-	# check as any.
-	if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then
-		touch /var/lib/os-prober/modules
-	fi
-fi
openSUSE Build Service is sponsored by