Created attachment 35216 [details] Preprocessed minimum-repro.ii Basic description of the problem: Application writing into a libstdc++ ofstream from a Mac OS X 10.9 or 10.10 host to a samba shared folder hosted on Windows 7/8/2008 Server (the combination of OS X + Windows has to support SMB 2.1) can produce file corruption. Reproductions steps: You need two PCs visible to each other in a network: a. a Mac running OS X 10.9 or later b. a Windows 7, Windows Server 2008 R2 or later PC. 1. Share a test folder on the Windows PC so that it is visible for the Mac in the network 2. Connect the Mac to the windows shared folder using the smb protocol: e.g. in OSX Finder, connect to server smb://name-of-windows-pc/name-of-share (the share should now be visible under /Volumes/name-of-share/) 3. Compile this application on the Mac against libstdc++ e.g. apple clang 5.0: clang++ ./minimum-repro.cpp -stdlib=libstdc++ -o minimum-repro g++ (4.0 or later): g++ ./minimum-repro.cpp -o minimum-repro 4. Run the compiled app on the Mac, with a single argument, a path to a file on the network share: e.g. ./minimum-repro /Volumes/name-of-share/corruption-test.txt The file will be written and it's contents read back and checked against the reference - they will not match in contents, i.e. the file has been corrupted on write. The key to bug reproduction is to first write a small block of data (< 1022 bytes) and then a large block (> 0.5 MB) into an ofstream opened on the shared folder. The file will be corrupt from the 0.5 MB mark onwards. Flushing the ofstream between the writes, writing smaller blocks all make the problem go away. Built on OS X 10.8.5 and 10.9 with g++ 4.0.1, 4.2.1 and apple clang 5.0 and 5.1 using libstdc++ (6.0.9). Tested on OS X 10.9, 10.10 (host) and Windows 7 and 8 (file server). Version information: $ g++-4.0 -v Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc_40/gcc_40-5494~315/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin10 --with-arch=apple --with-tune=generic --host=i686-apple-darwin10 --target=i686-apple-darwin10 Thread model: posix gcc version 4.0.1 (Apple Inc. build 5494) $ g++-4.2 -v Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc/gcc-5666.3~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5666) (dot 3) $ clang++ -v Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.0.0 Thread model: posix $ clang++ -v Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin12.5.0 Thread model: posix Command-line to compile: g++: g++ ./minimum-repro.cpp -o ./minimum-repro clang: clang++ ./minimum-repro.cpp -stdlib=libstdc++ -o ./minimum-repro
Created attachment 35217 [details] Original minimal reproduction .cpp Full minimal reproduction source .cpp
(In reply to Kaarlo Kananen from comment #0) > Built on OS X 10.8.5 and 10.9 with g++ 4.0.1, 4.2.1 and apple clang 5.0 and > 5.1 using libstdc++ (6.0.9). Your version of libstdc++ is *ancient* (at least 7 years old) and not supported or maintained. Please either report it to Apple, who provided you with the ancient library, or try with a newer version of libstdc++.
Closing as INVALID since no feedback has been provided in over 8 months.