<?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>13695</bug_id>
          
          <creation_ts>2019-12-10 09:38:55 +0000</creation_ts>
          <short_desc>Adding task after populate_sysroot and before package whit recipe inherits useradd breaks do_package task</short_desc>
          <delta_ts>2019-12-12 16:09:01 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>2.6.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Low</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Igor Baldachini">ibaldachini</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>akuster</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>richard.purdie</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>85775</commentid>
    <comment_count>0</comment_count>
      <attachid>4597</attachid>
    <who name="Igor Baldachini">ibaldachini</who>
    <bug_when>2019-12-10 09:38:55 +0000</bug_when>
    <thetext>Created attachment 4597
Test recipe to reproduce error

Writing a recipe that inherit useradd and add a task after do_populate_sysroot and before do_package breaks do_package task

This is the errror log:

ERROR: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: &apos;exec_python_func() autogenerated&apos;, lineno: 2, function: &lt;module&gt;
     0001:
 *** 0002:extend_recipe_sysroot(d)
     0003:
File: &apos;/storage/rpi/sources/poky/meta/classes/staging.bbclass&apos;, lineno: 553, function: extend_recipe_sysroot
     0549:                    dest = newmanifest[l]
     0550:                    if l.endswith(&quot;/&quot;):
     0551:                        staging_copydir(l, targetdir, dest, seendirs)
     0552:                        continue
 *** 0553:                    staging_copyfile(l, targetdir, dest, postinsts, seendirs)
     0554:
     0555:    bb.note(&quot;Installed into sysroot: %s&quot; % str(msg_adding))
     0556:    bb.note(&quot;Skipping as already exists in sysroot: %s&quot; % str(msg_exists))
     0557:
File: &apos;/storage/rpi/sources/poky/meta/classes/staging.bbclass&apos;, lineno: 151, function: staging_copyfile
     0147:        os.symlink(linkto, dest)
     0148:        #bb.warn(c)
     0149:    else:
     0150:        try:
 *** 0151:            os.link(c, dest)
     0152:        except OSError as err:
     0153:            if err.errno == errno.EXDEV:
     0154:                bb.utils.copyfile(c, dest)
     0155:            else:
Exception: FileExistsError: [Errno 17] File exists: &apos;/storage/rpi/build/tmp/sysroots-components/aarch64/test-useradd-with-my-stuff-after-populate-sysroot-before-package/usr/bin/postinst-useradd-test-useradd-with-my-stuff-after-populate-sysroot-before-package&apos; -&gt; &apos;/storage/rpi/build/tmp/work/aarch64-poky-linux/test-useradd-with-my-stuff-after-populate-sysroot-before-package/1.0-r0/recipe-sysroot/usr/bin/postinst-useradd-test-useradd-with-my-stuff-after-populate-sysroot-before-package&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85811</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-12-12 16:04:17 +0000</bug_when>
    <thetext>I&apos;m not sure why you&apos;d need a task which is between populate_sysroot and package. You&apos;re trying to add constraints which make the tasks effectively impossible to order so I&apos;d advise against that. I&apos;d suggest removing the ordering constraints, or changing to different tasks as this choice doesn&apos;t seem to make sense.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85812</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-12-12 16:09:01 +0000</bug_when>
    <thetext>Some more context:

- addtask populate_sysroot after do_install
populate_sysroot takes the install files and prepare a sysroot.

- addtask package after do_install
package takes the install files and prepares the package structure.

Those tasks should be running in parallel because they&apos;re unrelated.  Your addtask is enforcing ordering that doesn&apos;t make sense and in the best case will slow the build down.

So, the fix is to change the ordering.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4597</attachid>
            <date>2019-12-10 09:38:55 +0000</date>
            <delta_ts>2019-12-12 16:03:18 +0000</delta_ts>
            <desc>Test recipe to reproduce error</desc>
            <filename>test-useradd-with-my-stuff-after-populate-sysroot-before-package.bb</filename>
            <type>text/plain</type>
            <size>236</size>
            <attacher name="Igor Baldachini">ibaldachini</attacher>
            
              <data encoding="base64">REVTQ1JJUFRJT04gPSAiVGVzdCIKTElDRU5TRSA9ICJDTE9TRUQiCgpQViA9ICIxLjAiCgppbmhl
cml0IHVzZXJhZGQKVVNFUkFERF9QQUNLQUdFUyA9ICIke1BOfSIKVVNFUkFERF9QQVJBTV8ke1BO
fSA9ICJzZXR1cDsiCgpmYWtlcm9vdCBkb19teV9zdHVmZiAoKSB7CiAgZWNobyAiZG8gc3R1ZmYi
Cn0KCmFkZHRhc2sgbXlfc3R1ZmYgYWZ0ZXIgZG9fcG9wdWxhdGVfc3lzcm9vdCBiZWZvcmUgZG9f
cGFja2FnZQo=
</data>

          </attachment>
      

    </bug>

</bugzilla>