Skip to contentSkip to conversation

samba changing mode of files on rename

DISCUSSION Jeff Layton 4 participants 6 messages Sep 17, 2010 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I recently noticed a regression in samba in the last few weeks. Here's a simple way to reproduce it:

1) use smbclient to put a file on a samba share
2) change the mode of the file to something without the owner execute bit set
3) rename the file using smbclient

When you do this, the newly renamed file will magically end up with the owner execute bit set. It seems like samba ought not be changing the mode of files when renaming them so I consider this a regression.

I've reported the bug in the Fedora BTS, and attached some info there. Anyone more familiar with this code willing to have a look?

    https://bugzilla.redhat.com/show_bug.cgi?id=617771

I've was able to reproduce it today using the most recent samba version available in the Fedora repos (3.5.5).

Thanks,

Signature · 1 line
Jeff Layton <[email protected]>
#1 lore raw
Quoted 14 lines · On Fri, 17 Sep 2010 13:00:05 -0400 Jeff Layton <[email protected]> wrote:

I recently noticed a regression in samba in the last few weeks. Here's a simple way to reproduce it:

1) use smbclient to put a file on a samba share
2) change the mode of the file to something without the owner execute bit set
3) rename the file using smbclient

When you do this, the newly renamed file will magically end up with the owner execute bit set. It seems like samba ought not be changing the mode of files when renaming them so I consider this a regression.

I've reported the bug in the Fedora BTS, and attached some info there. Anyone more familiar with this code willing to have a look?

Quoted 6 lines
    https://bugzilla.redhat.com/show_bug.cgi?id=617771

I've was able to reproduce it today using the most recent samba version available in the Fedora repos (3.5.5).

Thanks,

Volker pointed out a workaround on IRC...

If I set "map archive = no" then this doesn't seem to happen. So, I guess something has happened relatively recently to make renames set the archive bit?

Signature · 1 line
Jeff Layton <[email protected]>
#2 lore raw
Quoted 23 lines · Jeff Layton
Quoted 5 lines · On Fri, 17 Sep 2010 13:00:05 -0400 Jeff Layton <[email protected]> wrote:

I recently noticed a regression in samba in the last few weeks. Here's a simple way to reproduce it:

1) use smbclient to put a file on a samba share
2) change the mode of the file to something without the owner execute bit

set

Quoted 14 lines

3) rename the file using smbclient

When you do this, the newly renamed file will magically end up with the owner execute bit set. It seems like samba ought not be changing the mode of files when renaming them so I consider this a regression.

I've reported the bug in the Fedora BTS, and attached some info there. Anyone more familiar with this code willing to have a look?

    https://bugzilla.redhat.com/show_bug.cgi?id=617771

I've was able to reproduce it today using the most recent samba version available in the Fedora repos (3.5.5).

Quoted 7 lines
Quoted 1 line

Thanks,

Volker pointed out a workaround on IRC...

If I set "map archive = no" then this doesn't seem to happen. So, I guess something has happened relatively recently to make renames set the archive bit?

Interesting - but I would expect that rename would set the archive bit (creates, file modifications also set the bit in Windows). In Windows rename sets the archive bit (although we don't need to track the archive bit for Linux cifs.ko we probably could report it via xattrs for backup applications to use - much like Windows backup apps check/clear it).

See below:

C:\Users\stevef>echo newfile > new

C:\Users\stevef>attrib new
A C:\Users\stevef\new

C:\Users\stevef>attrib -a new

C:\Users\stevef>rename new newer

C:\Users\stevef>attrib newer
A C:\Users\stevef\newer

Signature · 3 lines
Thanks,

Steve

A message that is not in the archive (sent off-list or not yet received): AANLkTikctbnerDjPa8HS0JuB0jGv2ACjtt8AQ97LFVP9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 50 lines · Steve French
Quoted 23 lines · Jeff Layton
Quoted 19 lines · On Fri, 17 Sep 2010 13:00:05 -0400 Jeff Layton…

I recently noticed a regression in samba in the last few weeks. Here's a simple way to reproduce it:

1) use smbclient to put a file on a samba share
2) change the mode of the file to something without the owner execute bit set
3) rename the file using smbclient

When you do this, the newly renamed file will magically end up with the owner execute bit set. It seems like samba ought not be changing the mode of files when renaming them so I consider this a regression.

I've reported the bug in the Fedora BTS, and attached some info there. Anyone more familiar with this code willing to have a look?

    https://bugzilla.redhat.com/show_bug.cgi?id=617771

I've was able to reproduce it today using the most recent samba version available in the Fedora repos (3.5.5).

Quoted 7 lines
Quoted 1 line

Thanks,

Volker pointed out a workaround on IRC...

If I set "map archive = no" then this doesn't seem to happen. So, I guess something has happened relatively recently to make renames set the archive bit?

Interesting - but I would expect that rename would set the archive bit (creates, file modifications also set the bit in Windows).  In Windows rename sets the archive bit (although we don't need to track the archive bit for Linux cifs.ko we probably could report it via xattrs for backup applications to use - much like Windows backup apps check/clear it). See below:
C:\Users\stevef>echo newfile > new
C:\Users\stevef>attrib new
A            C:\Users\stevef\new
C:\Users\stevef>attrib -a new
C:\Users\stevef>rename new newer
C:\Users\stevef>attrib newer
A            C:\Users\stevef\newer
--
Thanks,

Quoted 1 line

Steve

Interesting - but I would expect that rename would set the archive bit (creates, file modifications also set the bit in Windows). In Windows rename sets the archive bit (although we don't need to track the archive bit for Linux cifs.ko we probably could report it via xattrs for backup applications to use - much like Windows backup apps check/clear it).

See below:

C:\Users\stevef>echo newfile > new

C:\Users\stevef>attrib new
A C:\Users\stevef\new

C:\Users\stevef>attrib -a new

C:\Users\stevef>rename new newer

C:\Users\stevef>attrib newer
A C:\Users\stevef\newer

--
Thanks,

Steve

A message that is not in the archive (sent off-list or not yet received): AANLkTi=LRTj8V5f+gJwLhj3tgz9KUPSg8jBqPL3GCjn2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw
Quoted 70 lines · On Fri, 17 Sep 2010 12:28:52 -0500 Steve French…
Quoted 50 lines · Steve French
Quoted 23 lines · Jeff Layton
Quoted 19 lines · On Fri, 17 Sep 2010 13:00:05 -0400 Jeff Layton…

I recently noticed a regression in samba in the last few weeks. Here's a simple way to reproduce it:

1) use smbclient to put a file on a samba share
2) change the mode of the file to something without the owner execute bit set
3) rename the file using smbclient

When you do this, the newly renamed file will magically end up with the owner execute bit set. It seems like samba ought not be changing the mode of files when renaming them so I consider this a regression.

I've reported the bug in the Fedora BTS, and attached some info there. Anyone more familiar with this code willing to have a look?

    https://bugzilla.redhat.com/show_bug.cgi?id=617771

I've was able to reproduce it today using the most recent samba version available in the Fedora repos (3.5.5).

Quoted 7 lines
Quoted 1 line

Thanks,

Volker pointed out a workaround on IRC...

If I set "map archive = no" then this doesn't seem to happen. So, I guess something has happened relatively recently to make renames set the archive bit?

Interesting - but I would expect that rename would set the archive bit (creates, file modifications also set the bit in Windows).  In Windows rename sets the archive bit (although we don't need to track the archive bit for Linux cifs.ko we probably could report it via xattrs for backup applications to use - much like Windows backup apps check/clear it). See below:
C:\Users\stevef>echo newfile > new
C:\Users\stevef>attrib new
A            C:\Users\stevef\new
C:\Users\stevef>attrib -a new
C:\Users\stevef>rename new newer
C:\Users\stevef>attrib newer
A            C:\Users\stevef\newer
--
Thanks,

Quoted 1 line

Steve

Interesting - but I would expect that rename would set the archive bit (creates, file modifications also set the bit in Windows). In Windows rename sets the archive bit (although we don't need to track the archive bit for Linux cifs.ko we probably could report it via xattrs for backup applications to use - much like Windows backup apps check/clear it).

See below:

C:\Users\stevef>echo newfile > new

C:\Users\stevef>attrib new
A C:\Users\stevef\new

C:\Users\stevef>attrib -a new

C:\Users\stevef>rename new newer

Quoted 7 lines

C:\Users\stevef>attrib newer
A C:\Users\stevef\newer

--
Thanks,

Steve

Yeah, it makes some sense that this would happen in hindsight, but it's rather problematic in conjunction with unix extensions. The default of "map *" being on doesn't take into account clients that actually care about the mode remaining consistent across operations like rename.

Signature · 1 line
Jeff Layton <[email protected]>

A message that is not in the archive (sent off-list or not yet received): 20100917131558.13a00c53-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org

#8 lore raw
Quoted 22 lines · On Fri, 17 Sep 2010 13:15:58 -0400 Jeff Layton…
Quoted 19 lines · On Fri, 17 Sep 2010 13:00:05 -0400 Jeff Layton…

I recently noticed a regression in samba in the last few weeks. Here's a simple way to reproduce it:

1) use smbclient to put a file on a samba share
2) change the mode of the file to something without the owner execute bit set
3) rename the file using smbclient

When you do this, the newly renamed file will magically end up with the owner execute bit set. It seems like samba ought not be changing the mode of files when renaming them so I consider this a regression.

I've reported the bug in the Fedora BTS, and attached some info there. Anyone more familiar with this code willing to have a look?

    https://bugzilla.redhat.com/show_bug.cgi?id=617771

I've was able to reproduce it today using the most recent samba version available in the Fedora repos (3.5.5).

Quoted 8 lines
Quoted 1 line

Thanks,

Volker pointed out a workaround on IRC...

If I set "map archive = no" then this doesn't seem to happen. So, I guess something has happened relatively recently to make renames set the archive bit?

Following up, it looks like windows sets the archive bit on a rename so I guess this behavior is "correct". The problem though is that this is problematic when unix extensions are in use. We generally don't want files changing mode like this on a rename...

Anyone have thoughts on a reasonable fix? Perhaps we can implicitly disable the "map *" options when unix extensions are enabled?

Signature · 1 line
Jeff Layton <[email protected]>