*Bug 689360* <https://bugzilla.redhat.com/show_bug.cgi?id=689360> -
livcd-iso-to-disk
aborts with empty device and proper SYSLINUXPATH setting

>From the bug report:

The new autoexit setting, set -e, caused a runtime error in the case of a zero
value in the arithmetic expression command, ((tbd += <du value>)), that is when
both tbd and the du value were 0.

This occurs when the installation device is empty and there is no /syslinux
directory to size.

The attached patch changes the command to tdb=$((tbd + <du value>)), which
fixes the problem because the assignment operation returns "SUCCESS".

(Changed similar commands to match the assignment style.)



commit f11b6399f4a3266c517d2ce56dec2b18a8139d5d
Author: Frederick Grose <[email protected]>
Date:   Mon Mar 21 03:44:41 2011 -0400

    Fix return code failure with zero-valued arithmetic expression.

    A runtime zero-valued arithmetic expression returns "FAILURE",
    so with the new set -e autoexit setting, the code logic or
    command must be adjusted to accommodate.

diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index deb5473..41d6b28 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -880,18 +880,18 @@ if [[ -d $TGTMNT/$LIVEOS ]]; then
     tbd=($(du -B 1M $TGTMNT/$LIVEOS))
     if [[ -s $TGTMNT/$LIVEOS/$HOMEFILE ]] && [[ -n $keephome ]]; then
         homesize=($(du -B 1M $TGTMNT/$LIVEOS/$HOMEFILE))
-        ((tbd -= homesize))
+        tbd=$((tbd - homesize))
     fi
 else
     tbd=0
 fi

 if [[ live == $srctype ]]; then
-   targets="$TGTMNT/$SYSLINUXPATH"
-   [[ -n $efi ]] && targets+=" $TGTMNT$EFI_BOOT"
-   [[ -n $xo ]] && targets+=" $TGTMNT/BOOT/olpc.fth"
-   duTable=($(du -c -B 1M $targets 2> /dev/null || :))
-   ((tbd += ${duTable[*]: -2:1}))
+    targets="$TGTMNT/$SYSLINUXPATH"
+    [[ -n $efi ]] && targets+=" $TGTMNT$EFI_BOOT"
+    [[ -n $xo ]] && targets+=" $TGTMNT/BOOT/olpc.fth"
+    duTable=($(du -c -B 1M $targets 2> /dev/null || :))
+    tbd=$((tbd + ${duTable[*]: -2:1}))
 fi

 if [[ -n $skipcompress ]] && [[ -s $SRCMNT/LiveOS/squashfs.img ]]; then
@@ -923,7 +923,7 @@ if [[ live == $srctype ]]; then
     [[ -n $efi ]] && sources+=" $SRCMNT$EFI_BOOT"
     [[ -n $xo ]] && sources+=" $SRCMNT/BOOT/olpc.fth"
     duTable=($(du -c -B 1M "$thisScriptpath" $sources 2> /dev/null || :))
-    ((livesize += ${duTable[*]: -2:1}))
+    livesize=$((livesize + ${duTable[*]: -2:1}))
 fi

 freespace=($(df -B 1M --total $TGTDEV))
--
livecd mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/livecd

Reply via email to