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
I'm pretty sure I encountered the same issue a while back, which was fixed by upgrading to a more recent boost. On Thu, 18 Feb 2021 at 07:50, Dk Jack via Boost-users < boost-users@lists.boost.org> wrote:
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 mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Richard Hodges hodges.r@gmail.com office: +442032898513 home: +376841522 mobile: +376380212
participants (2)
-
Dk Jack
-
Richard Hodges