Field Validation Error - Leading or trailing white space should be removed automatically

Bug #1659526 reported by robotarmy
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Wishlist
Wayne Stambaugh

Bug Description

When copy-pasting Manufacturer Part Numbers, etc, out of datasheets, it's very easy to pick up a leading or trailing white space.

When pasting that information into a field in a part in EESchema, it fails with a dialog saying that leading and/or trailing white space isn't allowed.

Instead of failing, and canning the pasted data, it would be helpful if it just removed the offending whitespace (and for anyone who cares, threw up a dialog box saying it's removed whitespace with a "don't show this again" tickbox?)

Application: kicad
Version: 4.0.5 release build
wxWidgets: Version 3.0.2 (debug,UTF-8,compiler with C++ ABI 1002,GCC 4.2.1,STL containers,compatible with 2.8)
Platform: Mac OS X (Darwin 16.4.0 x86_64), 64 bit, Little endian, wxMac
Boost version: 1.57.0
         USE_WX_GRAPHICS_CONTEXT=ON
         USE_WX_OVERLAY=ON
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

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

Normally I'm against silently modifying data entered by a user, but I think we could probably safely strip whitespace. I'd much rather not have a dialog for that, it's pretty obnoxious.

Of course my _preferred_ way to approach this would be to fix the reason why leading/trailing whitespace isn't allowed -- why isn't it?? -- and leave that to the user. I'd much rather just store what the user types. You can delete it yourself. But if we can't allow storing whitespace I'd be okay with stripping it.

Changed in kicad:
status: New → Confirmed
importance: Undecided → Wishlist
Changed in kicad:
assignee: nobody → Wayne Stambaugh (stambaughw)
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

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

Changed in kicad:
status: Confirmed → Fix Committed
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I fixed this in the development branch. I chose to leave leading and trailing spaces in the fields where they are valid rather than silently strip them. I agree that that silently changing user input is less than desirable. The test for spaces in the reference and library editor value fields are part of the excluded character list so this should be fine. I will back port this to the stable 4 branch as part of the 4.0.7 release unless someone finds any issues with it.

tags: added: 4.0.5 4.0.6
Revision history for this message
Oivind Toien (otoien) wrote :

A comment to this fix, based on experience with the Sept 19 version, running under Win7: I have on a couple of occasions found that KiCad crashes when pasting information into the fields of the Field Properties dialog of in EESchema, typically part numbers from the Digi-Key site. Sometimes, actually fairly often, copying from Digikey somehow fails to copy the right information and instead copies a large field that appears to be blank but seems to also contain other characters like tabs. It is not consequent, often I can just continue and redo the copy - paste without any harm, but a few times pasting has caused a crash, so perhaps there is occasionally bad information or too much information pasted that KiCad cannot handle that leads to the crash.

Application: kicad
Version: (2017-09-19 revision dddaa7e69)-makepkg, release build
Libraries:
    wxWidgets 3.0.3
    libcurl/7.54.1 OpenSSL/1.0.2l zlib/1.2.11 libssh2/1.8.0 nghttp2/1.23.1 librtmp/2.3
Platform: Windows 7 (build 7601, Service Pack 1), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.60.0
    Curl: 7.54.1
    Compiler: GCC 7.1.0 with C++ ABI 1011

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=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_SPICE=ON

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1659526] Re: Field Validation Error - Leading or trailing white space should be removed automatically

I just tried this once again (windows 10) by selecting an entire
digi-key component web page and it didn't crash. I also tried a dozen
or so iterations of partial pages with no luck. The next time you
manage to make kicad crash doing this, please save the contents of your
clipboard to a text file and attach it to this report. Maybe that will
give us a clue.

On 10/27/2017 3:49 AM, Oivind Toien wrote:
> A comment to this fix, based on experience with the Sept 19 version,
> running under Win7: I have on a couple of occasions found that KiCad
> crashes when pasting information into the fields of the Field Properties
> dialog of in EESchema, typically part numbers from the Digi-Key site.
> Sometimes, actually fairly often, copying from Digikey somehow fails to
> copy the right information and instead copies a large field that appears
> to be blank but seems to also contain other characters like tabs. It is
> not consequent, often I can just continue and redo the copy - paste
> without any harm, but a few times pasting has caused a crash, so perhaps
> there is occasionally bad information or too much information pasted
> that KiCad cannot handle that leads to the crash.
>
> Application: kicad
> Version: (2017-09-19 revision dddaa7e69)-makepkg, release build
> Libraries:
> wxWidgets 3.0.3
> libcurl/7.54.1 OpenSSL/1.0.2l zlib/1.2.11 libssh2/1.8.0 nghttp2/1.23.1 librtmp/2.3
> Platform: Windows 7 (build 7601, Service Pack 1), 64-bit edition, 64 bit, Little endian, wxMSW
> Build Info:
> wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8)
> Boost: 1.60.0
> Curl: 7.54.1
> Compiler: GCC 7.1.0 with C++ ABI 1011
>
> 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=ON
> BUILD_GITHUB_PLUGIN=ON
> KICAD_USE_OCE=ON
> KICAD_SPICE=ON
>

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.