Strings aren't quoted in pcbnew

Bug #1655193 reported by Ed Johns
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
Low
Jeff Young

Bug Description

Application: pcbnew
Version: 4.0.5 release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1009,GCC 5.2.0,wx containers,compatible with 2.8)
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Boost version: 1.57.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

Noticed this when using git and pcbnew. Not sure if it is a bug or wishlist.

I set the date field to $Format:%cd$ so that when I archive from a repository, it will expand the string to the release date. Git expands the string to a date with spaces. These fields aren't quoted in the file because there are no spaces as saved. When I try to open the file in pcbnew, there is a parse error.

I was able to workaround by adding a trailing space to force quotation, but that may be unreliable if pcbnew ever removes trailing white-space.

I love working with the software, and like I said, there is a workaround, so do with this what you will.

Thanks.

-Ed

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

I'm trying to understand what you mean by date field. Are you setting the date field in the kicad_pcb file header (the first line) or the title block date field or something else?

Revision history for this message
Ed Johns (ejohns) wrote :

Wayne,

I meant the date field in the title block. An example is $Format:cd$ with no quotes before git parsing changes to Tue Jan 10 05:56:54 2017 -0500. with spaces, but git doesn't automatically add quotes, which breaks pcbnew's read. A "simple change" could be to quote the strings even if no space is required, since quotes are escaped anyway.

And the "fix" for me ended up being changing $Format:cd$ to $Format:cd $ which forced pcbnew to quote the string anyway.

Thanks for following up.

-Ed

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

I know we've argued about this before and didn't come to an agreement, but honestly I agree. I know this isn't a use case we intend to support, but it is honestly just *weird* that we're deciding whether or not to quote strings based on whether they "need" it. It's error-prone and pointless.

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

This quoting was breifly discussed on the list, yes, but didn't we agree that we would try to force quoting but still support reading non quoted files?

Or now that we have a file version mechanism, simply start removing that, but still keep the support for reading unquoted strings in older files.

Revision history for this message
Jeff Young (jeyjey) wrote :

If we already quote "when needed", then the parser already knows how to handle quotes and there's no backwards compatibility issue. Why not just quote them all?

Changed in kicad:
milestone: none → 6.0.0-rc1
Jeff Young (jeyjey)
Changed in kicad:
status: New → Triaged
importance: Undecided → Low
Jeff Young (jeyjey)
Changed in kicad:
assignee: nobody → Jeff Young (jeyjey)
Jeff Young (jeyjey)
Changed in kicad:
status: Triaged → In Progress
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

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

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