[CalendarServer-dev] Re: twisted dav : xattrprops on linux

Wilfredo Sánchez Vega wsanchez at wsanchez.net
Tue Sep 12 08:19:40 PDT 2006


   Thanks, Guido.  I've committed this on the Twisted branch we're  
using and closed the bug.

   The question remains as to how "correct" this is really.  Is the  
"user." prefix a Linux system-wide restriction, or is it a per- 
filesystem thing?  If it's the latter, that means we'd have to check  
the filesystem type (which I don't know how to do from Python,  
offhand) every time we want to write a property.  That may be a  
downer, performance, wise.

   Something to keep an eye on.

	-wsv


On Sep 12, 2006, at 12:11 AM, Guido Guenther wrote:

> Hi Wilfredo,
> On Mon, Sep 11, 2006 at 03:12:51PM -0700, Wilfredo Sánchez Vega wrote:
>>   (Let's chat on the mailing list; I don't always respond to direct
>> mail, get too much and all that.)
>>
>>   That's a weird rule...
>>
>>   Does it make sense for this to be hidden in the xattr library?
>> Perhaps not...  I kinda hate to so this on OS X just because Linux is
>> weird.
> I'm using this in twisted to fix this:
>
> --- twisted/web2/dav/xattrprops.py.orig	2006-09-05  
> 22:09:03.000000000 +0200
> +++ twisted/web2/dav/xattrprops.py	2006-09-05 23:12:17.000000000 +0200
> @@ -32,6 +32,7 @@
>  __all__ = ["xattrPropertyStore"]
>
>  import urllib
> +import sys
>
>  import xattr
>
> @@ -58,8 +59,11 @@
>      #
>      # Dead properties are stored as extended attributes on disk.   
> In order to
>      # avoid conflicts with other attributes, prefix dead property  
> names.
> -    #
> -    deadPropertyXattrPrefix = "WebDAV:"
> +    # Linux additionally needs everything in the user namespace
> +    if sys.platform == 'linux2':
> +        deadPropertyXattrPrefix = "user.WebDav:"
> +    else:
> +        deadPropertyXattrPrefix = "WebDAV:"
>
>      def _encode(clazz, name):
>          #
>
> This looks clean and hardcodes the namespace at exactly one place.
> Addingt this to xattr doesn't seem reasonable since there are other
> namespaces.
> Cheers,
>  -- Guido



More information about the calendarserver-dev mailing list