[Gluster-devel] Weirdness in glfs_mkdir()?

Jay Vyas jayunit100 at gmail.com
Tue Oct 29 01:28:41 UTC 2013


wow.  im surprised.  this caught my eye, checked into the mode:

glfs_mkdir (struct glfs *fs, const char *path, mode_t mode)

So, somehow, the python API is capable of sending a "mode" which doesnt
correspond to anything enumerated as part of the mode_t, but the C method
still manages to write the file with a "garbage mode" ?

That sounds like a bug not in python.  Not in gluster... but in C ! :)  [if
im understanding this correctyle, which i might not be]









On Mon, Oct 28, 2013 at 7:19 PM, Anand Avati <avati at gluster.org> wrote:

> glfs_mkdir() (in glfs.h) accepts three params - @fs, @path, @mode.
> gfapi.py uses raw ctypes to provide python APIs - and therefore the bug of
> not accepting and passing @mode in the mkdir() method in gfapi.py is
> translating into a junk value getting received by glfs_mkdir (and random
> modes getting set for various dirs). You  just witnessed the woe of a
> typeless system :)
>
> Avati
>
>
> On Mon, Oct 28, 2013 at 1:31 PM, Justin Clift <jclift at redhat.com> wrote:
>
>> Hi Avati,
>>
>> When creating directories through glfs_mkdir() - called through
>> Python - the directories have inconsistent mode permissions.
>>
>> Is this expected?
>>
>> Here's the super simple code running directly in a Python
>> 2.7.5 shell, on F19.  It's a simple single brick volume,
>> XFS underneath.  Gluster compiled from git master head over
>> the weekend:
>>
>>   >>> vol.mkdir('asdf')
>>   0
>>   >>> vol.mkdir('asdf/111')
>>   0
>>   >>> vol.mkdir('asdf/112')
>>   0
>>   >>> vol.mkdir('asdf/113')
>>   0
>>   >>> vol.mkdir('asdf/114')
>>   0
>>   >>> vol.mkdir('asdf/115')
>>   0
>>   >>> vol.mkdir('asdf/116')
>>   0
>>   >>> vol.mkdir('asdf/117')
>>   0
>>
>> Looks ok from here, but ls -la shows the strangeness of
>> the subdirs:
>>
>>   $ sudo ls -la asdf/
>>   total 0
>>   dr-x-w----. 9 root root  76 Oct 28 20:22 .
>>   drwxr-xr-x. 8 root root 114 Oct 28 20:22 ..
>>   d-w--w---T. 2 root root   6 Oct 28 20:22 111
>>   d--x--x--T. 2 root root   6 Oct 28 20:22 112
>>   dr--rw---T. 2 root root   6 Oct 28 20:22 113
>>   drwx--x---. 2 root root   6 Oct 28 20:22 114
>>   dr--r----T. 2 root root   6 Oct 28 20:22 115
>>   dr-x-w----. 2 root root   6 Oct 28 20:22 116
>>   drwx--x---. 2 root root   6 Oct 28 20:22 117
>>
>> Easily worked around using chmod() after each mkdir(), but
>> I'm not sure if this is a bug or not.
>>
>> ?
>>
>> Regards and best wishes,
>>
>> Justin Clift
>>
>> --
>> Open Source and Standards @ Red Hat
>>
>> twitter.com/realjustinclift
>>
>>
>
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at nongnu.org
> https://lists.nongnu.org/mailman/listinfo/gluster-devel
>
>


-- 
Jay Vyas
http://jayunit100.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-devel/attachments/20131028/a57532ad/attachment-0001.html>


More information about the Gluster-devel mailing list