Boost logo

Boost Users :

From: Dk Jack (dnj0496_at_[hidden])
Date: 2021-02-18 01:50:10


Hi,
I am using boost 1.58 in my project. Ran into a crash in the boost
filesystem library.
I've included the relevant stack trace at the end of the email. My code is
something like this:

  boost::filesystem::path fpath(mFilename.c_str());
  if (!boost::filesystem::exists(fpath)) {
    // log a message and return.
    return;
  }

  auto curr_time = boost::filesystem::last_write_time(fpath); <== crash

The crash is not consistent and happened randomly. I tested the above code
in a small test program with just the above code. I made the input file
unreadable etc, even then it was able to successfully read the last write
timestamp of the file without any issues. Not sure why this particular call
would throw an error. Since it's compiled with -O2, the error code is
optimized out in the stack trace. Any ideas?

Thanks for your help.
Dk.

(gdb) bt
#0 0x00007f01651ba387 in raise () from /lib64/libc.so.6
#1 0x00007f01651bba78 in abort () from /lib64/libc.so.6
#2 0x00007f0160d087d5 in __gnu_cxx::__verbose_terminate_handler() () from
/lib64/libstdc++.so.6
#3 0x00007f0160d06746 in ?? () from /lib64/libstdc++.so.6
#4 0x00007f0160d06773 in std::terminate() () from /lib64/libstdc++.so.6
#5 0x00007f0160d06993 in __cxa_throw () from /lib64/libstdc++.so.6
#6 0x00007f0161171f5f in
boost::filesystem::detail::last_write_time(boost::filesystem::path const&,
boost::system::error_code*) ()
   from xxx.so
#7 0x00007f0161089657 in last_write_time (p=...)
    at /usr/local/include/boost/filesystem/operations.hpp:594



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net