<?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>9857</bug_id>
          
          <creation_ts>2016-06-30 14:09:02 +0000</creation_ts>
          <short_desc>sstate install doesn&apos;t preserve extended attributes on files</short_desc>
          <delta_ts>2016-09-07 15:41:14 +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.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></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.2 M3</target_milestone>
          <dependson>9317</dependson>
    
    <dependson>9929</dependson>
          <blocked>9858</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Joshua Lock">joshuagloe</reporter>
          <assigned_to name="Joshua Lock">joshuagloe</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</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>63514</commentid>
    <comment_count>0</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-06-30 14:09:02 +0000</bug_when>
    <thetext>Files installed via sstate lose any extended attributes which have been set on them when they are copied to their installed target destination.

This is because copyhardlinktree in turn calls copytree which uses a tar pipe to perform the actual file copying. This tar pipe doesn&apos;t include switches to force tar to preserve extended attributes.

A fix to oe.path.copytree() to preserve extended attributes is simple enough, though made marginally more complicated by the fact that tar versions prior to 1.27 don&apos;t support the tar options to preserve extended attributes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63516</commentid>
    <comment_count>1</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-06-30 14:19:22 +0000</bug_when>
    <thetext>Looking at &quot;older&quot; distros in SANITY_TESTED_DISTROS I see that:
* Ubuntu 14.04 shipped tar 1.27.1 http://packages.ubuntu.com/trusty/tar
* Debian 7 shipped tar 1.26 https://packages.debian.org/wheezy/tar
* CentOS 6 shipped tar 1.23 http://mirror.centos.org/centos/6/os/x86_64/Packages/tar-1.23-14.el6.x86_64.rpm
* Fedora 21 shipped tar 1.27.1 http://pkgs.fedoraproject.org/cgit/rpms/tar.git/tree/tar.spec?h=f21</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63524</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-06-30 15:00:33 +0000</bug_when>
    <thetext>Can you also fix image.bbclass to add the attr options to tar there?

(and write a test case)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63541</commentid>
    <comment_count>3</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-06-30 16:16:05 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Can you also fix image.bbclass to add the attr options to tar there?
&gt; 
&gt; (and write a test case)

image_types.bbclass -- I&apos;ll fix that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63638</commentid>
    <comment_count>4</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-07-04 19:42:28 +0000</bug_when>
    <thetext>I&apos;ve got WIP some patches that update meta/classes/image_types.bbclass and meta/lib/oe/path.py to preserve extended attributes. Unfortunately on a system with SELinux not disabled (in this case, running in Permissive mode) a tar pipe call in copytree() and copyhardlinktree() fails when expanding the archive with: &quot;Cannot open: Permission denied&quot;

If I disable SELinux on the host the build proceeds as usual and the extended attributes in my sstate objects are preserved when their contents are installed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63651</commentid>
    <comment_count>5</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-07-05 12:31:31 +0000</bug_when>
    <thetext>An updated copyhardlinktree() requires a version of pseudo with the xattr semantics for hardlinks fixed -- setting &quot;Depends on&quot; to #9317</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64011</commentid>
    <comment_count>6</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-07-14 20:54:12 +0000</bug_when>
    <thetext>After banging my head against the &quot;Cannot open: Permission denied&quot; issue for far too long I took to #selinux on Freenode to seek advice, as the error only occurs when SELinux is enabled yet occurs regardless of whether SELinux is in Permissive or Enforcing mode.

After performing various analysis of the involved files, etc we discovered that most files untar fine but that the ones that didn&apos;t all had a mode of --r--r--r.

This didn&apos;t actually help us determine a root cause and the #selinux occupants were suspicious of tar itself. I am in the process of testing with bsdtar instead of gnu tar.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64044</commentid>
    <comment_count>7</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-07-15 14:40:20 +0000</bug_when>
    <thetext>With bsdtar this series works without issue, even on SELinux using systems.

I&apos;m not sure whether use of bsdtar will be an acceptable change, but I plan to make it conditional on the use of an &quot;xattr&quot; DISTRO_FEATURE before proposing patches for inclusion.

Either way this change is blocked by the pseudo 1.8.1 slowdown with xattrs, reverting to pre 1.8.x pseudo isn&apos;t an option as they don&apos;t support xattrs on hardlinks and we rely on hardlinks during sstate install to minimise the disk impact.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64046</commentid>
    <comment_count>8</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-07-15 14:49:18 +0000</bug_when>
    <thetext>I wonder if GNU tar is detecting that selinux is enabled and changing its behaviour in some way.  It would be interesting to replicate with just tar outside of OE/pseudo and see if strace shows any difference in behaviour with SELinux in permissive or disabled.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65613</commentid>
    <comment_count>9</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-08-30 14:31:24 +0000</bug_when>
    <thetext>Patches submitted to OE-Core to preserve xattr in oe.path.copytree():

http://lists.openembedded.org/pipermail/openembedded-core/2016-August/125933.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65879</commentid>
    <comment_count>10</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-09-07 15:41:14 +0000</bug_when>
    <thetext>Patches merged</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>