<?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>13999</bug_id>
          
          <creation_ts>2020-08-10 10:09:44 +0000</creation_ts>
          <short_desc>do_packagedata setscene file race</short_desc>
          <delta_ts>2021-07-02 06:27:38 +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>3.2</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>AB-INT</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Richard Purdie">richard.purdie</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>alexandre.belloni</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</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>87903</commentid>
    <comment_count>0</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-08-10 10:09:44 +0000</bug_when>
    <thetext>https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/2304

NOTE: Running setscene task 3380 of 3484 (/home/pokybuild/yocto-worker/qa-extras2/build/meta/recipes-graphics/xorg-lib/libsm_1.2.3.bb:do_packagedata_setscene)
NOTE: recipe npth-1.6-r0: task do_packagedata_setscene: Started
NOTE: recipe popt-1.18-r0: task do_packagedata_setscene: Started
NOTE: recipe libpcre2-10.35-r0: task do_packagedata_setscene: Started
NOTE: recipe libxrender-1_0.9.10-r0: task do_packagedata_setscene: Started
NOTE: recipe freetype-2.10.2-r0: task do_packagedata_setscene: Succeeded
NOTE: Running setscene task 3386 of 3484 (/home/pokybuild/yocto-worker/qa-extras2/build/meta/recipes-core/expat/expat_2.2.9.bb:do_packagedata_setscene)
NOTE: recipe libpciaccess-0.16-r0: task do_packagedata_setscene: Succeeded
NOTE: recipe libsm-1_1.2.3-r0: task do_packagedata_setscene: Started
NOTE: recipe fribidi-1.0.10-r0: task do_packagedata_setscene: Succeeded
NOTE: Running setscene task 3391 of 3484 (/home/pokybuild/yocto-worker/qa-extras2/build/meta/recipes-connectivity/openssl/openssl_1.1.1g.bb:do_packagedata_setscene)
NOTE: Running setscene task 3392 of 3484 (/home/pokybuild/yocto-worker/qa-extras2/build/meta/recipes-core/readline/readline_8.0.bb:do_packagedata_setscene)
ERROR: libxtst-1_1.2.3-r0 do_packagedata_setscene: 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:do_packagedata_setscene(d)
     0003:
File: &apos;/home/pokybuild/yocto-worker/qa-extras2/build/meta/classes/package.bbclass&apos;, lineno: 2423, function: do_packagedata_setscene
     2419:do_packagedata[sstate-outputdirs] = &quot;${PKGDATA_DIR}&quot;
     2420:do_packagedata[stamp-extra-info] = &quot;${MACHINE_ARCH}&quot;
     2421:
     2422:python do_packagedata_setscene () {
 *** 2423:    sstate_setscene(d)
     2424:}
     2425:addtask do_packagedata_setscene
     2426:
     2427:#
File: &apos;/home/pokybuild/yocto-worker/qa-extras2/build/meta/classes/sstate.bbclass&apos;, lineno: 747, function: sstate_setscene
     0743:            pass
     0744:
     0745:def sstate_setscene(d):
     0746:    shared_state = sstate_state_fromvars(d)
 *** 0747:    accelerate = sstate_installpkg(shared_state, d)
     0748:    if not accelerate:
     0749:        bb.fatal(&quot;No suitable staging package found&quot;)
     0750:
     0751:python sstate_task_prefunc () {
File: &apos;/home/pokybuild/yocto-worker/qa-extras2/build/meta/classes/sstate.bbclass&apos;, lineno: 378, function: sstate_installpkg
     0374:    for f in (d.getVar(&apos;SSTATEPREINSTFUNCS&apos;) or &apos;&apos;).split() + [&apos;sstate_unpack_package&apos;]:
     0375:        # All hooks should run in the SSTATE_INSTDIR
     0376:        bb.build.exec_func(f, d, (sstateinst,))
     0377:
 *** 0378:    return sstate_installpkgdir(ss, d)
     0379:
     0380:def sstate_installpkgdir(ss, d):
     0381:    import oe.path
     0382:    import subprocess
File: &apos;/home/pokybuild/yocto-worker/qa-extras2/build/meta/classes/sstate.bbclass&apos;, lineno: 401, function: sstate_installpkgdir
     0397:
     0398:    for state in ss[&apos;dirs&apos;]:
     0399:        prepdir(state[1])
     0400:        os.rename(sstateinst + state[0], state[1])
 *** 0401:    sstate_install(ss, d)
     0402:
     0403:    for plain in ss[&apos;plaindirs&apos;]:
     0404:        workdir = d.getVar(&apos;WORKDIR&apos;)
     0405:        sharedworkdir = os.path.join(d.getVar(&apos;TMPDIR&apos;), &quot;work-shared&quot;)
File: &apos;/home/pokybuild/yocto-worker/qa-extras2/build/meta/classes/sstate.bbclass&apos;, lineno: 326, function: sstate_install
     0322:
     0323:    # Run the actual file install
     0324:    for state in ss[&apos;dirs&apos;]:
     0325:        if os.path.exists(state[1]):
 *** 0326:            oe.path.copyhardlinktree(state[1], state[2])
     0327:
     0328:    for postinst in (d.getVar(&apos;SSTATEPOSTINSTFUNCS&apos;) or &apos;&apos;).split():
     0329:        # All hooks should run in the SSTATE_INSTDIR
     0330:        bb.build.exec_func(postinst, d, (sstateinst,))
File: &apos;/home/pokybuild/yocto-worker/qa-extras2/build/meta/lib/oe/path.py&apos;, lineno: 132, function: copyhardlinktree
     0128:        else:
     0129:            source = src
     0130:            s_dir = os.getcwd()
     0131:        cmd = &apos;cp -afl --preserve=xattr %s %s&apos; % (source, os.path.realpath(dst))
 *** 0132:        subprocess.check_output(cmd, shell=True, cwd=s_dir, stderr=subprocess.STDOUT)
     0133:    else:
     0134:        copytree(src, dst)
     0135:
     0136:def copyhardlink(src, dst):
File: &apos;/home/pokybuild/yocto-worker/qa-extras2/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/python3.8/subprocess.py&apos;, lineno: 411, function: check_output
     0407:        # Explicitly passing input=None was previously equivalent to passing an
     0408:        # empty string. That is maintained here for backwards compatibility.
     0409:        kwargs[&apos;input&apos;] = &apos;&apos; if kwargs.get(&apos;universal_newlines&apos;, False) else b&apos;&apos;
     0410:
 *** 0411:    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
     0412:               **kwargs).stdout
     0413:
     0414:
     0415:class CompletedProcess(object):
File: &apos;/home/pokybuild/yocto-worker/qa-extras2/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/python3.8/subprocess.py&apos;, lineno: 512, function: run
     0508:            # We don&apos;t call process.wait() as .__exit__ does that for us.
     0509:            raise
     0510:        retcode = process.poll()
     0511:        if check and retcode:
 *** 0512:            raise CalledProcessError(retcode, process.args,
     0513:                                     output=stdout, stderr=stderr)
     0514:    return CompletedProcess(process.args, retcode, stdout, stderr)
     0515:
     0516:
Exception: subprocess.CalledProcessError: Command &apos;cp -afl --preserve=xattr ./* /home/pokybuild/yocto-worker/qa-extras2/build/build/tmp/pkgdata/qemux86-64&apos; returned non-zero exit status 1.

Subprocess output:
cp: cannot create hard link ‘/home/pokybuild/yocto-worker/qa-extras2/build/build/tmp/pkgdata/qemux86-64/runtime-rprovides/(=1.2.3)/libxtst’ to ‘./runtime-rprovides/(=1.2.3)/libxtst’: No such file or directory
cp: preserving times for ‘/home/pokybuild/yocto-worker/qa-extras2/build/build/tmp/pkgdata/qemux86-64/runtime-rprovides/(=1.2.3)’: No such file or directory

ERROR: Logfile of failure stored in: /home/pokybuild/yocto-worker/qa-extras2/build/build/tmp/work/core2-64-poky-linux/libxtst/1_1.2.3-r0/temp/log.do_packagedata_setscene.16698
NOTE: recipe libxtst-1_1.2.3-r0: task do_packagedata_setscene: Failed
WARNING: Setscene task (/home/pokybuild/yocto-worker/qa-extras2/build/meta/recipes-graphics/xorg-lib/libxtst_1.2.3.bb:do_packagedata_setscene) failed with exit code &apos;1&apos; - real task will be run instead
NOTE: recipe icu-67.1-r0: task do_packagedata_setscene: Succeeded
NOTE: recipe npth-1.6-r0: task do_packagedata_setscene: Succeeded
NOTE: Running setscene task 3395 of 3484 (/home/pokybuild/yocto-worker/qa-extras2/build/meta/recipes-core/libxcrypt/libxcrypt_4.4.16.bb:do_packagedata_setscene)
NOTE: Running setscene task 3396 of 3484 (/home/pokybuild/yocto-worker/qa-extras2/build/meta/recipes-extended/libnsl/libnsl2_git.bb:do_packagedata_setscene)
NOTE: Running setscene task 3397 of 3484 (/home/pokybuild/yocto-worker/qa-extras2/build/meta/recipes-extended/xz/xz_5.2.5.bb:do_packagedata_setscene)
NOTE: recipe libxrender-1_0.9.10-r0: task do_packagedata_setscene: Succeeded</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87908</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-08-11 03:52:04 +0000</bug_when>
    <thetext>Its interesting that libsm also has version 1.2.3 running at the same time?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87926</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-08-13 07:38:07 +0000</bug_when>
    <thetext>Likely, something weird going on with the dependencies according to Richard.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87927</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2020-08-13 07:41:51 +0000</bug_when>
    <thetext>cp: cannot create hard link ‘/home/pokybuild/yocto-worker/qa-extras2/build/build/tmp/pkgdata/qemux86-64/runtime-rprovides/(=1.2.3)/libxtst’

Note that /runtime-rprovides/ should contain names not versions.  However, in my tiny build I currently also have the following unusual directories:

(=10.1.0)
(=2.31+git0+1094741224)
rtld(GNU_HASH)

Looks like either quoting issues, or versions appearing in provides where otherwise not expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87934</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2020-08-13 08:33:18 +0000</bug_when>
    <thetext>$ ls runtime-rprovides/*=* -d
&apos;runtime-rprovides/(=0.16)&apos;     &apos;runtime-rprovides/(=1.2.3)&apos;                 &apos;runtime-rprovides/(=2.36.0)&apos;
&apos;runtime-rprovides/(=0.40.0)&apos;   &apos;runtime-rprovides/(=1.2.6)&apos;                 &apos;runtime-rprovides/(=2.40.0)&apos;
&apos;runtime-rprovides/(=0.4.5)&apos;    &apos;runtime-rprovides/(=1.3)&apos;                   &apos;runtime-rprovides/(=2.4.102)&apos;
&apos;runtime-rprovides/(=0.7.10)&apos;   &apos;runtime-rprovides/(=1.3.0)&apos;                 &apos;runtime-rprovides/(=2.4.48)&apos;
&apos;runtime-rprovides/(=0.9.10)&apos;   &apos;runtime-rprovides/(=1.3.4)&apos;                 &apos;runtime-rprovides/(=2.64.4)&apos;
&apos;runtime-rprovides/(=1.0.10)&apos;   &apos;runtime-rprovides/(=1.5.2)&apos;                 &apos;runtime-rprovides/(=2.6.8)&apos;
&apos;runtime-rprovides/(=10.1.0)&apos;   &apos;runtime-rprovides/(=1.5.4)&apos;                 &apos;runtime-rprovides/(=3.24.21)&apos;
&apos;runtime-rprovides/(=1.0.8)&apos;    &apos;runtime-rprovides/(=1.6.37)&apos;                &apos;runtime-rprovides/(=3.3)&apos;
&apos;runtime-rprovides/(=1.0.9)&apos;    &apos;runtime-rprovides/(=1.6.9)&apos;                 &apos;runtime-rprovides/(=3.32.3)&apos;
&apos;runtime-rprovides/(=1.1.1g)&apos;   &apos;runtime-rprovides/(=1.7.10)&apos;                &apos;runtime-rprovides/(=3.8.5)&apos;
&apos;runtime-rprovides/(=1.12.20)&apos;  &apos;runtime-rprovides/(=20.1.4)&apos;                &apos;runtime-rprovides/(=4.4.16)&apos;
&apos;runtime-rprovides/(=1.1.3)&apos;    &apos;runtime-rprovides/(=2.0.5)&apos;                 &apos;runtime-rprovides/(=5.0.3)&apos;
&apos;runtime-rprovides/(=1.1.4)&apos;    &apos;runtime-rprovides/(=2.10.2)&apos;                &apos;runtime-rprovides/(=5.2.5)&apos;
&apos;runtime-rprovides/(=1.14)&apos;     &apos;runtime-rprovides/(=2.13.1)&apos;                &apos;runtime-rprovides/(=6.2)&apos;
&apos;runtime-rprovides/(=1.1.5)&apos;    &apos;runtime-rprovides/(=2.2.9)&apos;                 &apos;runtime-rprovides/(=67.1)&apos;
&apos;runtime-rprovides/(=1.16.0)&apos;   &apos;runtime-rprovides/(=2.31+git0+1094741224)&apos;  &apos;runtime-rprovides/(=8.0)&apos;
&apos;runtime-rprovides/(=1.18.1)&apos;   &apos;runtime-rprovides/(=2.3.3)&apos;                 &apos;runtime-rprovides/(=8.44)&apos;
&apos;runtime-rprovides/(=1.2.0)&apos;    &apos;runtime-rprovides/(=2.34.2)&apos;
&apos;runtime-rprovides/(=1.2.11)&apos;   &apos;runtime-rprovides/(=2.35.2)&apos;

Looks like the code isn&apos;t handling versions at all, and there&apos;s just a good old fashioned race over genuinely racing files.

The code that is populating those files should be handling the RPROVIDES string containing versions, surely.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88042</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2020-08-27 05:15:32 +0000</bug_when>
    <thetext>I just posted a patch to the list to run the RPROVIDES list through explode_deps() so that directories such as (=1.2.3) are no longer created.

However the race still exists, if two packages (foo and bar) RPROVIDE the same name (flob) then they&apos;ll want to create pkgdata/runtime-rprovides/flob/(foo|bar).  If the stars align, foo can be running sstate_clean_manifest (thus deleting flob) whilst bar is in copyhardlinktree, in between the tar (to create the directories) and the cp (to put links into the directories).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90835</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2021-07-02 06:27:38 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=2b3ced714a2388f1dac43915e67fdd6c62892238</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>