#5355 closed Bugs (fixed)
boost filesystem on Qnx trouble
| Reported by: | Owned by: | Beman Dawes | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | filesystem | 
| Version: | Boost 1.45.0 | Severity: | Problem | 
| Keywords: | Cc: | 
Description
I had two problems with boost.filesystem in boost 1.46.1 that are addressed with the following patch:
- Compilation failure due to missing declaration of ::rename, which is resolved by including stdio.h. See also ticket:5277
 
- Runtime crash (segmentation fault) of boost::filesystem::file_size(...) because struct stat is 60 bytes in operations.cpp whereas everywhere else it is 72 bytes.
 
This patch fixes both issues (but probably needs to be guarded by proper preprocessor conditionals?)
diff -ru boost_1_46_1/libs/filesystem/v3/src/operations.cpp ../boost_1_46_1/libs/filesystem/v3/src/operations.cpp
--- boost_1_46_1/libs/filesystem/v3/src/operations.cpp	2011-03-03 18:00:21.000000000 +0000
+++ ../boost_1_46_1/libs/filesystem/v3/src/operations.cpp	2011-03-22 15:40:32.000000000 +0000
@@ -32,7 +32,7 @@
 
 #if !(defined(__HP_aCC) && defined(_ILP32) && \
       !defined(_STATVFS_ACPP_PROBLEMS_FIXED))
-#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect,
+//#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect,
 #endif
 #if !defined(__PGI)
 #define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX
@@ -182,6 +182,7 @@
 #include <string>
 #include <cstring>
 #include <cstdio>      // for remove, rename
+#include <stdio.h>
 #include <cerrno>
 #include <cassert>
 // #include <iostream>    // for debugging only; comment out when not in use
      Attachments (1)
Change History (6)
comment:1 by , 12 years ago
| Component: | None → filesystem | 
|---|---|
| Owner: | set to | 
comment:2 by , 12 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
by , 11 years ago
| Attachment: | operations.cpp_64.patch added | 
|---|
comment:3 by , 11 years ago
I've attached a proper fix to issue 2 that enables large file support. The problem was that the *FILE_OFFSET* defines were defined after some system header files were included indirectly by boost/config.hpp. I've simply moved the code block to the top and removed "!defined(__QNXNTO__) &&".
All regression tests on the release branch pass with the patch applied and a small test program is able to correctly report the size of a file that is larger than 4 gigs.
comment:4 by , 11 years ago
comment:5 by , 11 years ago
Thanks! Any chance of this making it into 1.47? As you may have noticed trunk tests passed on QNX (runner NA-QNX650-qcc-gnu0x) after you submitted the change.

(In [71131]) Fix #5355 QNX workarounds