[Boost-bugs] [Boost C++ Libraries] #11914: abort is called while boost::filesystem::copy tries to throw and exception

Subject: [Boost-bugs] [Boost C++ Libraries] #11914: abort is called while boost::filesystem::copy tries to throw and exception
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-01-15 08:14:49


#11914: abort is called while boost::filesystem::copy tries to throw and exception
--------------------------------------+------------------------------
 Reporter: jpo38 <jean.porcherot@…> | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.60.0
 Severity: Problem | Keywords:
--------------------------------------+------------------------------
 Im" using boost 1.60 with Visual Studio 2015 WIN64. Compiled boost simply
 by running:

     bootstrap.bat
     tools/build/b2 toolset=msvc-14.0 --build-type=minimal --link=static
 stage

 Now, I get a specific situation where abort is called while
 boost::filesystem::copy tries to throw an exception. Note that other
 boost::filesystem functions successfully throws.

 This code:


 {{{
 #include <boost/filesystem.hpp>
 #include <boost/filesystem/operations.hpp>

 #include <iostream>

 int main( int argc, char* argv[] )
 {
     // Stepping to folder:

     try
     {
 boost::filesystem::current_path("B:/dev/msvc2015/vobs_bci/public/tst/base/cppunit/utlfile");
         std::cout << "Worked" << std::endl; // works OK
     }
     catch (...)
     {

     }

     // test throwing upon copy_directory because dource folder does not
 exist:

     try
     {
         boost::filesystem::copy_directory("s", "b");
     }
     catch (...)
     {
         std::cout << "Caught" << std::endl; // works OK
     }

     // test throwing upon copy because target file already exists:

     try
     {
         boost::filesystem::copy("./test.h", "./copied.cpp"); // works
         boost::filesystem::copy("./test.h", "./copied.cpp"); // should
 throw and be caught
     }
     catch (...)
     {
         std::cout << "Caught" << std::endl; // never reached...
     }

     std::cout << "Done" << std::endl;

     return 0;
 }
 }}}

 Outputs:


 {{{
 Worked
 Caught
 }}}

 And then aborts...

 Posted on SO first: http://stackoverflow.com/questions/34793451/why-is-
 boostfilesystem-aborting-instead-of-throwing-an-exception

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11914>
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:50:19 UTC