Package: syslinux
Version: 3:4.05+dfsg-6+deb8u1
Severity: normal
Tags: patch

The substitution used for guessing the master device name for partition
removes all digits from the device name. This doesn't work on many
device classes for which the whole disk device path contains digits (see
Documentation/devices.txt in kernel source tree,
https://www.kernel.org/doc/Documentation/devices.txt).  That happened to
me on the system booting from embedded MMC card for which the naming
scheme is:

/dev/mmcblk0 - first MMC device
/dev/mmcblk0p1 - its first partition

Such path confuses extlinux.postinst and so it incorrectly tries to
write the MBR to /dev/mmcblkp, which of course makes package configure
fail.

Attached patch (created at the top of
git://daniel-baumann.ch/git/debian/packages/syslinux.git) first removes
the digits at the end of path and then if the path ends with [0-9]p it
gets rid of 'p'.
>From bc7bd47deec56c4b3564ce2242d35effe2477f9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Boche=C5=84ski?= <[email protected]>
Date: Sat, 8 Feb 2014 23:14:53 +0100
Subject: [PATCH] extlinux.postinst: Support device names with digits

There are many block devices for which the whole disk device contains
digits in path, for example for MMC that would be /dev/mmcblk0.
Partition device nodes for those are named by appending letter 'p'
followed by a partition number, e.g. /dev/mmcblk0p1.
---
 debian/extlinux.postinst |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/debian/extlinux.postinst b/debian/extlinux.postinst
index 0cb2c2f..784c696 100644
--- a/debian/extlinux.postinst
+++ b/debian/extlinux.postinst
@@ -20,7 +20,8 @@ case "${1}" in
 
 				while true
 				do
-					_DEVICE="$(findmnt --canonicalize --noheadings --output SOURCE --raw ${_PATH}/ | sed -e 's|[0-9]||g')"
+					_DEVICE="$(findmnt --canonicalize --noheadings --output SOURCE --raw ${_PATH}/ |
+							sed -r 's|[0-9]+$||;s|([0-9])p$|\1|')"
 
 					if [ -n "${_DEVICE}" ] || [ -z "${_PATH}" ]
 					then
-- 
1.7.9.5

Reply via email to