Bug 7310 - DOS attribute inconsistency with MS Office
Summary: DOS attribute inconsistency with MS Office
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.5.1
Hardware: x86 Linux
: P3 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-30 16:31 UTC by Justin Maggard
Modified: 2010-04-01 02:02 UTC (History)
0 users

See Also:


Attachments
Wireshark capture of modifying and saving the file from Word (153.19 KB, application/octet-stream)
2010-03-30 17:46 UTC, Justin Maggard
no flags Details
Test patch... (1.09 KB, patch)
2010-03-30 18:54 UTC, Jeremy Allison
no flags Details
git-am patch for 3.5.2 (1013 bytes, patch)
2010-03-30 20:05 UTC, Jeremy Allison
no flags Details
git-am patch for 3.4.x. (908 bytes, patch)
2010-03-30 20:09 UTC, Jeremy Allison
no flags Details
git-am format patch for 3.5.2 (1.11 KB, patch)
2010-03-31 00:07 UTC, Jeremy Allison
no flags Details
git-am format patch for 3.5.2 (1.18 KB, patch)
2010-03-31 00:18 UTC, Jeremy Allison
no flags Details
git-am format patch for 3.4.x. (1.24 KB, patch)
2010-03-31 00:26 UTC, Jeremy Allison
no flags Details
git-am patch for 3.5.2 (1.18 KB, patch)
2010-03-31 01:01 UTC, Jeremy Allison
vl: review+
Details
git-am format patch for 3.4.x (1.23 KB, patch)
2010-03-31 01:03 UTC, Jeremy Allison
vl: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Maggard 2010-03-30 16:31:16 UTC
Using Windows 7 and Office 2K3, I'm seeing an inconsistency with Samba's DOS attribute handling when compared with a Windows server.  I have enabled "store dos attributes" in my configuration.  To reproduce:
1) Create a .txt file in a Samba file share.  The archive bit should set.
2) Unset the archive bit.
3) Open, modify, and save the file in Microsoft Word.

At this point, the archive bit should be set again on the file, but it is not.  I have verified that the archive bit is set after doing the same operations against a Windows server.  If I use notepad instead of Word to modify the file, the archive bit does get set properly.  It looks like the problem stems from Word's usage of temporary files.
Comment 1 Jeremy Allison 2010-03-30 17:13:19 UTC
Can you attach a wireshark trace of the problem please ? Just want to make sure I can see the exact issue (just in case I have trouble repeating it).
Jeremy.
Comment 2 Justin Maggard 2010-03-30 17:46:03 UTC
Created attachment 5566 [details]
Wireshark capture of modifying and saving the file from Word
Comment 3 Jeremy Allison 2010-03-30 18:49:53 UTC
Ok, spotted the bug. Should have a fix for you very shortly...

Jeremy.
Comment 4 Jeremy Allison 2010-03-30 18:54:27 UTC
Created attachment 5567 [details]
Test patch...

Try this - should work (compiles but I haven't done a make test yet).
Jeremy.
Comment 5 Jeremy Allison 2010-03-30 20:05:36 UTC
Created attachment 5568 [details]
git-am patch for 3.5.2

Ok - here is a git-am simple patch for 3.5.2 - fixes the specific issue. More complete patch will be added to master.
Jeremy.
Comment 6 Jeremy Allison 2010-03-30 20:09:56 UTC
Created attachment 5569 [details]
git-am patch for 3.4.x.

Same patch for 3.4.x.

Jeremy.
Comment 7 Justin Maggard 2010-03-30 20:27:51 UTC
From my testing, both patches get the archive bit set on modification, but they have the unfortunate side-effect of not allowing me to unset the archive bit once it's already been set.
Comment 8 Jeremy Allison 2010-03-30 22:52:04 UTC
These patches aren't quite right yet. Still working on getting the behavior right.
Jeremy.
Comment 9 Jeremy Allison 2010-03-31 00:07:34 UTC
Created attachment 5570 [details]
git-am format patch for 3.5.2

Ok, I think this one does the trick. We were not setting the archive bit on a newly renamed file.
Jeremy.
Comment 10 Jeremy Allison 2010-03-31 00:18:46 UTC
Created attachment 5571 [details]
git-am format patch for 3.5.2

Arg. Get the patch right :-). We need to do a VFS_STAT before calling dos_mode() to ensure the stat struct is filled correctly.
Jeremy.
Comment 11 Jeremy Allison 2010-03-31 00:26:42 UTC
Created attachment 5572 [details]
git-am format patch for 3.4.x.

Similar patch for 3.4.x.
Justin please test !
Jeremy.
Comment 12 Jeremy Allison 2010-03-31 01:01:02 UTC
Created attachment 5573 [details]
git-am patch for 3.5.2

Sigh. Eventually I'll get this right. I need to set the "newfile" flag to file_set_dosmode() - if I don't I break the notify tests on rename of directories.
Jeremy.
Comment 13 Jeremy Allison 2010-03-31 01:03:34 UTC
Created attachment 5574 [details]
git-am format patch for 3.4.x

Same fix to the patch (set newfile = true) for 3.4.x.
Jeremy.
Comment 14 Jeremy Allison 2010-03-31 01:06:09 UTC
Ok, finally everything passes "make test". If I get confirmation from Justin I'll apply to master and get these reviewed and into 3.5.2 and 3.4.x.
Jeremy.
 
Comment 15 Justin Maggard 2010-03-31 13:55:08 UTC
These most recent patches now work perfectly for me in all my test cases.  Thanks!
Comment 16 Jeremy Allison 2010-03-31 14:00:28 UTC
Comment on attachment 5573 [details]
git-am patch for 3.5.2

Requesting review by volker so we can get this into 3.5.2 on freeze day :-).
Comment 17 Jeremy Allison 2010-03-31 14:00:50 UTC
Comment on attachment 5574 [details]
git-am format patch for 3.4.x

Requesting review by vl...
Comment 18 Volker Lendecke 2010-03-31 14:05:20 UTC
Comment on attachment 5573 [details]
git-am patch for 3.5.2

Ack, but it's too late for 3.5.2, timezones killed it...
Comment 19 Jeremy Allison 2010-03-31 15:39:18 UTC
Re-assigning to Karolin...
Comment 20 Jeremy Allison 2010-03-31 15:40:18 UTC
It's still the same day here (March 31st) so I'm hoping Karolin will see fit to consider this one (it's safer than some of the stuff that went into 3.5.2 today :-). Plus it needs to go into 3.4.x too...

Jeremy.
Comment 21 Karolin Seeger 2010-04-01 02:02:32 UTC
Pushed to v3-5-test and v3-4-test.
Closing out bug report.

Thanks!