<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>10333</bug_id>
          
          <creation_ts>2016-09-26 22:06:43 +0000</creation_ts>
          <short_desc>Install scripts fail when installing to SanDisk HDD/SSD</short_desc>
          <delta_ts>2016-10-06 21:29:55 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>11</classification_id>
          <classification>Runtime</classification>
          <product>Installation</product>
          <component>Installation</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.0.3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Scott Lawson">scott.lawson.linux</reporter>
          <assigned_to name="Saul Wold">sgw</assigned_to>
          <cc>kevin.tian</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>66604</commentid>
    <comment_count>0</comment_count>
    <who name="Scott Lawson">scott.lawson.linux</who>
    <bug_when>2016-09-26 22:06:43 +0000</bug_when>
    <thetext>Preconditions/Environment
-------------------------
Using image built with Yocto 2.1.1 (jethro branch)
Build target is intel-corei7-64 from meta-intel
Installing image on Sony Vaio with SanDisk 256GB SSD

Triggering Action/Cause
-----------------------
Run install.sh

Expectation
-----------
The image is installed

Actual Result
-------------
Install script fails with &quot;./install.sh: line 131: arithmetic syntax error&quot;. This is the line referenced:

    swap_size=$((disk_size*swap_ratio/100))

Adding printouts of $disk_size and $swap_ratio shows that $swap_ratio is set correctly, but $disk_size is set to this:

    SanDisk 256061

$disk_size is set several lines prior by this line:

    disk_size=$(parted ${device} unit mb print | grep Disk | cut -d&quot; &quot; -f 3 | sed -e &quot;s/MB//&quot;)

On this test system, &quot;parted /dev/sda unit mb print&quot; returns the following:

    Model: ATA SanDisk SD6SN1M2 (scsi)
    Disk /dev/sda: 256061MB
    ...snip...

It looks like &quot;Disk&quot; being in the model specification line is causing the manufacturer name to be captured by &quot;grep Disk&quot; when this was not intended. Executing the entire command that is supposed to be setting $disk_size$ confirms this:

    $ parted /dev/sda unit mb print | grep Disk | cut -d&quot; &quot; -f 3 | sed -e &quot;s/MB//&quot;
    SanDisk
    256061
    &lt; blank line &gt;


The end result is that the $disk_size variable contains a string with alphabetic characters, rather than just numbers, resulting in the arithmetic syntax error when it is used in a calculation.

Reproducibility
---------------
5/5, assuming SanDisk HDD/SSD is used.

Other Notes
---------------
The same command is used in multiple scripts to set $disk_size, so this issue likely affects all of them. install.sh was just used as an example.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66611</commentid>
    <comment_count>1</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2016-09-26 22:46:18 +0000</bug_when>
    <thetext>There appears to be a fix for this issue in master and krogoth, I will propose this as a backport for jethro.  You can see the patch here: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=3ce7d8cdc8537fef07efc2d3f6b540faab1819e4


If you are working from a GIT branch for jethro, you might try to cherry pick:
git cherry-pick 3ce7d8cd</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66699</commentid>
    <comment_count>2</comment_count>
    <who name="Scott Lawson">scott.lawson.linux</who>
    <bug_when>2016-09-28 18:50:25 +0000</bug_when>
    <thetext>Thanks for the info. Given that the fix is present in a newer release than we&apos;re using, I would be fine with this being closed. It sounds like just completing our Krogoth upgrade will resolve it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67018</commentid>
    <comment_count>3</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2016-10-06 21:29:55 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?h=jethro&amp;id=2ff9d30dac1d0734547b0793bd5d1efb00d00f4e</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>