Bug 2146 - File corruption when compiling with Visual Studio 6.0 over Samba
File corruption when compiling with Visual Studio 6.0 over Samba
Product: Samba 3.0
Classification: Unclassified
Component: File Services
All Windows XP
: P1 normal
: none
Assigned To: Gerald (Jerry) Carter
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2004-12-10 11:55 UTC by James Debion
Modified: 2005-08-24 10:20 UTC (History)
0 users

See Also:

Patch (3.86 KB, patch)
2005-02-24 19:23 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Debion 2004-12-10 11:55:37 UTC
I am running Samba 3.0.9 on RHEL 3.0u3 and I am getting corrupted
files  ( according to the error message in VC98) that seems to only be
happening over Samba with VS 6.0/XP SP2 at the
command prompt.  This is reproducible in Samba 3.0.8, 3.0.2-6.3E and
I've been told

Here is the compiler error that I see in Windows XP SP2:

L:\eng\src\sv\dll>cl.exe /nologo /MT /W2 /GX /O2 /D "WIN32" /D
"_WINDOWS" /YX /c svapi.c
svapi.c(0) : fatal error C1001: INTERNAL COMPILER ERROR
      (compiler file 'msc1.cpp', line 1794)
       Please choose the Technical Support command on the Visual C++
       Help menu, or open the Technical Support help file for more information

When I change the environment by mounting the share via another
Windows XP machine it compiles fine.  Also when compiling from the
local disk everything is fine.

This happens only in a build script where multiple files are compiled.
If I manually change into the directory and run the above command it
_sometimes_ works, but never works when I place the command in a batch
.bat script.

Here is my smb.conf file:

# Global parameters
      workgroup = NDGENG
      server string = Samba Server
      socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
      printcap name = /etc/printcap
      preferred master = No
      local master = No
      Max log size = 99999999999999999999
      domain master = No
      dns proxy = No
      cups options = raw
      debug hires timestamp = yes
      debug timestamp = yes
;        debuglevel = 3

      comment = Home Directories
      read only = No
      browseable = No

      comment = Copy of b2:/u/rel
      path = /u/rel
      read only = No

Additionally included is the smbd.log file generated with debug = 10
and timing turned on.

The network environment is a VMware WinXP SP2 image running on
the RHEL 3.0 server.

Any help would be much appreciated.  I can send more detailed logs if
you need it. (TCPDUMP)

Also, I've found that others have had this similar issue but with no
success, perhaps they asked the wrong people (microsoft)
In that thread a MS employee responds that perhaps the problem is
within the network; "It is very unlikely we would patch
this problem, but if we did it would likely yield an error regarding network
conditions rather than compile successfully."

Comment 1 Gerald (Jerry) Carter 2004-12-10 12:24:48 UTC
also reproducible using the VC++ IDE on Win2k sp4. 
Comment 2 Gerald (Jerry) Carter 2005-02-07 08:18:02 UTC
can no longer reproduce this against 3.0.11.   
Comment 3 James Debion 2005-02-09 12:29:51 UTC
Problem still exists under the same conditions previously listed.
Comment 4 Gerald (Jerry) Carter 2005-02-24 08:47:25 UTC
jeremy, the key is to using a Makefile not the IDE.
Comment 5 Jeremy Allison 2005-02-24 18:52:14 UTC
I have now reproduced this and know what the problem is. VC++ is very sensitive
to the allocation size on disk. When we lie about the allocation then it fails.
I'll investigate more, but I should be able to fix this.
FYI: I can reproduce it with the GUI (I'm frightened to shut down my VC++
session in case it starts working again :-).
Comment 6 Jeremy Allison 2005-02-24 19:23:26 UTC
Created attachment 981 [details]

Ok, please try the enclosed patch or update out of 3.0 SVN. I think this
fixes the problem.
Comment 7 Jeremy Allison 2005-02-24 19:24:09 UTC
Ok, I'm closing this one out as I was able to reproduce it reliably, and then
fix it reliably with this patch.
Please re-open if it doesn't work, or add a "cool it works !" comment if it
fixes it :-).
Comment 8 Gerald (Jerry) Carter 2005-03-03 08:01:37 UTC
update on this one for posterity.  jeremy had to add a 
new service parameter to deal with this one.  
You will have to set 'allocation roundup size = 0' in the share 
in question to get compatibility with VC++.  The default
value will evert to the behavior in previous 3.0.x releases.
Comment 9 Gerald (Jerry) Carter 2005-08-24 10:20:54 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.