[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)



On Thu, Oct 26, 2006 at 03:25:33AM +0200, Frans Pop wrote:
> On Wednesday 25 October 2006 23:12, Sven Luther wrote:
> > It seems that nobootloader uses still devfs paths for some reason. The
> > following line :
> 
> That is not so strange as that line is using the exact same variable 
> $bootfs_devfs as its base that the old code did...

Yeah, i suppose this should have gone, but the patch that got applied back
then is not the one i wrote and tested, but the one you or more probably 
Colin Watson adapted.

> Should it be using something different instead? What is the value of 
> $bootfs_disk_syspath and $bootfs_disk if you run the code with 'set -x'?

I suppose that the code should be rewritten to remove all devfs information, i
am not sure how to do this because i didn't look at the devfs-removal code,
and Colin was handling that.

> For now I've added a comment that that should probably be changed at some 
> point.
> 
> (To be very honest, I don't see the point of the code added in 1.10 at all 
> as the devfs path is still used as the base for the whole piece of code; 
> I guess it is in preparation of a further future transition.)

Well, my old patch was supposed to check for the version of the pegasos
firmware, and then substract 1 for older firmwares for the disk number.

That said, please also apply the first hunk of the attached patch, which bumps
the check to 1.4, as my colegues released a 1.3 firmware from an older tree,
and i had to bump the version of the version with the correct disk numbering.

> P.S. Your patch left the old line in the code instead of replacing it...

Yeah, sorry. Would still have worked though :)

Friendly,

Sven Luther

Index: postinst
===================================================================
--- postinst	(revision 42226)
+++ postinst	(working copy)
@@ -39,12 +39,12 @@
 			rest="${rest#*.}"
 			fv3="${rest%%.*}"
 			if [ "$fv1" -eq 1 ]; then
-				if [ "$fv2" -eq 2 ] && [ "$fv3" -ge 99 ]; then
+				if [ "$fv2" -eq 3 ] && [ "$fv3" -ge 99 ]; then
 					partition_offset=0
-				elif [ "$fv2" -ge 3 ]; then
+				elif [ "$fv2" -ge 4 ]; then
 					partition_offset=0
 				fi
-			elif [ "$fv1" -ge 2 ]; then
+			elif [ "$fv1" -ge 3 ]; then
 				partition_offset=0
 			fi
 		fi
@@ -74,14 +74,14 @@
 					lun="$(echo "$bootfs_disk" | cut -d: -f4)"
 					;;
 			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: changelog
===================================================================
--- changelog	(revision 42226)
+++ 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: