Re: [Boost-bugs] [Boost C++ Libraries] #13189: copy throws exception from a function defined as noexcept

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13189: copy throws exception from a function defined as noexcept
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-11-11 15:07:31


#13189: copy throws exception from a function defined as noexcept
-------------------------------+-------------------------
  Reporter: kukkerman@… | Owner: Beman Dawes
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: filesystem
   Version: Boost 1.63.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+-------------------------

Comment (by Gábor Szuromi <kukkerman@…>):

 After running a few tests not just `filesystem::copy_file` but
 `filesystem::copy_symlink` and `filesystem::copy_directory` functions are
 affected depending on what kind of file `from` points to. All of these
 errors can easily be fixed by rewriting `filesystem::detail::copy` to call
 functions defined in `filesystem::detail` namespace instead of
 `filesystem` namespace. Because I was unable to attach a patch file to the
 ticket I'm pasting the patched `filesystem::detail::copy` function here:
 {{{
   BOOST_FILESYSTEM_DECL
   void copy(const path& from, const path& to, system::error_code* ec)
   {
     file_status s(symlink_status(from, *ec));
     if (ec != 0 && *ec) return;

     if(is_symlink(s))
     {
       copy_symlink(from, to, ec);
     }
     else if(is_directory(s))
     {
       copy_directory(from, to, ec);
     }
     else if(is_regular_file(s))
     {
       copy_file(from, to, fs::detail::copy_option::fail_if_exists, ec);
     }
     else
     {
       if (ec == 0)
         BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::copy",
           from, to, error_code(BOOST_ERROR_NOT_SUPPORTED,
 system_category())));
       ec->assign(BOOST_ERROR_NOT_SUPPORTED, system_category());
     }
   }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13189#comment:4>
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-11-11 15:14:10 UTC