[filesystem] Strange problems on Cygwin with 1.36.0
According to http://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/index.htm#Cgywin Boost.Filesystem seems to be supported on Cygwin. However with the latest version 1.36.0 (which I've built with BOOST_POSIX_API defined) I don't seem to get any Boost.Filesystem function to work on Cygwin. I'm currently running some test cases and had to modify them for Cygwin like this: #if defined(__CYGWIN__) BOOST_CHECK(a == b); #else BOOST_CHECK(bfs::equivalent(a, b)); #endif If a and b contain the very same path you would expect both a == b and boost::filesystem::equivalent() to return true. However on Cygwin boost::filesystem::equivalent() returns false. If I use BOOST_CHECK(bfs::equivalent(a, b)) on Cygwin I get this error: unknown location(0): fatal error in "test_find_param": std::runtime_error: boost::filesystem::equivalent: No such file or directory: "\home\Boris\boost_1_36_0\libs\process\test\..\..\..\bin.v2\libs\process\test\gcc-3.4.4\debug\link-static\runtime-link-static\helpers.exe", "\home\Boris\boost_1_36_0\libs\process\test\..\..\..\bin.v2\libs\process\test\gcc-3.4.4\debug\link-static\runtime-link-static\helpers.exe" Both strings are exactly the same and contain valid Cygwin paths. Is Boost.Filesystem broken on Cygwin? Boris PS: I've a similar problem with boost::filesystem::create_directory() which can't create a directory for no obvious reason.
AMDG Boris wrote:
unknown location(0): fatal error in "test_find_param": std::runtime_error: boost::filesystem::equivalent: No such file or directory: "\home\Boris\boost_1_36_0\libs\process\test\..\..\..\bin.v2\libs\process\test\gcc-3.4.4\debug\link-static\runtime-link-static\helpers.exe", "\home\Boris\boost_1_36_0\libs\process\test\..\..\..\bin.v2\libs\process\test\gcc-3.4.4\debug\link-static\runtime-link-static\helpers.exe"
Both strings are exactly the same and contain valid Cygwin paths. Is Boost.Filesystem broken on Cygwin?
Do the filesystem regressions pass? Shouldn't that use forward slashes, "/home/Boris/..."? In Christ, Steven Watanabe
On Wed, 17 Sep 2008 03:09:50 +0200, Steven Watanabe
AMDG
Boris wrote:
unknown location(0): fatal error in "test_find_param": std::runtime_error: boost::filesystem::equivalent: No such file or directory: "\home\Boris\boost_1_36_0\libs\process\test\..\..\..\bin.v2\libs\process\test\gcc-3.4.4\debug\link-static\runtime-link-static\helpers.exe", "\home\Boris\boost_1_36_0\libs\process\test\..\..\..\bin.v2\libs\process\test\gcc-3.4.4\debug\link-static\runtime-link-static\helpers.exe" Both strings are exactly the same and contain valid Cygwin paths. Is Boost.Filesystem broken on Cygwin?
Do the filesystem regressions pass?
With 'bjam.exe cxxflags=-DBOOST_POSIX_API -q' I get this error: testing.capture-output ../../../bin.v2/libs/filesystem/test/operations_test.test/gcc-3.4.4/debug/link-static/operations_test.run /bin/sh: line 4: 1216 Aborted (core dumped) "../../../bin.v2/libs/filesystem/test/operations_test.test/gcc-3.4.4/debug/link-static/operations_test.exe"
"../../../bin.v2/libs/filesystem/test/operations_test.test/gcc-3.4.4/debug/link-static/operations_test.output" 2>&1 ====== BEGIN OUTPUT ====== API is POSIX operations_test.cpp(287): test fs::initial_pathfs::path().is_complete() failed in function: 'int test_main(int, char**)' operations_test.cpp(288): test fs::current_pathfs::path().is_complete() failed in function: 'int test_main(int, char**)' assertion "base.is_complete() && (ph.is_complete() || !ph.has_root_name()) && "boost::filesystem::complete() precondition not met"" failed: file "../../../boost/filesystem/operations.hpp", line 573 initial_path<path>().string() is "/home/Boris/boost_1_36_0/libs/filesystem/test" initial_pathfs::path().file_string() is "\home\Boris\boost_1_36_0\libs\filesystem\test" EXIT STATUS: 134 ====== END OUTPUT ====== I'm not sure if it makes any difference that I'm using the POSIX API on Cygwin? I built all Boost libraries with BOOST_POSIX_API defined which I think is not the default on Cygwin?
Shouldn't that use forward slashes, "/home/Boris/..."?
You are right, it should. :) However just like in the output of the test case above it's Boost.Filesystem which turns the slashes around. In the test cases which I had to modify for Cygwin I even used cygwin_win32_to_posix_path_list() to make sure that all paths I pass to Boost.Filesystem functions are POSIX paths (that's why a == b returns true). Boris
On Wed, 17 Sep 2008 11:53:03 +0200, Boris
On Wed, 17 Sep 2008 03:09:50 +0200, Steven Watanabe
wrote: AMDG
Boris wrote:
unknown location(0): fatal error in "test_find_param": std::runtime_error: boost::filesystem::equivalent: No such file or directory: "\home\Boris\boost_1_36_0\libs\process\test\..\..\..\bin.v2\libs\process\test\gcc-3.4.4\debug\link-static\runtime-link-static\helpers.exe", "\home\Boris\boost_1_36_0\libs\process\test\..\..\..\bin.v2\libs\process\test\gcc-3.4.4\debug\link-static\runtime-link-static\helpers.exe" Both strings are exactly the same and contain valid Cygwin paths. Is Boost.Filesystem broken on Cygwin?
Do the filesystem regressions pass?
I also tried now 'bjam.exe cxxflags=-DBOOST_CYGWIN_PATH -q': gcc.link ../../../bin.v2/libs/filesystem/test/path_test.test/gcc-3.4.4/debug/link-static/path_test.exe testing.capture-output ../../../bin.v2/libs/filesystem/test/path_test.test/gcc-3.4.4/debug/link-static/path_test.run ====== BEGIN OUTPUT ====== Platform is Windows (933) source.directory_string(): "/foo\bar\" != expected: "\foo\bar\" (934) source.directory_string(): "/\foo\bar\\" != expected: "\\foo\bar\\" (935) source.directory_string(): "/foo\\\bar\\\" != expected: "\foo\\\bar\\\" ../../../boost/test/minimal.hpp(117): test run_result == 0 || run_result == boost::exit_success failed in function: 'int main(int, char**)' **** 1 error detected Inserter and extractor test...foo/bar...foo/bar complete 3 errors detected EXIT STATUS: 201 ====== END OUTPUT ====== If I try 'bjam.exe -q' the Windows API is used for the test cases and I get a linker error (as I built all libraries with BOOST_POSIX_API). That's the only error I understand. :) Boris
Boris wrote:
According to http://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/index.htm#CgywinBoo... seems to be supported on Cygwin. However with the latest version 1.36.0 (which I've built with BOOST_POSIX_API defined) I don't seem to get any Boost.Filesystem function to work on Cygwin. I'm currently running some test cases and had to modify them for Cygwin like this:
When I compiled bcp for Cygwin, I had to define BOOST_CYGWIN_PATH before it worked correctly. I don't remember what was wrong or what that flag changes, so maybe someone else can explain it.
On Wed, 17 Sep 2008 04:43:01 +0200, Dave Steenburgh
Boris wrote:
According to http://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/index.htm#CgywinBoo... seems to be supported on Cygwin. However with the latest version 1.36.0 (which I've built with BOOST_POSIX_API defined) I don't seem to get any Boost.Filesystem function to work on Cygwin. I'm currently running some test cases and had to modify them for Cygwin like this:
When I compiled bcp for Cygwin, I had to define BOOST_CYGWIN_PATH before it worked correctly. I don't remember what was wrong or what that flag changes, so maybe someone else can explain it.
I added BOOST_CYGWIN_PATH and tried boost::filesystem::equivalent() - now it works! However I don't know if I should really add a #define BOOST_CYGWIN_PATH to my test cases as BOOST_CYGWIN_PATH implies BOOST_WINDOWS_PATH and BOOST_POSIX_API (according to boost/filesystem/config.hpp). If someone wants to use the Windows API on Cygwin the tests won't work? What is the recommendation for Cygwin? Should I simply use boost::filesystem::equivalent() and let users find out themselves what preprocessor directives they must define? The problem is also that BOOST_CYGWIN_PATH is nowhere documented. There are five links if I search for BOOST_CYGWIN_PATH in Google? Boris
On Wed, 17 Sep 2008 12:06:06 +0200, Boris
[...]What is the recommendation for Cygwin? Should I simply use boost::filesystem::equivalent() and let users find out themselves what preprocessor directives they must define? The problem is also that BOOST_CYGWIN_PATH is nowhere documented. There are five links if I search for BOOST_CYGWIN_PATH in Google?
The trick I have to use seems to be: #if defined(BOOST_POSIX_API) # if defined(__CYGWIN__) # undef BOOST_POSIX_API # define BOOST_CYGWIN_PATH # endif #endif I'm not sure if it wouldn't be better though if boost/filesystem/config.hpp defined BOOST_WINDOWS_PATH automatically if BOOST_POSIX_API and __CYGWIN__ are defined? Currently we have to tell Boost.Filesystem with BOOST_CYGWIN_PATH that we are on Cygwin and want to use the POSIX API. Then BOOST_WINDOWS_PATH is defined. Instead of telling Boost.Filesystem it could check if BOOST_POSIX_API and __CYGWIN__ are defined and then define BOOST_WINDOWS_PATH automatically? After all that's what I'm doing above? Boris
participants (3)
-
Boris
-
Dave Steenburgh
-
Steven Watanabe