This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: getxattr on Linux ZFS native filesystem happily returns partial values
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.3, Python 3.4
Status: open Resolution:
Dependencies: Superseder:
Assigned To: larry Nosy List: Arfrever, benjamin.peterson, larry
Priority: normal Keywords:

Created on 2013-08-09 04:55 by larry, last changed 2022-04-11 14:57 by admin.

File name Uploaded Description Edit
larry.setxattr.zfs.patch.1.txt larry, 2013-08-09 04:55 First draft fix for getxattr() on ZFS on Linux. review
larry.setxattr.zfs.3.3.patch.1.txt larry, 2013-08-12 18:26 review
Messages (5)
msg194716 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-08-09 04:55
The getxattr() system call retrieves an "extended attribute" on a file.  When you call it you pass in a buffer and a size.  The expected behavior is, if you pass in a buffer that's too small, the function returns -1 and sets errno to ERANGE.

On a ZFS filesystem on Linux, using the "ZFS On Linux" port:

getxattr() does not behave this way.  Instead, it fills the buffer with the first buffer-size bytes of data (without a zero terminator).

Python's implementation of getxattr() interprets this as success.  Which means that, the way it's implemented, if you call getxattr() to retrieve a value that's > 128 bytes in length, you only get the first 128 bytes.  (Happily, we already have a regression test that finds this!)

Attached is a patch fixing this behavior.  It checks the return value of getxattr() to see if the buffer was filled to 100%.  If so, it retries with a larger buffer.
msg194982 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-08-12 18:26
Attached is an updated patch, this time for 3.3.  (So I'm guessing we won't get a "review" link.)  It incorporates Benjamin's two comments.
msg194983 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-08-12 18:37
Okay. Hopefully, we can kill that thing one day...
msg194991 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-08-12 19:20
Kill what thing?  The review link?  I love that thing?

Anyway, we did get a review link, hoopla!
msg195022 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-08-12 21:42
No, this extra code you're adding. :)

2013/8/12 Benjamin Peterson <>:
> Benjamin Peterson added the comment:
> Okay. Hopefully, we can kill that thing one day...
> ----------
> _______________________________________
> Python tracker <>
> <>
> _______________________________________
Date User Action Args
2022-04-11 14:57:49adminsetgithub: 62894
2013-08-13 11:13:24Arfreversetnosy: + Arfrever
2013-08-12 21:42:59benjamin.petersonsetmessages: + msg195022
2013-08-12 19:20:00larrysetmessages: + msg194991
2013-08-12 18:37:18benjamin.petersonsetmessages: + msg194983
2013-08-12 18:26:21larrysetfiles: + larry.setxattr.zfs.3.3.patch.1.txt

messages: + msg194982
2013-08-09 06:26:41pitrousetnosy: + benjamin.peterson
2013-08-09 04:55:33larrycreate