<?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>9317</bug_id>
          
          <creation_ts>2016-03-21 19:39:48 +0000</creation_ts>
          <short_desc>pseudo: incorrect xattr semantic for hardlinks</short_desc>
          <delta_ts>2016-07-29 15:55:52 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Pseudo</product>
          <component>pseudo</component>
          <version>master</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 M2</target_milestone>
          
          <blocked>9858</blocked>
    
    <blocked>9857</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Patrick Ohly">patrick.ohly</reporter>
          <assigned_to name="Joshua Lock">joshuagloe</assigned_to>
          <cc>jose.perez.carranza</cc>
    
    <cc>joshuagloe</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>seebs</cc>
    
    <cc>sgw</cc>
    
    <cc>yp.pseudo.watcher</cc>
    
    <cc>yp.watcher</cc>
          
          <qa_contact name="David Rodriguez">david.israelx.rodriguez.castellanos</qa_contact>
          <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>60218</commentid>
    <comment_count>0</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2016-03-21 19:39:48 +0000</bug_when>
    <thetext>The correct semantic for hardlinks is that xattrs are associated with the inode. Under pseudo, they get associated incorrectly with the the directory entry.

The effect is that operations are possible under pseudo which aren&apos;t possible in the final file system (which is confusing for developers) and (more important) that copying entire filesystems with &quot;tar&quot; fails to copy hardlinks correctly. Apparently tar only sets the xattrs once, leading to filesystem entries under pseudo where one copy has the expected attributes and the other doesn&apos;t.

Expected behavior (from a Linux host):

# echo hello &gt;foo
# setfattr -n security.SMACK64 -v System foo
# ln foo bar
# getfattr -d -m . foo bar
# file: foo
security.SMACK64=&quot;System&quot;

# file: bar
security.SMACK64=&quot;System&quot;

Incorrect behavior under pseudo:

# echo hello &gt;foo
# setfattr -n security.SMACK64 -v System foo
root@pohly-desktop:/tmp# ln foo bar
root@pohly-desktop:/tmp# getfattr -d -m . foo bar
# file: foo
security.SMACK64=&quot;System&quot;

Nothing gets reported for bar.

We ran into this as part of the integration of meta-swupd into Ostro OS. We can work around it for now by avoiding hardlinks, but long term it would be better to get pseudo fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60223</commentid>
    <comment_count>1</comment_count>
    <who name="Seebs">seebs</who>
    <bug_when>2016-03-21 20:53:11 +0000</bug_when>
    <thetext>Huh. That&apos;s a good point. I suspect pseudo currently has some other issues to do with hard links ending up with the wrong modes, and it&apos;s not totally surprising to see it happening also with extended attributes.

So, yeah, this should be fixed. I&apos;ll start thinking about it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60225</commentid>
    <comment_count>2</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2016-03-21 22:00:51 +0000</bug_when>
    <thetext>I remember that at some point I accidentally set mode bits differently on hardlinks and that it worked under pseudo, but then of course not in the real filesystem. But when I tested that again today, it worked as expected under pseudo (modes where the same on all copies).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60308</commentid>
    <comment_count>3</comment_count>
    <who name="Seebs">seebs</who>
    <bug_when>2016-03-22 19:11:41 +0000</bug_when>
    <thetext>I&apos;m not sure whether I have anything in the code to intentionally fix hardlinks, but I might. I&apos;ll look at that.

Mostly, I need to make the xattr stuff smarter, in that it needs to look for xattrs on anything with the same inode as the requested path. Eww. This is gonna be sorta tricky and I have no immediate ETA.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60363</commentid>
    <comment_count>4</comment_count>
    <who name="Seebs">seebs</who>
    <bug_when>2016-03-23 20:06:52 +0000</bug_when>
    <thetext>So, a quick overview of why this is busted, and possibly hard to fix:

The files database has device, inode, and path. The xattr database uses row_id and path, with the row id being the row id of the specific entry in the files database which the xattr was created for.

When doing updates to the regular file database, I do actually change everything with the same device and inode. But for xattrs, I&apos;m just doing the one row. That&apos;s probably an error. There was, at the time, some perfectly good technical reason for which I wanted to use the row ID as the key, rather than the device/inode, although I don&apos;t remember my reasoning now. But that means that I need to do something significantly fancier to get xattrs to work correctly.

... actually, what I&apos;ll probably do is create/change entries for everything with the same device/inode. I don&apos;t want to change the table structure now. Ugh.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60426</commentid>
    <comment_count>5</comment_count>
    <who name="Seebs">seebs</who>
    <bug_when>2016-03-25 21:05:02 +0000</bug_when>
    <thetext>Okay, I have proposed fixes for this in my tree, they seem to work, but it&apos;s gonna take some time to get code review etc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61831</commentid>
    <comment_count>6</comment_count>
    <who name="Seebs">seebs</who>
    <bug_when>2016-04-29 19:59:18 +0000</bug_when>
    <thetext>Just for the record, this is probably-done, but I haven&apos;t gotten it code-reviewed yet.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63709</commentid>
    <comment_count>7</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-07-07 09:17:43 +0000</bug_when>
    <thetext>We have a recipe which upgrades to the latest ~1.8 pseudo release and fixes some of the issues identified within. This recipe and related changes are currently undergoing test and review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63852</commentid>
    <comment_count>8</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-07-12 16:17:18 +0000</bug_when>
    <thetext>This issue was fixed in the 1.8 branch of pseudo, we&apos;re now using 1.8.1 in the master branches of openembedded-core and poky.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>