<div dir="ltr">On Mon, Oct 28, 2013 at 6:28 PM, Jay Vyas <span dir="ltr"><<a href="mailto:jayunit100@gmail.com" target="_blank">jayunit100@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>wow. im surprised. this caught my eye, checked into the mode: <br><br>glfs_mkdir (struct glfs *fs, const char *path, mode_t mode)<br>
<br></div>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" ? <br>
<br></div>That sounds like a bug not in python. Not in gluster... but in C ! :) [if im understanding this correctyle, which i might not be]</div></blockquote><div><br></div><div><br></div><div>Not sure whether its a bug or feature of C. C runtime is typeless. Python ctypes uses dlopen/dlsym which do symbol lookups - doesn't care whether the looked up symbol is a data structure or a function name - let alone do type matching!</div>
<div><br></div><div>Avati</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><br><br><br><br></div></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote"><div><div class="h5">On Mon, Oct 28, 2013 at 7:19 PM, Anand Avati <span dir="ltr"><<a href="mailto:avati@gluster.org" target="_blank">avati@gluster.org</a>></span> wrote:<br></div></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div dir="ltr">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 :)<span><font color="#888888"><div>
<br></div><div>Avati</div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 28, 2013 at 1:31 PM, Justin Clift <span dir="ltr"><<a href="mailto:jclift@redhat.com" target="_blank">jclift@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Avati,<br>
<br>
When creating directories through glfs_mkdir() - called through<br>
Python - the directories have inconsistent mode permissions.<br>
<br>
Is this expected?<br>
<br>
Here's the super simple code running directly in a Python<br>
2.7.5 shell, on F19. It's a simple single brick volume,<br>
XFS underneath. Gluster compiled from git master head over<br>
the weekend:<br>
<br>
>>> vol.mkdir('asdf')<br>
0<br>
>>> vol.mkdir('asdf/111')<br>
0<br>
>>> vol.mkdir('asdf/112')<br>
0<br>
>>> vol.mkdir('asdf/113')<br>
0<br>
>>> vol.mkdir('asdf/114')<br>
0<br>
>>> vol.mkdir('asdf/115')<br>
0<br>
>>> vol.mkdir('asdf/116')<br>
0<br>
>>> vol.mkdir('asdf/117')<br>
0<br>
<br>
Looks ok from here, but ls -la shows the strangeness of<br>
the subdirs:<br>
<br>
$ sudo ls -la asdf/<br>
total 0<br>
dr-x-w----. 9 root root 76 Oct 28 20:22 .<br>
drwxr-xr-x. 8 root root 114 Oct 28 20:22 ..<br>
d-w--w---T. 2 root root 6 Oct 28 20:22 111<br>
d--x--x--T. 2 root root 6 Oct 28 20:22 112<br>
dr--rw---T. 2 root root 6 Oct 28 20:22 113<br>
drwx--x---. 2 root root 6 Oct 28 20:22 114<br>
dr--r----T. 2 root root 6 Oct 28 20:22 115<br>
dr-x-w----. 2 root root 6 Oct 28 20:22 116<br>
drwx--x---. 2 root root 6 Oct 28 20:22 117<br>
<br>
Easily worked around using chmod() after each mkdir(), but<br>
I'm not sure if this is a bug or not.<br>
<br>
?<br>
<br>
Regards and best wishes,<br>
<br>
Justin Clift<br>
<br>
--<br>
Open Source and Standards @ Red Hat<br>
<br>
<a href="http://twitter.com/realjustinclift" target="_blank">twitter.com/realjustinclift</a><br>
<br>
</blockquote></div><br></div>
</div></div><br></div></div>_______________________________________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@nongnu.org" target="_blank">Gluster-devel@nongnu.org</a><br>
<a href="https://lists.nongnu.org/mailman/listinfo/gluster-devel" target="_blank">https://lists.nongnu.org/mailman/listinfo/gluster-devel</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br>Jay Vyas<br><a href="http://jayunit100.blogspot.com" target="_blank">http://jayunit100.blogspot.com</a>
</font></span></div>
</blockquote></div><br></div></div>