Please have a look at this thread:
http://www.mail-archive.com/[email protected]/msg73025.html
I exactly know where the problem lies. It is due to the brain dead
boostfs library. Indeed, I always apply the attached patch to my
cygwin builds and everything works ok. I have been testing this
patch by quite some time now, and never had a problem.
Any objections to apply it? If yes, then I suggest that Bo applies
it as a local patch to his package.
--
Enrico
Index: boost/libs/filesystem/src/path_posix_windows.cpp
===================================================================
--- boost/libs/filesystem/src/path_posix_windows.cpp (revision 15112)
+++ boost/libs/filesystem/src/path_posix_windows.cpp (working copy)
@@ -65,12 +65,12 @@ namespace
if ( end_pos && str[end_pos-1] == '/' ) return end_pos-1;
std::string::size_type pos( str.find_last_of( '/', end_pos-1 ) );
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
if ( pos == std::string::npos ) pos = str.find_last_of( ':', end_pos-2 );
# endif
return ( pos == std::string::npos // path itself must be a leaf (or empty)
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|| (pos == 1 && str[0] == '/') // or share
# endif
) ? 0 // so leaf is entire string
@@ -82,21 +82,21 @@ namespace
target = ""; // VC++ 6.0 doesn't have string::clear()
std::string::const_iterator itr( src.begin() );
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
// deal with //share
if ( src.size() >= 2 && src[0] == '/' && src[1] == '/' )
{ target = "//"; itr += 2; }
# endif
while ( itr != src.end()
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
&& *itr != ':'
# endif
&& *itr != '/' ) { target += *itr++; }
if ( itr == src.end() ) return;
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
if ( *itr == ':' )
{
target += *itr++;
@@ -133,7 +133,7 @@ namespace boost
{
// name_check functions ----------------------------------------------//
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
BOOST_FILESYSTEM_DECL bool native( const std::string & name )
{
return windows_name( name );
@@ -239,7 +239,7 @@ namespace boost
std::string::const_iterator itr( src.begin() );
// [root-filesystem]
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
if ( (checker == no_check || checker == native) && src.size() >= 2 )
{
// drive or device
@@ -264,14 +264,14 @@ namespace boost
// root directory [ "/" ]
if ( itr != src.end() && (*itr == '/'
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|| (*itr == '\\' && checker == native)
# endif
) )
{
++itr;
if ( m_path.size() == 0
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|| m_path[m_path.size()-1] == ':' // drive or device
|| ( // share
m_path.size() > 2
@@ -290,7 +290,7 @@ namespace boost
// directory-placeholder
if ( *itr == '.' && ((itr+1) == src.end() || *(itr+1) == '/'
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|| *(itr+1) == '\\'
# endif
) )
@@ -304,7 +304,7 @@ namespace boost
{
// append '/' if needed
if ( !empty()
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
&& *(m_path.end()-1) != ':'
# endif
&& *(m_path.end()-1) != '/' )
@@ -314,7 +314,7 @@ namespace boost
if ( *itr == '.'
&& (itr+1) != src.end() && *(itr+1) == '.'
&& ((itr+2) == src.end() || *(itr+2) == '/'
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|| *(itr+2) == '\\'
# endif
) )
@@ -331,7 +331,7 @@ namespace boost
do
{ name += *itr; }
while ( ++itr != src.end() && *itr != '/'
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
&& (*itr != '\\' || checker != native)
# endif
);
@@ -351,7 +351,7 @@ namespace boost
if ( itr != src.end() )
{
if ( *itr == '/'
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|| (*itr == '\\' && checker == native)
# endif
) ++itr;
@@ -367,7 +367,7 @@ namespace boost
std::string::size_type pos = 0, sz = m_path.size();
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
if ( sz > 2 && m_path[pos] != '/' && m_path[pos+1] == ':' ) // drive
{ pos += 2; sz -= 2; }
# endif
@@ -406,7 +406,7 @@ namespace boost
if ( m_path.empty() ) return *this;
std::string::size_type end, beg(0), start(0);
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
if ( m_path.size() > 2
&& m_path[0] != '/' && m_path[1] == ':' ) start = 2; // drive
# endif
@@ -440,7 +440,7 @@ namespace boost
{ // remove trailing '/' if not root directory
std::string::size_type sz = m_path.size();
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
if ( start ) sz -= 2; // drive
# endif
@@ -482,7 +482,7 @@ namespace boost
&&
(
len == 1 // "/"
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|| ( len > 1
&& ( s[len-2] == ':' // drive or device
|| ( s[0] == '/' // share
@@ -511,15 +511,19 @@ namespace boost
std::string::size_type pos( 0 );
if ( m_path.size() && m_path[0] == '/' )
{ pos = 1;
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
if ( m_path.size()>1 && m_path[1] == '/' ) // share
{
if ( (pos = m_path.find( '/', 2 )) != std::string::npos ) ++pos;
else return path();
}
}
+#ifdef __CYGWIN__
+ else if ( (pos = m_path.find( ':' )) != std::string::npos )
+#else
else if ( (pos = m_path.find( ':' )) == std::string::npos ) pos = 0;
else // has ':'
+#endif
{
if ( ++pos < m_path.size() && m_path[pos] == '/' ) ++pos;
# endif
@@ -529,7 +533,7 @@ namespace boost
std::string path::root_name() const
{
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
std::string::size_type pos( m_path.find( ':' ) );
if ( pos != std::string::npos ) return m_path.substr( 0, pos+1 );
if ( m_path.size() > 2 && m_path[0] == '/' && m_path[1] == '/' )
@@ -545,7 +549,7 @@ namespace boost
{
return std::string(
( m_path.size() && m_path[0] == '/' ) // covers both "/" and "//share"
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|| ( m_path.size() > 2
&& m_path[1] == ':'
&& m_path[2] == '/' ) // "c:/"
@@ -556,7 +560,7 @@ namespace boost
path path::root_path() const
{
return path(
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
root_name(), no_check ) /= root_directory();
# else
root_directory() );
@@ -572,6 +576,11 @@ namespace boost
&& ( (m_path[1] == ':' && m_path[2] == '/') // "c:/"
|| (m_path[0] == '/' && m_path[1] == '/') // "//share"
|| m_path[m_path.size()-1] == ':' );
+# elif defined(__CYGWIN__)
+ return (m_path.size() && m_path[0] == '/') || // both "/" and "//share"
+ (m_path.size() > 2
+ && ( (m_path[1] == ':' && m_path[2] == '/') // "c:/"
+ || m_path[m_path.size()-1] == ':' ));
# else
return m_path.size() && m_path[0] == '/';
# endif
@@ -581,7 +590,7 @@ namespace boost
{
return ( m_path.size()
&& m_path[0] == '/' ) // covers both "/" and "//share"
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|| ( m_path.size() > 1 && m_path[1] == ':' ) // "c:" and "c:/"
|| ( m_path.size() > 3
&& m_path[m_path.size()-1] == ':' ) // "device:"
@@ -591,7 +600,7 @@ namespace boost
bool path::has_root_name() const
{
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
return m_path.size() > 1
&& ( m_path[1] == ':' // "c:"
|| m_path[m_path.size()-1] == ':' // "prn:"
@@ -606,7 +615,7 @@ namespace boost
{
return ( m_path.size()
&& m_path[0] == '/' ) // covers both "/" and "//share"
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|| ( m_path.size() > 2
&& m_path[1] == ':' && m_path[2] == '/' ) // "c:/"
# endif
@@ -661,7 +670,7 @@ namespace boost
}
if ( m_path_ptr->m_path[m_pos] == '/' )
{
-# ifdef BOOST_WINDOWS
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
if ( m_name[m_name.size()-1] == ':' // drive or device
|| (m_name[0] == '/' && m_name[1] == '/') ) // share
{