Subject: [Boost-bugs] [Boost C++ Libraries] #1701: boost::filesystem::remove_all - segmentation fault with wpath on Linux
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-03-20 15:45:43
#1701: boost::filesystem::remove_all - segmentation fault with wpath on Linux
-------------------------------------+--------------------------------------
Reporter: Igor.Solovyov_at_[hidden] | Owner: bemandawes
Type: Bugs | Status: new
Milestone: Boost 1.36.0 | Component: filesystem
Version: Boost 1.34.1 | Severity: Problem
Keywords: remove_all |
-------------------------------------+--------------------------------------
Hi,
I came across unexpectedly on the problem with
boost::filesystem::remove_all and widechar-strings on the Linux and GCC.
My compilation environment:
- Fedora7;
- gcc version 4.1.2 20070925 (Red Hat 4.1.2-27);
- boost 1.34.1.
The following test program leads segmentation fault at the line marked
with "Boom!!!" comment.
{{{
#include <iostream>
#include <boost/filesystem.hpp>
int main( int argc, char const * argv[] )
{
namespace fs = boost::filesystem;
// This doesn't work
fs::wpath tempRoot = L"./temp1/temp2";
fs::wpath root = L"./temp1";
// This works.
//fs::path tempRoot = "./temp1/temp2";
//fs::path root = "./temp1";
try
{
std::cerr << "--- boost filesystem test --- " << std::endl;
bool bRes = fs::create_directories( tempRoot );
std::cerr << "bRes: " << bRes << std::endl;
if ( bRes )
{
unsigned long n = fs::remove_all( root ); // <- Boom!!!
std::cerr << "n: " << n << std::endl;
}
}
catch ( std::exception const & ex )
{
std::cerr << "Exception: " << ex.what() << std::endl;
}
return 0;
}
}}}
The source was compiled with following options:
g++ -g boost_fs.cpp -I/usr/local/include/boost-1_34_1 -lboost_filesystem-
gcc41-1_34_1 -o boost_fs.exe
Note, the problem arises if Unicode string is used.
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1701>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC