segfault when creating a new library

Bug #1825203 reported by Joel Stienlet
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Jeff Young

Bug Description

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.
[stienlet@localhost kicad-source-mirror]$ git rev-parse --short HEAD
1437e56b7

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)

Revision history for this message
Nick Østergaard (nickoe) wrote :

please add version information

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

I've added the version in the bug report now (1437e56b7)

description: updated
Jeff Young (jeyjey)
Changed in kicad:
assignee: nobody → Jeff Young (jeyjey)
milestone: none → 5.1.2
status: New → In Progress
Revision history for this message
Jeff Young (jeyjey) wrote :

@Joel, thanks for the in-depth investigation!

Changed in kicad:
importance: Undecided → High
Jeff Young (jeyjey)
Changed in kicad:
status: In Progress → Fix Committed
Changed in kicad:
status: Fix Committed → Fix Released
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 2bcf38d2b690b45c9835f77bc5609c444f61aeeb
https://git.launchpad.net/kicad/patch/?id=2bcf38d2b690b45c9835f77bc5609c444f61aeeb

Changed in kicad:
status: Fix Released → Fix Committed
Revision history for this message
Michael Kavanagh (michaelkavanagh) wrote :

Cherry-picked onto 5.1 branch and released in 5.1.2 6e8979d8d83d53816f08583a69a262a4e93066bd

https://github.com/KiCad/kicad-source-mirror/commit/6e8979d8d83d53816f08583a69a262a4e93066bd

Changed in kicad:
status: Fix Committed → Fix Released
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Thanks Michael, yesterday I slightly messed up the Janitor script while trying to fix it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.