2.0.7: inherit permissions = yes breaks setting read-only on files
mjt at tls.msk.ru
Tue Aug 22 15:04:16 GMT 2000
Robert Dahlem wrote:
> >> I'm quite sure this does not do what was intended: the part behind
> >> if(!ret)
> >> gets called when mkdir() does NOT fail, but it should be called
> >> when mkdir() DOES fail.
> >Nope, by that bad design chmod should be called only if mkdir succed,
> >or chmod will fail also.
> Oops. I thougt that the original patch tried to handle the situation
> with some (broken?) UNIXes where mkdir() in fact creates the directory,
> fails to set all the wanted bits and reports the later fact with a
> return code != 0
> How about handling that situation with something like the following? It
> leaves the return code from mkdir() intact for every but that special
> case (dir created but bits missing AND cannot be set afterwards).
int dos_mkdir(char *dname,mode_t mode)
ret = mkdir(dos_to_unix(dname,False),mode);
where HAVE_BROKEN_MKDIR should be set by autoconf
_only_when_mkdir_is_broken_. That's all.
I don't know such a system, and I don't know what is wrong with mkdir on
it, so I can't propose the test for autoconf. Maybe author of that patch does?
Note that anyway, even this variant should be corrected further.
I know of another side effects on this -- for example, on Linux, when
mounting msdos-based (or other that lacks "userid" attribute) filesystem
and accessing it via samba, we can't always do chmod, since we can be not
a owner of the file:
mjt <<--- note this one
022 <<--- and this one
$ mkdir test
$ ls -l
drwxrwxrwx 2 nobody nobody <Date> test
^^^^^^^^^ ^^^^^^^^^^^^^ and note this one
As you can see, stat's st_mode will be different from that
my umask should do, and I'm not an owner of a file.
This way, any attempt to create a directory will fail with
funny error message "directory already exists" from samba.
I don't know if this is possible on system with really broken mkdir.
There are another drawbacks with that extra chmod() call, that
was discussed heavily about two months ago.
Basically, Samba Team almost agreed that samba works on unix, and
it should follow it's semantics and it should not be an operating
system itself, just a _service_ that works on unix (well, mostly
More information about the samba-technical