cannot set attributes on symlink

Bug #919874 reported by Tim Cuthbertson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-xattr (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

xattr seems to read attributes from symlinks, but always set them on the underlying file. Here's an example by way of a shell session:

$ cd /tmp
$ touch target
$ ln -s target source

$ python -i
>>> import xattr
>>> symlink = xattr.xattr('source', options=xattr.XATTR_NOFOLLOW)
>>> underlying_file = xattr.xattr('target')
>>> symlink['user.test_xattr'] = '1'

# now we should have an attribute on the symlink itself, and nothing on the underlying file. But the opposite is true:

>>> symlink['user.test_xattr']
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)

/usr/lib/python2.7/dist-packages/xattr/__init__.pyc in __getitem__(self, item)
    131 return self.get(item)
    132 except IOError:
--> 133 raise KeyError(item)
    134
    135 def iterkeys(self):

KeyError: 'user.test_xattr'

>>> underlying_file['user.test_xattr']
'1'

Revision history for this message
Tim Cuthbertson (gfxmonk) wrote :

I've fixed the issue in a guthub fork, below:

https://github.com/xattr/xattr/pull/4

Dave Walker (davewalker)
Changed in python-xattr (Ubuntu):
importance: Undecided → Medium
Chuck Short (zulcss)
Changed in python-xattr (Ubuntu):
status: New → Triaged
Revision history for this message
Chuck Short (zulcss) wrote :

This should be fixed in xattr, please reopen if not.

Changed in python-xattr (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.