Layer setup can be changed leading to data loss

Bug #1754049 reported by eelik
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Seth Hillbrand

Bug Description

It's possible to change the layer setup, the used layers, so that a layer which has items is removed. It could be OK but it's potential data loss because it's done silently without warning. I did it, although I can't imagine how it happened without me noticing it before several changes and git commits to a board. Apparently I was trying to remove Adhesive layers but accidentally clicked F.Paste. Why it didn't give errors before now is a mystery.

Doing it with F.Paste layer leads to paste-only pads to loose their layer in the file, for example
(pad "" smd rect (at 0 1 270) (size 1 0.75) (layers F.Paste)
becomes
(pad "" smd rect (at 0 1 270) (size 1 0.75) (layers)

When opening such a board a Warning dialog is shown, for example:
16:27:52: footprint D14, pad (unnamed): could not find valid layer for pad

This data loss happened on Windows about a month ago with a then current nightly build.

Tags: pcbnew
Revision history for this message
eelik (eelik) wrote :

There seems to be a check and warning when removing a layer but it works only for items which are directly on board, not for pads which are inside footprints.

Revision history for this message
Seth Hillbrand (sethh) wrote :

Confirmed on Linux. Setting to high as there is data loss and required deleting the component to get back to a valid board.

Application: kicad
Version: (5.0.0-rc2-dev-115-g414e6614f), release build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.52.1 GnuTLS/3.5.8 zlib/1.2.8 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3
Platform: Linux 4.9.0-5-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.62.0
    Curl: 7.52.1
    Compiler: GCC 6.3.0 with C++ ABI 1010

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_ACTION_MENU=OFF
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_SPICE=OFF

Changed in kicad:
importance: Undecided → High
milestone: none → 5.0.0-rc2
status: New → Confirmed
Jeff Young (jeyjey)
Changed in kicad:
assignee: nobody → hauptmech (hauptmech)
Revision history for this message
hauptmech (hauptmech) wrote :

I have to drop this. Leaving some breadcrumbs for the next guy:

The attached patch fixes the bug but was not accepted because it makes it possible to have modules in the design that are not selectable via the GUI.

Layer Setup has a comment in it saying that layers are being deleted because it causes problems for the DRC otherwise. A solution that does not delete layers will need to track down interactions with the DRC.

It was proposed to delete modules that have no selectable layers. This changes Setup Layers from a thing that deletes by layer to a thing that sometimes deletes modules. If this direction is chosen, better situation reporting before deletion might help with this. Currently there's just a blanket statement warning. If modules are to be deleted, listing them would help the user understand what kicad is doing and whether it's really what they want.

It was proposed to allow selecting modules by position when they have no other selectable contents. I think this is the best option proposed but implementing it would take more time than I have available.

Changed in kicad:
assignee: hauptmech (hauptmech) → nobody
Seth Hillbrand (sethh)
Changed in kicad:
assignee: nobody → Seth Hillbrand (sethh)
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

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

Changed in kicad:
status: Confirmed → Fix Committed
Changed in kicad:
status: Fix Committed → Fix Released
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.