Add a warning for case sensitive differences

Bug #1843415 reported by Dino Ghilardi
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
Wishlist
Wayne Stambaugh

Bug Description

If you name two hierarchical sheets with (very) similar names, like
"file1.sch" and "File1.sch", this will work on case sensitive file systems, while it can generate errors in case insensitive file systems.

Although using filenames as such (mostly identical names for different sheets) is not a good practice, it is still "legal" in eeschema, and copying the project from a case-sensitive machine (i.e. Linux) to a case-insensitive machine (i.e. dos/win) will lead to differences in the behaviour.
For instance, if the two names refer to one child sheet and its parent this will create a circular dependency on schematics and likely crash eeschema on windows machines but not on Linux machines.

Cheers,
Dino.

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

The warning would need to be optional that users can disable

summary: - eeschema wishlist: Add a warning when two sheets have filenames that
- become the same on case insensitive filesystems
+ Add a warning when child sheet is named the same as parent (case
+ sensitive)
summary: - Add a warning when child sheet is named the same as parent (case
- sensitive)
+ Add a warning for case sensitive differences
Changed in kicad:
importance: Undecided → Wishlist
status: New → Triaged
tags: added: starter
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I'm assuming this affects the 5.1 branch so I'm going to set the milestone to 5.1.6.

Changed in kicad:
milestone: none → 5.1.6
Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

Yes, it affects all versions, including 5.1 branch on case-insensitive machines.
Attached an example project (edited to have recursion also on case-sensitive machines)

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

Maybe it should just warn the user if it is on a case insensitive system, in other words when reading or creating.

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

With #4 it does not need to be a configurable warning.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

This is one of those rare cases where nag-ware might be acceptable. One of the goals of KiCad is cross platform compatibility so a warning might be justified. I would add a "Don't show this message again" checkbox to the warning so users would understand the consequences can ignore the warning in the future.

Changed in kicad:
assignee: nobody → Wayne Stambaugh (stambaughw)
Revision history for this message
Nick Østergaard (nickoe) wrote :

But won't kicad crash or something if it really tries to continue?

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I wouldn't think so on case sensitive file systems because foo.sch and Foo.sch are not the same file so there would be no conflict but I have never tested this so I cannot say for sure. I can say that on windows, this would be a problem unless the user has ntfs configured for case sensitive file names.

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

It may be my ignorance being at play here. What I mean is that kicad knows the filenames and should be able to detect conflicts of names and for case in-sensitive names. My reasoning is that we should be able to do this regard less of the user adding a new schematic or reading a project in created elsewhere. -- But we only show the warning when adding or reading it on a case in-sensitive system.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I'm pretty sure you cannot read an existing file that would cause the recursion bug regardless if the OS's file name case sensitivity. This bug was fixed a long time ago. The warning should be on the case sensitive file systems to prevent the user from creating or reading a schematic that could not be loaded on case insensitive platforms due to the recursion check failing on schematic load.

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

Yes, the main problem is when you send a project to machines with different case sensitivity: I created a project on a Linux machine, passed it to Mitja that used a case-insensitive OS and the recursion was there (unzipping the project the two case-different filenames ended up in a single filename).

The project that caused the issue is:
https://github.com/MitjaNemec/Kicad_action_plugins/files/3594719/replicateLayout_5_1_4.zip

To read a little bit more:
https://github.com/MitjaNemec/Kicad_action_plugins/issues/64

Cheers, Dino.

P.S.: if you have a recursion eeschema still crashes (tested yesterday on master and 5.1.2 versions, see attached "malformed" file).

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

@Seth, just for clarification you are talking about adding a new sheet or changing the file name of an existing sheet to the current project folder with a similar name.

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

I think for both cases and for all systems, regardless of their case sensitivity.

Either way, we would be generating a project that could work on one system but not on another, which is what we would be warning the user about.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I took a look at this issue and there are multiple issues here so I will probably have to break it into more than one bug fix so it can be cherry picked into 5.1. The first problem is the sheet hierarchy search function does a case insensitive comparison so the first file name with only case differences loaded will be used for every sheet instance. For example if the first sheet loaded is linked foo.sch then all sheets that are linked to [Ff][Oo][Oo].[Ss][Cc][Hh] will be linked to foo.sch which would result in a broken schematic. Given that this bug has never been reported, I suspect no user has ever done this but it is a bug none the less. This bug has one good side affect in that it doesn't allow you to create a new file name with case sensitivity issue because always thinks the file already exists. However, you can still edit the file name by just change the letter case in the sheet properties and it will change the name in the schematic sheet file name property but it will not actually create a new schematic with the file name case changes. There is so much broken here, I'm almost sorry I looked.

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

Moreover, the check seems not to include the master sheet name, so you can create a subsheet with the same name of the top schematic. (see attached file as an example project created using master branch, on Linux, with "casesensitive.sch and caseSensitive.sch).
Trying to create sub-sub-sheets gives you the pop-up warning.

Application: Eeschema
Version: (5.99.0-373-gf8aea249d-dirty), 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-8-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    Build date: Nov 16 2019 07:30:35
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.52.1
    Compiler: GCC 6.3.0 with C++ ABI 1010

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

Also on 5.1.5rc1 the behaviour is the same. Attached the project created on 5.1.5rc1.

Cheers, Dino.

-----------------
Application: Eeschema
Version: (5.1.5-rc1-10-gd701c3a48), 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-8-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.69.0
    OpenCASCADE Community Edition: 6.8.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_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

errata: on #15 please read "with the same name of" as "the same 'case-unsensitive name' of"

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I changed my mind and just fixed all of the issues that I could find except for schematics that already a broken by the recursion loop issue. That has to be fixed in the schematic plugin so it's not as straight forward as preventing the issue in the first place. Please let me know if you find any issues.

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

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

Changed in kicad:
status: Triaged → Fix Committed
Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

Hi wayne,
I tried the last version, but I was still able to create sub-sheets with differences only in kese style (see attached project), without having the warning on the case-unsensitive non-difference between the names.

Cheers,
Dino.

Application: Eeschema
Version: (5.99.0-393-gd4cea0f2b-dirty), 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-8-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    Build date: Nov 18 2019 18:01:21
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.52.1
    Compiler: GCC 6.3.0 with C++ ABI 1010

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

@Dino, I confirmed this. It's very strange that you managed to find a case that caused the test to fail. Apparently wxString::CmpNoCase() has a bug. Converting all of the characters to lower case before performing the comparison seems to have resolved this issue with your sample board. Let me know if you are still having issues.

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.