SIGABRT (Abort) On Debian with boost::filesystem::path append
Does anyone have any suggestions on how I can fix/diagnose/troubleshoot this little problem? 11 std::cout << "Parsing folder " << folder_name << std::endl; (gdb) n Parsing folder testing 12 boost::filesystem::path folder(folder_name, boost::filesystem::native); (gdb) n 13 boost::filesystem::path message_to = folder / ".to"; (gdb) n Program received signal SIGABRT, Aborted. 0x4040583b in raise () from /lib/tls/libc.so.6 (gdb) TIA, Eric
Eric Hill wrote:
Does anyone have any suggestions on how I can fix/diagnose/troubleshoot this little problem?
11 std::cout << "Parsing folder " << folder_name << std::endl; (gdb) n Parsing folder testing 12 boost::filesystem::path folder(folder_name, boost::filesystem::native); (gdb) n 13 boost::filesystem::path message_to = folder / ".to"; (gdb) n
Program received signal SIGABRT, Aborted. 0x4040583b in raise () from /lib/tls/libc.so.6 (gdb)
I tried putting this into a little program (on Ubuntu, so it's a pretty similar setup) and got this: Parsing folder /home/daniel/test terminate called after throwing an instance of 'boost::filesystem::filesystem_error' what(): boost::filesystem::path: invalid name ".to" in path: ".to" Aborted Which seems a little clearer. The exception is thrown because ".to" isn't a portable path, so the solution is to write: boost::filesystem::path message_to = folder / boost::filesystem::path(".to", boost::filesystem::native); Which is pretty horrible so you might want to try setting a more lenient default name checker. I think you can do something like: // Allow any file name. bool name_check(std::string const&) { return true; } int main() { boost::filesystem::path::default_name_check(name_check); // ... } Life will be a lot easier with Boost 1.34 as the automatic name checking will be removed - but when it's going to be released is something of a mystery. As for why you're getting a SIGABRT instead of a nice error message, my uneducated guess is that either your build process is turning of the error handling or you have an exception safety error somewhere. If it's not the former then you'll probably want to look at the call stack at the point of the error. Daniel
[snip]
Parsing folder /home/daniel/test terminate called after throwing an instance of 'boost::filesystem::filesystem_error' what(): boost::filesystem::path: invalid name ".to" in path: ".to" Aborted
Which seems a little clearer. The exception is thrown because ".to" isn't a portable path, so the solution is to write:
boost::filesystem::path message_to = folder / boost::filesystem::path(".to", boost::filesystem::native);
Which is pretty horrible so you might want to try setting a more lenient default name checker. I think you can do something like:
[snip]
Life will be a lot easier with Boost 1.34 as the automatic name checking will be removed - but when it's going to be released is something of a mystery.
As for why you're getting a SIGABRT instead of a nice error message, my uneducated guess is that either your build process is turning of the error handling or you have an exception safety error somewhere. If it's not the former then you'll probably want to look at the call stack at the point of the error.
Thanks for the information Daniel - when I added the native name checker to the file name, the problem did get resolved. I'm not entirely sure why I was getting a SIGABRT, but at this point (now that it's working) I really don't care :) Thanks again, Daniel. Eric
participants (2)
-
Daniel James
-
Eric Hill