<?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>13806</bug_id>
          
          <creation_ts>2020-02-21 08:29:12 +0000</creation_ts>
          <short_desc>cannot change the ownership of symbolic link</short_desc>
          <delta_ts>2020-04-30 08:10:18 +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>BitBake</product>
          <component>bitbake</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>backport</status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.1 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>daisuke.yamane</reporter>
          <assigned_to>daisuke.yamane</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>86538</commentid>
    <comment_count>0</comment_count>
    <who name="">daisuke.yamane</who>
    <bug_when>2020-02-21 08:29:12 +0000</bug_when>
    <thetext>I try to change owership of symbolic link in do_install, but it doesn&apos;t work.

I use the recipes like below.
===
do_install_append () {
        touch ${D}${bindir}/chown-test
        ln -fs ${bindir}/chown-test ${D}${bindir}/link-to-chown-test
        chown -R -h user:user ${D}${bindir}/link-to-chown-test
        chown -R -h user:user ${D}${bindir}/chown-test
}
===

It seems that only ownership of symbolic-link was modified to root when copied to package-split.
&gt; $ echo &apos;.dump&apos; |sqlite3 &lt;WORKDIR&gt;/pseudo/files.db |grep chown
&gt; INSERT INTO files VALUES(120,&apos;&lt;WORKDIR&gt;/image/usr/bin/chown-test&apos;,2066,26881543,1000,1000,33188,0,0);
&gt; INSERT INTO files VALUES(121,&apos;&lt;WORKDIR&gt;/image/usr/bin/link-to-chown-test&apos;,2066,26881556,1000,1000,41471,0,0);
&gt; INSERT INTO files VALUES(17091,&apos;&lt;WORKDIR&gt;/package/usr/bin/chown-test&apos;,2066,28453918,1000,1000,33188,0,0);
&gt; INSERT INTO files VALUES(17106,&apos;&lt;WORKDIR&gt;/package/usr/bin/link-to-chown-test&apos;,2066,28453919,1000,1000,41471,0,0);
&gt; INSERT INTO files VALUES(18732,&apos;&lt;WORKDIR&gt;/packages-split/rsyslog/usr/bin/chown-test&apos;,2066,28453918,1000,1000,33188,0,0);
&gt; INSERT INTO files VALUES(18733,&apos;&lt;WORKDIR&gt;/packages-split/rsyslog/usr/bin/link-to-chown-test&apos;,2066,28454108,0,0,41471,0,0);
Note: Paths omitted for clarity

The following is the copy process that causes this problem.
When os.lchown() is uncommented, it works fine for me.
- lib/bb/utils.py
&gt; def copyfile(src, dest, newmtime = None, sstat = None):
...(snip)...
&gt;     if stat.S_ISLNK(sstat[stat.ST_MODE]):
&gt;         try:
&gt;             target = os.readlink(src)
&gt;             if destexists and not stat.S_ISDIR(dstat[stat.ST_MODE]):
&gt;                 os.unlink(dest)
&gt;             os.symlink(target, dest)
&gt;             #os.lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
&gt;             return os.lstat(dest)

I think this is a bug. Right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86541</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-02-21 12:18:12 +0000</bug_when>
    <thetext>It does sound like a bug. Could you send a patch please? 

Bonus marks if you extend our automated test coverage
http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/lib/oeqa/selftest/cases/package.py
Run as oe-sefltest -e package.PackageTeststest_preserve_sparse_hardlinks

(could just add a chown&apos;d symlink to that test)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86555</commentid>
    <comment_count>2</comment_count>
    <who name="">daisuke.yamane</who>
    <bug_when>2020-02-22 06:26:29 +0000</bug_when>
    <thetext>Hi Richard,
thank you for reply.

&gt; It does sound like a bug. Could you send a patch please? 
I just sent a patch. https://bugzilla.yoctoproject.org/show_bug.cgi?id=13806

&gt; Bonus marks if you extend our automated test coverage
&gt; http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/lib/oeqa/selftest/cases/package.py
&gt; Run as oe-sefltest -e package.PackageTeststest_preserve_sparse_hardlinks
I&apos;m making a test now, however it may take some time because I am not used to it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86564</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-02-23 11:17:35 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Hi Richard,
&gt; thank you for reply.
&gt; 
&gt; &gt; It does sound like a bug. Could you send a patch please? 
&gt; I just sent a patch. https://bugzilla.yoctoproject.org/show_bug.cgi?id=13806

Thanks, I saw it, put through testing and then merged it!

I did a little digging of the history and that code line has been commented out since it was added in 2005! (no idea why)

&gt; &gt; Bonus marks if you extend our automated test coverage
&gt; &gt; http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/lib/oeqa/selftest/cases/package.py
&gt; &gt; Run as oe-sefltest -e package.PackageTeststest_preserve_sparse_hardlinks
&gt; I&apos;m making a test now, however it may take some time because I am not used
&gt; to it.

Thanks, the tests are how we managed to keep the project stable so this does help and is appreciated!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86565</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-02-23 11:18:11 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=2070441607c1315bf3a161968963d7ca979199a0 was the merged commit</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86605</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-02-27 15:41:23 +0000</bug_when>
    <thetext>Bug fixed. Added backport requests. Tests coming in M4 hopefully. Thanks Daisuke.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86720</commentid>
    <comment_count>6</comment_count>
    <who name="">daisuke.yamane</who>
    <bug_when>2020-03-14 13:22:31 +0000</bug_when>
    <thetext>&gt; &gt; Bonus marks if you extend our automated test coverage
&gt; &gt; http://git.yoctoproject.org/cgit.cgi/poky/tree/meta/lib/oeqa/selftest/cases/package.py
&gt; &gt; Run as oe-sefltest -e package.PackageTeststest_preserve_sparse_hardlinks
&gt; I&apos;m making a test now, however it may take some time because I am not used to it.

I send a patch to add test. Please review it!
https://patchwork.openembedded.org/patch/171025/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87053</commentid>
    <comment_count>7</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-04-20 05:46:49 +0000</bug_when>
    <thetext>Thanks for the test, it was close to release to add new tests but this will be queued for the next cycle./</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87119</commentid>
    <comment_count>8</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-04-30 08:10:18 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=caa530a277fd67cb88a077dddcad4b60911cf332</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>