[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#395259: nobootloader: [powerpc/pegasos] bad sed invocation breaks devfs style paths (division by zero)



Package: nobootloader
Version: 1.12
Severity: grave
Tags: patch
Justification: renders package unusable


It seems that nobootloader uses still devfs paths for some reason. The
following line :

  part="$(($(echo "$bootfs_devfs" | sed 's/[^0-9]*//') - $partition_offset))"

will fail on paths like this one :

  /dev/ide/host0/bus0/target0/lun0/part4

Since :

  $ echo /dev/ide/host0/bus0/target0/lun0/part4 | sed 's/[^0-9]*//'
  0/bus0/target0/lun0/part4

which causes the calculation to result in a division by zero, thus making it
impossible to create a bootable pegasos system.

Please apply the below patch to fix this problem.

Friendly,

Sven Luther

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-powerpc
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Index: nobootloader/debian/postinst
===================================================================
--- nobootloader/debian/postinst	(revision 42226)
+++ nobootloader/debian/postinst	(working copy)
@@ -75,13 +75,14 @@
 					;;
 			esac
 			part="$(($(echo "$bootfs_devfs" | sed 's/[^0-9]*//') - $partition_offset))"
+			part="$(($(echo "$bootfs_devfs" | sed 's%^.*part%%') - $partition_offset))"
 		else
 			kind=`echo $bootfs_devfs | sed -e 's%/dev/%%' -e 's%/host.*$%%'`
 			host=`echo $bootfs_devfs | sed -e 's%^.*host%%' -e 's%/bus.*$%%'`
 			bus=`echo $bootfs_devfs | sed -e 's%^.*bus%%' -e 's%/target.*$%%'`
 			target=`echo $bootfs_devfs | sed -e 's%^.*target%%' -e 's%/lun.*$%%'`
 			lun=`echo $bootfs_devfs | sed -e 's%^.*lun%%' -e 's%/part.*$%%'`
-			part="$(($(echo $bootfs_devfs | sed -e 's%^.*part%%') - $partition_offset))"
+			part="$(($(echo "$bootfs_devfs" | sed -e 's%^.*part%%') - $partition_offset))"
 		fi
 
 		# We don't know how to map non ide or scsi disks
Index: nobootloader/debian/changelog
===================================================================
--- nobootloader/debian/changelog	(revision 42226)
+++ nobootloader/debian/changelog	(working copy)
@@ -1,3 +1,10 @@
+nobootloader (1.13) UNRELEASED; urgency=low
+
+  [ Sven Luther ]
+  * Fixed bad sed invocation, which failed on devfs-style paths.
+
+ -- Sven Luther <sven@tael.powerlinux.fr>  Wed, 25 Oct 2006 22:59:00 +0200
+
 nobootloader (1.12) unstable; urgency=low
 
   [ Updated translations ]
@@ -31,7 +38,7 @@
       partitions at 0.
 
   [ Sven Luther ]
-  * Update template for Genisi systems. Closes #388591.
+  * Update template for Genesi systems. Closes #388591.
 
   [ Christian Perrier ]
   * Avoid splitting a sentence in two parts which can make translations

Reply to: