Comment 0 for bug 1825203

Revision history for this message
Joel Stienlet (joelstienlet) wrote :

Hello,
When creating a new library in a folder where I don't have write permissions, the program quits with a segfault, without any indication about what went wrong.

The process gets into FILE_OUTPUTFORMATTER::FILE_OUTPUTFORMATTER in richio.cpp, then because I don't have write permissions in the directory, !m_fp is true, and normally it should throw the error: THROW_IO_ERROR( strerror( errno ) );
Here comes the bug: this error never gets displayed anywhere, I only get "segfault" in the terminal, whithout any further information. (Needless to say, such a situation is time-consuming when you don't even know where to start the debug.)

I compiled the latest sources from the github mirror, under fedora 29.

I tried to do this in FILE_OUTPUTFORMATTER::FILE_OUTPUTFORMATTER:

     if( !m_fp ) {
         fprintf(stderr,"Cannot open file %s : %s\n", static_cast<const char*>(aFileName.c_str()), strerror( errno ) );
         THROW_IO_ERROR( strerror( errno ) );
     }

My string to stderr gets printed correctly, thet it segfaults, so the bug comes from the exception management system. (and obviously from the permissions in my directory in the first place, but that's solved now)