[Pkg-samba-maint] Bug#525321: Bug#525321: Bug#525321: samba: "force create mode" option no longer works

Steve Langasek vorlon at debian.org
Fri Apr 24 23:47:01 UTC 2009


On Fri, Apr 24, 2009 at 10:30:15PM +0200, Luk Claes wrote:
>> Both the server and the client have a default umask of 0022 and I've
>> tried mounting the share with umask=0000 and that doesn't help.

>> Another weird thing I've noticed (which is not in 3.0.24-6etch10):

>> nikosapi at kubuntubox:~$ touch {copy,move}test; chmod 777 {copy,move}test
>> nikosapi at kubuntubox:~$ cp copytest /mnt/smb/archives/
>> nikosapi at kubuntubox:~$ mv movetest /mnt/smb/archives/

>> teh-server:~# ls -l /mnt/md1/archives/{copy,move}test
>> -rwxr-xr-x 1 samba samba 0 2009-04-24 15:41 /mnt/md1/archives/copytest
>> -rwxrwxrwx 1 samba samba 0 2009-04-24 15:40 /mnt/md1/archives/movetest

> This is because a umask has no effect on a move operation, but it does  
> on a copy operation.

More precisely, the "cp" command calls:

open("foo", O_RDONLY)                   = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("bar", O_WRONLY|O_TRUNC)           = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
read(3, "", 4096)                       = 0
close(4)                                = 0
close(3)                                = 0

and the "mv" command calls:

rename("foo", "/home/vorlon/baz")       = -1 EXDEV (Invalid cross-device link)
unlink("/home/vorlon/baz")              = -1 ENOENT (No such file or directory)
open("foo", O_RDONLY|O_NOFOLLOW)        = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("/home/vorlon/baz", O_WRONLY|O_CREAT|O_EXCL, 0600) = 4
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
read(3, "", 4096)                       = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fchmod(4, 0100644)                      = 0
^^^^^^
close(4)                                = 0
close(3)                                = 0


So when you have Unix extensions enabled, the chmod operation is honored,
overriding any defaults set on open by 'force create mode'.

If you don't want Unix modes on the client to be honored, you should disable
unix extensions.

>> Shouldn't the execute bits be wiped out by my "create mask" (0664)? And
>> why are the group and others' write bits being removed when copying?

> I guess copying nor moving is seen as creating a file. What's the  
> behaviour if you save a new file on the share?

Both create a file, but in one case the initial perms are overridden.

So if the only concern is the permissions when using 'mv', I would say this
is not a bug.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org





More information about the Pkg-samba-maint mailing list