<?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>9456</bug_id>
          
          <creation_ts>2016-04-13 12:59:58 +0000</creation_ts>
          <short_desc>opkg-build does not return error when Version is missing from control file</short_desc>
          <delta_ts>2016-05-10 16:09:19 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>opkg</product>
          <component>opkg</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>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>0.3.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Thomas De Schampheleire">patrickdepinguin</reporter>
          <assigned_to name="Alejandro del Castillo">alejandro.delcastillo</assigned_to>
          
          
          
          <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>61140</commentid>
    <comment_count>0</comment_count>
    <who name="Thomas De Schampheleire">patrickdepinguin</who>
    <bug_when>2016-04-13 12:59:58 +0000</bug_when>
    <thetext>The error checking in opkg-build (part of the opkg-utils repo) is not entirely correct. Excerpt from pkg_appears_sane() in opkg_build:

	pkg=`required_field Package`
	[ &quot;$?&quot; -ne 0 ] &amp;&amp; PKG_ERROR=1

	version=`required_field Version | sed &apos;s/Version://; s/^.://g;&apos;`
	[ &quot;$?&quot; -ne 0 ] &amp;&amp; PKG_ERROR=1

	arch=`required_field Architecture`
	[ &quot;$?&quot; -ne 0 ] &amp;&amp; PKG_ERROR=1


For fields Package and Architecture, the error check works well, but for Version it doesn&apos;t. Even if the Version field is missing, $? will be the return value of sed, which is normally 0.

The result with a missing Version field in the control file is an error message (originating from function &apos;required_field&apos;) but opkg does not bail out with an error return code, meaning that the caller script is unaware of the error.

A possible change (untested) is:

	version=`required_field Version`
	[ &quot;$?&quot; -ne 0 ] &amp;&amp; PKG_ERROR=1
        version=`echo $version | sed &apos;s/Version://; s/^.://g;&apos;`</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62069</commentid>
    <comment_count>1</comment_count>
    <who name="Alejandro del Castillo">alejandro.delcastillo</who>
    <bug_when>2016-05-10 16:09:19 +0000</bug_when>
    <thetext>fixed on commit 69aa4345f34dbd70b645d940a80fce0d5bfd8384</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>