<div class="gmail_quote">On Thu, Dec 16, 2010 at 8:22 PM, Frederick Grose <span dir="ltr">&lt;<a href="mailto:fgrose@gmail.com">fgrose@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<font face="&#39;courier new&#39;, monospace">From <a href="https://bugzilla.redhat.com/show_bug.cgi?id=663849" style="color:rgb(0, 102, 204);text-decoration:none" target="_blank">Bug 663849</a> -<span> <span>copyFile failures not trapped in livecd-iso-to-disk</span></span></font></blockquote>

<div><br></div><div>[Patch v2]</div><div><span class="Apple-style-span" style="font-family: &#39;DejaVu Sans&#39;, &#39;Liberation Sans&#39;, sans-serif; "><pre class="bz_comment_text" id="comment_text_4" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">

set -o pipefail reverses the logic of

if ! syslinux 2&gt;&amp;1 | grep -qe -d; then
   ...

in checkSyslinuxVersion()

so delay setting this option until just before it&#39;s needed for image copying.</pre><pre class="bz_comment_text" id="comment_text_4" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">

<br></pre><pre class="bz_comment_text" id="comment_text_4" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">Testing of more scenarios is requested...</pre><pre class="bz_comment_text" id="comment_text_4" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">

   --Fred</pre><pre class="bz_comment_text" id="comment_text_4" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; "><br></pre></span></div><span class="Apple-style-span" style="font-family: &#39;Times New Roman&#39;; font-size: medium; "><pre style="word-wrap: break-word; white-space: pre-wrap; ">

    Trap copyFile errors
    
    &#39;Set -o pipefail&#39; is needed with the new starce-based copy function.
    Also, keep || clauses inprocess, so that an exit command applies to
    the main script and not just a subshell.

diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 51abc0c..dfabed7 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -688,13 +688,15 @@ fi
 [ -n &quot;$efi&quot; -a ! -d $USBMNT/EFI/boot ] &amp;&amp; mkdir -p $USBMNT/EFI/boot
 
 # Live image copy
+set -o pipefail
 if [ &quot;$isotype&quot; = &quot;live&quot; -a -z &quot;$skipcopy&quot; ]; then
     echo &quot;Copying live image to USB stick&quot;
     [ ! -d $USBMNT/$LIVEOS ] &amp;&amp; mkdir $USBMNT/$LIVEOS
     [ -n &quot;$keephome&quot; -a -f &quot;$USBMNT/$HOMEFILE&quot; ] &amp;&amp; mv $USBMNT/$HOMEFILE $USBMNT/$LIVEOS/$HOMEFILE
     if [ -n &quot;$skipcompress&quot; -a -f $CDMNT/LiveOS/squashfs.img ]; then
         mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT || exitclean
-        copyFile $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img || (umount $CDMNT ; exitclean)
+        copyFile $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img || {
+            umount $CDMNT ; exitclean ; }
         umount $CDMNT
     elif [ -f $CDMNT/LiveOS/squashfs.img ]; then </pre></span><div><span class="Apple-style-span" style="font-family: monospace; white-space: pre-wrap; font-size: medium; ">         copyFile $CDMNT/LiveOS/squashfs.img $USBMNT/$LIVEOS/squashfs.img || exitclean</span> </div>

</div>