<?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>9430</bug_id>
          
          <creation_ts>2016-04-11 02:52:51 +0000</creation_ts>
          <short_desc>fixup_perms fails when both /var/run and /var/lock present</short_desc>
          <delta_ts>2016-04-21 15:28:08 +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>configuration</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.1 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Denys Dmytriyenko">denis</reporter>
          <assigned_to name="Bill Randle">bill.randle</assigned_to>
          <cc>bill.randle</cc>
    
    <cc>dan.mcgregor</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>61001</commentid>
    <comment_count>0</comment_count>
    <who name="Denys Dmytriyenko">denis</who>
    <bug_when>2016-04-11 02:52:51 +0000</bug_when>
    <thetext>The file meta/files/fs-perms.txt contains this:

# Items from base-files
# Links
${localstatedir}/run    link    /run
${localstatedir}/log    link    volatile/log
${localstatedir}/lock   link    /run/lock
${localstatedir}/tmp    link    volatile/tmp

Now, when a recipe installs both /var/run and /var/lock, the fixup_perms function of do_package does create /run/lock and symlinks /var/lock into it, but then fails to symlink the actual /var/run into /run with the following error:

ERROR: recipename do_package: QA Issue: Fixup Perms: Unable to correct directory link, target already exists: /var/run -&gt; /run [perm-link]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61060</commentid>
    <comment_count>1</comment_count>
      <attachid>3118</attachid>
    <who name="Bill Randle">bill.randle</who>
    <bug_when>2016-04-12 00:22:50 +0000</bug_when>
    <thetext>Created attachment 3118
Proposed patch

When processing links, the directories are processed in unsorted order which can result in cases like /var/lock -&gt; /run/lock handled before /var/run -&gt; /run throwing an error for /var/run because /run already exists. Change the link processing to ensure links are processed in sorted order of the destination.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61101</commentid>
    <comment_count>2</comment_count>
    <who name="Denys Dmytriyenko">denis</who>
    <bug_when>2016-04-12 16:51:09 +0000</bug_when>
    <thetext>Seems to resolve the issue for me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61174</commentid>
    <comment_count>3</comment_count>
    <who name="Dan Mcgregor">dan.mcgregor</who>
    <bug_when>2016-04-13 18:54:04 +0000</bug_when>
    <thetext>The version in master introduces a new problem. The old code would process the permissions table in order, and later entries would override the first entries. This made overriding parts of the permissions file possible.

As an example, putting:

FILESYSTEM_PERMS_TABLES = &quot;files/fs-perms.txt files/fs-perms-override.txt&quot;

into conf/local.conf, where files/fs-perms.txt is the default from openembedded-core and files/fs-perms-override.txt contains:

# Override OE-core:
${localstatedir}/log    0755    root    root    false   -       -       -
${localstatedir}/tmp    01777   root    root    false   -       -       -
${sysconfdir}/mtab      link    /proc/self/mounts
${ROOT_HOME}            0700    root    root    false   -       -       -

would allow ${localstatedir}/log and ${localstatedir}/tmp to be a real directories.

To demonstrate this, an append on base-files will suffice, so base-files_%.bbappend containing:

volatiles_remove = &quot;log tmp&quot;
dirs755 += &quot;${localstatedir}/log&quot;
dirs1777 += &quot;${localstatedir}/tmp&quot;

produces:

ERROR: base-files-3.0.14-r89 do_package: QA Issue: Fixup Perms: Unable to correct directory link, target already exists: /var/log -&gt; /var/volatile/log [perm-link]
ERROR: base-files-3.0.14-r89 do_package: QA Issue: Fixup Perms: Unable to correct directory link, target already exists: /var/tmp -&gt; /var/volatile/tmp [perm-link]

The same configuration, prior to the version currently in master created /var/log and /var/tmp as real directories.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61510</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-04-21 15:28:08 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=9262d2ff39f898605fe6f4224a4684e782439497</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>3118</attachid>
            <date>2016-04-12 00:22:50 +0000</date>
            <delta_ts>2016-04-12 00:22:50 +0000</delta_ts>
            <desc>Proposed patch</desc>
            <filename>0001-package.bbclass-handle-links-in-sorted-order.patch</filename>
            <type>text/plain</type>
            <size>2772</size>
            <attacher name="Bill Randle">bill.randle</attacher>
            
              <data encoding="base64">RnJvbSAxOTNjOTIzZTQyYjRhYzBiODQwY2MyODkwYzc5ZGVkYTVkZmMxNTAzIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBCaWxsIFJhbmRsZSA8d2lsbGlhbS5jLnJhbmRsZUBpbnRlbC5j
b20+CkRhdGU6IE1vbiwgMTEgQXByIDIwMTYgMTc6MTE6MjEgLTA3MDAKU3ViamVjdDogW1BBVENI
XSBwYWNrYWdlLmJiY2xhc3M6IGhhbmRsZSBsaW5rcyBpbiBzb3J0ZWQgb3JkZXIKCldoZW4gcHJv
Y2Vzc2luZyBsaW5rcywgdGhlIGRpcmVjdG9yaWVzIGFyZSBwcm9jZXNzZWQgaW4gdW5zb3J0ZWQg
b3JkZXIKd2hpY2ggY2FuIHJlc3VsdCBpbiBjYXNlc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IGdldCAwNzU1IHJvb3Q6cm9vdC4KQEAgLTc3MywyNCArNzc0
LDI3IEBAIHB5dGhvbiBmaXh1cF9wZXJtcyAoKSB7CiAgICAgICAgICAgICAgICAgICAgIGNvbnRp
bnVlCiAgICAgICAgICAgICAgICAgZW50cnkgPSBmc19wZXJtc19lbnRyeShkLmV4cGFuZChsaW5l
KSkKICAgICAgICAgICAgICAgICBpZiBlbnRyeSBhbmQgZW50cnkucGF0aDoKLSAgICAgICAgICAg
ICAgICAgICAgZnNfcGVybXNfdGFibGVbZW50cnkucGF0aF0gPSBlbnRyeQorICAgICAgICAgICAg
ICAgICAgICBpZiBlbnRyeS5saW5rOgorICAgICAgICAgICAgICAgICAgICAgICAgZnNfbGlua190
YWJsZVtlbnRyeS5saW5rXSA9IGVudHJ5CisgICAgICAgICAgICAgICAgICAgIGVsc2U6CisgICAg
ICAgICAgICAgICAgICAgICAgICBmc19wZXJtc190YWJsZVtlbnRyeS5wYXRoXSA9IGVudHJ5CiAg
ICAgICAgICAgICBmLmNsb3NlKCkKIAogICAgICMgRGVidWcgLS0gbGlzdCBvdXQgaW4tbWVtb3J5
IHRhYmxlCiAgICAgI2ZvciBkaXIgaW4gZnNfcGVybXNfdGFibGU6CiAgICAgIyAgICBiYi5ub3Rl
KCJGaXh1cCBQZXJtczogJXM6ICVzIiAlIChkaXIsIHN0cihmc19wZXJtc190YWJsZVtkaXJdKSkp
CisgICAgI2ZvciBsaW5rIGluIGZzX2xpbmtfdGFibGU6CisgICAgIyAgICBiYi5ub3RlKCJGaXh1
cCBQZXJtczogJXM6ICVzIiAlIChsaW5rLCBzdHIoZnNfbGlua190YWJsZVtsaW5rXSkpKQogCiAg
ICAgIyBXZSBwcm9jZXNzIGxpbmtzIGZpcnN0LCBzbyB3ZSBjYW4gZ28gYmFjayBhbmQgZml4dXAg
ZGlyZWN0b3J5IG93bmVyc2hpcAogICAgICMgZm9yIGFueSBuZXdseSBjcmVhdGVkIGRpcmVjdG9y
aWVzCi0gICAgZm9yIGRpciBpbiBmc19wZXJtc190YWJsZToKLSAgICAgICAgaWYgbm90IGZzX3Bl
cm1zX3RhYmxlW2Rpcl0ubGluazoKLSAgICAgICAgICAgIGNvbnRpbnVlCi0KKyAgICAjIFByb2Nl
c3MgaW4gc29ydGVkIG9yZGVyIHNvIC9ydW4gZ2V0cyBjcmVhdGVkIGJlZm9yZSAvcnVuL2xvY2ss
IGV0Yy4KKyAgICBmb3IgbGluayBpbiBzb3J0ZWQoZnNfbGlua190YWJsZSk6CisgICAgICAgIGRp
ciA9IGZzX2xpbmtfdGFibGVbbGlua10ucGF0aAogICAgICAgICBvcmlnaW4gPSBkdmFyICsgZGly
CiAgICAgICAgIGlmIG5vdCAoY3BhdGguZXhpc3RzKG9yaWdpbikgYW5kIGNwYXRoLmlzZGlyKG9y
aWdpbikgYW5kIG5vdCBjcGF0aC5pc2xpbmsob3JpZ2luKSk6CiAgICAgICAgICAgICBjb250aW51
ZQogCi0gICAgICAgIGxpbmsgPSBmc19wZXJtc190YWJsZVtkaXJdLmxpbmsKICAgICAgICAgaWYg
bGlua1swXSA9PSAiLyI6CiAgICAgICAgICAgICB0YXJnZXQgPSBkdmFyICsgbGluawogICAgICAg
ICAgICAgcHRhcmdldCA9IGxpbmsKQEAgLTgxMCw5ICs4MTQsNiBAQCBweXRob24gZml4dXBfcGVy
bXMgKCkgewogICAgICAgICBvcy5zeW1saW5rKGxpbmssIG9yaWdpbikKIAogICAgIGZvciBkaXIg
aW4gZnNfcGVybXNfdGFibGU6Ci0gICAgICAgIGlmIGZzX3Blcm1zX3RhYmxlW2Rpcl0ubGluazoK
LSAgICAgICAgICAgIGNvbnRpbnVlCi0KICAgICAgICAgb3JpZ2luID0gZHZhciArIGRpcgogICAg
ICAgICBpZiBub3QgKGNwYXRoLmV4aXN0cyhvcmlnaW4pIGFuZCBjcGF0aC5pc2RpcihvcmlnaW4p
KToKICAgICAgICAgICAgIGNvbnRpbnVlCi0tIAoyLjUuMAoK
</data>

          </attachment>
      

    </bug>

</bugzilla>