Segmentation fault (core dumped) due to missing write permissions

Bug #1542856 reported by Hermann Kleier
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Unassigned

Bug Description

I am using “kicad 0.201602050916+6538~42~ubuntu15.10.1”. I record my *.kicad_mod files with cvs. That makes my footprint read-only unless I explicitly invoke “cvs edit”. Every time when I try to overwrite my footprint-files with the footprint editor without making the file writeable, kicad aborts with the given message. I am aware that this is a plain user error. An error message telling me that the write permission is missing would be helpful. I reckon that this problem is straightforward. Would it be helpful to send the core file for more complex errors?

Related branches

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

A backtrace from the coredump will be enough I think.

I can't reproduce the segfault though. What I did was chmod -w on a kicad_pcb file and opened it with pcbnew. Can you state the exact steps to reproduce, and maybe without cvs?

Changed in kicad:
importance: Undecided → High
Revision history for this message
Nick Østergaard (nickoe) wrote :

... and of course modify the file and try to save it. (I did it on both the kicad_pcb and pro file)

Revision history for this message
Chris Pavlina (pavlina-chris) wrote :

Yup, I get "You do not have write permissions to save file </home/cmp/noname.kicad_pcb>." here. Can you give more exact steps to reproduce the problem? Could be something subtle.

Revision history for this message
Chris Pavlina (pavlina-chris) wrote :

To clarify, it's obvious that I cannot read, but when I try on a footprint file instead...

"IO_ERROR: user does not have write permission to delete file '/home/cmp/git/efm8ub2/pcblib/conn-cui.pretty/CONN-PJ-037A.kicad_mod'
from kicad_plugin.cpp : FootprintSave() : line 1853"

No segfault. This is a debug build, I don't have a release build handy - maybe it behaves differently there?

Revision history for this message
pipe (pipatron) wrote :

When I do this in Debian Testing I get a reasonably nice error requester saying:

IO_ERROR: user does not have write permission to delete file '/home/pipe/abc.pretty/abc.kicad_mod'
from kicad_plugin.cpp : FootprintSave() : line 1853

or if I write-protect abc.pretty:

IO_ERROR: Library '/home/pipe/abc.pretty' is read only
from kicad_plugin.cpp : FootprintSave() : line 1834

Clicking "Ok" or whatever, takes me back to the footprint editor without any issues. Maybe because I use a debug build?

Application: pcbnew
Version: (2016-02-02 BZR 6535, Git 0ef1eee)-product debug build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1009,GCC 5.3.1,wx containers,compatible with 2.8)
Platform: Linux 4.3.0-1-amd64 x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.58.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Revision history for this message
Hermann Kleier (hermann-kleier) wrote :

Sorry for my unclear report. The procedure to observe the problem is:

 - Have the kicad_mod file r/o.
 - Start the footprint editor from the kicad main menu and edit a footprint.
 - Use the “Export footprint” button and navigate to the r/o file.
 - Click and bomb.

One of my tests (today) opened a window asking me whether I wanted to send a report. I agreed. So may be you get some more info from that.

Attached you find the stack of the core.

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

I am sorry, I must have marked revision 6543 as the bug fix by mistake. If there were no other changes to fix it, then the bug must be still present.

Revision history for this message
Hermann Kleier (hermann-kleier) wrote : Re: [Bug 1542856] Re: Segmentation fault (core dumped) due to missing write permissions

Hi Maciej,

thank you for making it clear. I’ll wait for the next revision.

Hermann

On Tue, 9 Feb 2016, Maciej Sumiński wrote:

> I am sorry, I must have marked revision 6543 as the bug fix by mistake.
> If there were no other changes to fix it, then the bug must be still
> present.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1542856
>
> Title:
> Segmentation fault (core dumped) due to missing write permissions
>
> Status in KiCad:
> Fix Committed
>
> Bug description:
> I am using “kicad 0.201602050916+6538~42~ubuntu15.10.1”. I
> record my *.kicad_mod files with cvs. That makes my footprint read-
> only unless I explicitly invoke “cvs edit”. Every time when I try to
> overwrite my footprint-files with the footprint editor without making
> the file writeable, kicad aborts with the given message. I am aware
> that this is a plain user error. An error message telling me that the
> write permission is missing would be helpful. I reckon that this
> problem is straightforward. Would it be helpful to send the core file
> for more complex errors?
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1542856/+subscriptions
>

Changed in kicad:
status: Fix Committed → New
Revision history for this message
Hermann Kleier (hermann-kleier) wrote :

I’ve upgraded to revision 6545. The problem is still there (see attachment).

Procedure used:

 - Start kicad from the command line.
 - From there: start the footprint editor using a read-only footprint
 - Edit the footprint
 - Click the “Export Footprint” button
 - Select the footprint-file (read-only!)
 - Click “Save”
 - The warning “A file named "CUS-12B.kicad_mod" already exists. Do you want to replace it? …” is displayed.
 - Click “Replace”
 - There is no error message then. The program abort immediately.
 - The console reads: “Segmentation fault (core dumped)”.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

I tried to do that, and I have no crash, just the message about not writable file.

Revision history for this message
Hermann Kleier (hermann-kleier) wrote :

Meanwhile I am using build 6552. I have tried to isolate the problem as far as possible. I made up a fresh directory, placed an empty footprint file in it, made it read-only, and started kicad. All the steps are documented in the protocol which you can find in the attached file. All the steps within kicad are documented in the screenshots p01.png … p12.png which are recorded in chronological order. The “Replace”-confirmation was the last thing I could see from kicad.

I recorded the command line steps from an emacs-shell. Actually, I had observed the problem initially when I started kicad from the bare command line. To verify that it is not an emacs-artifact I performed the same steps from the command line —under X11, of course—. → same result.

To verify that the problem is not related to my current project file (th433.pro) I started by creating a new project and continued with the described steps. → same result.

To make sure that the problem does not depend on some strange setup on my workstation or even a hardware bug I installed kicad on a computer that had never seen kicad before and tried the very same procedure. Just like my workstation it was Ubuntu 15.10. → Same results.

I attach another file (bug_virgin) from that computer. There was the problem that I never had done any project on this device and therefore the footprint paths had not been set up before. I ignored the warning (see /home/h/Pictures/t01.png) and proceeded as explained before. Though the message “Segmentation fault (core dumped)” was written there was no core because cores are suppressed on Ubuntu by default (and I did not change that on that machine).

The warning showed me that all that could depend on the footprint paths in OTHER projects. There I had replaced the ”/usr/share/…” path by project-local paths because I wanted to keep track of them (cvs).

How can I provide more information?

Revision history for this message
Hermann Kleier (hermann-kleier) wrote :

The missing attachments…

Changed in kicad:
status: New → Fix Released
status: Fix Released → New
Revision history for this message
Hermann Kleier (hermann-kleier) wrote :

Sorry, but I fail to confirm that the problem is gone. Meanwhile I have upgraded to kicad 0.201602211417+6576~42~ubuntu15.10.1.

Today I tried three cases: The isolated case with nothing more than a write-protected file and a real-world case. I got three different results.

 1 The first case happens most likely when exporting footprints to w/o-files: A null pointer is passed to __GI__IO_fputs. (see kicad_core)

 2 The case showing the “error report window” is rare. It happened from the real-world project when trying to overwrite a read-only file. A core file was written too. (see kicad_core.png)

 3 One time an “error window” opened telling me that the footprint file is write-protected. This is the good case. Yes, it happened once!

 4 Finally I observed a strange case. I copied a set of 25 footprint-files to an empty directory and put an empty w/o-file in it (named dummy.kicad_mod). I configured the new directory as a library directory (the only one) and tried to overwrite the empty w/o-file. I got a parse-error. Repeating the attempt to store gave me another (different!) parse error. (see parse_error.png and parse_error_2.png). This could be repeated again and again. But when I tried to export my dummy pattern to the w/o-file, I got the core.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

If the crash happens only for the "export footprint" command, not the "save footprint", it is fixed in rev 6578.
It is Linux specific.

I did not seen any crash with the "save footprint" command.

Changed in kicad:
status: New → Fix Committed
Revision history for this message
Hermann Kleier (hermann-kleier) wrote :

Okay, that sounds good. I’ll wait for rev 6578 and rerun the tests.

Hermann

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

The commit made for this fix was cherry picked to 4.0.2.

Changed in kicad:
status: Fix Committed → Fix Released
Revision history for this message
Hermann Kleier (hermann-kleier) wrote :

Fix confirmed in “kicad 0.201603061448+6610~43~ubuntu15.10.1”. Thank you.

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.