iustin / pyxattr

A python module for accessing filesystem Extended Attributes
https://pyxattr.k1024.org/
GNU Lesser General Public License v2.1
31 stars 14 forks source link

Consider adding incremental read and seek interface for large attribute values #31

Closed joachimmetz closed 2 years ago

joachimmetz commented 3 years ago

Some file systems, such as XFS, allow to store large amounts of data in extended attributes. In pyxattr I only see getxattr to retrieve attribute value data, which returns all data. For large attribute values it would be useful to have means to do incremental reads and seeks.

iustin commented 3 years ago

Oh, good idea - thanks!

joachimmetz commented 3 years ago

While looking into another xattr related thing, while reviewing man 2 getxattr my request might be easier said/asked than implemented since getxattr() does not appear to have an equivalent that supports incremental read.

Instead it states:

E2BIG  The size of the attribute value is larger than the maximum size allowed; the attribute cannot be retrieved.  This can happen on filesystems that support very large attribute values such as NFSv4, for example

So feel free to close if this turns out to be infeasible

Nable80 commented 3 years ago

I always thought that it's the main feature of xattrs: they're always read/written in one piece (maybe even atomically).

BTW, XFS xattrs are limited to 64k, I don't think this value is that large.

joachimmetz commented 3 years ago

@Nable80 indeed the XFS documentation states 64k but the format technically allows for larger data. So this might not be that useful feature request at this time.

Nable80 commented 3 years ago

I'm not the only one who mentions these design considerations: https://www.spinics.net/lists/linux-fsdevel/msg85757.html

iustin commented 2 years ago

Given the state of xattrs upstream, this is infeasible right now, so I’ll mark it as such. Feel free to reopen if things change.