New submission from Larry Hastings:

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:
    http://zfsonlinux.org/

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.

----------
assignee: larry
components: Library (Lib)
files: larry.setxattr.zfs.patch.1.txt
messages: 194716
nosy: larry
priority: normal
severity: normal
stage: patch review
status: open
title: getxattr on Linux ZFS native filesystem happily returns partial values
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file31203/larry.setxattr.zfs.patch.1.txt

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18694>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to