fritzing / fritzing-app

Fritzing desktop application
http://fritzing.org
Other
3.96k stars 822 forks source link

XML comments containing svg tags, when placed after the < /svg> tag, causes (old and new) part editor to fail using a file. #2221

Open davidperrenoud opened 10 years ago

davidperrenoud commented 10 years ago

From jerome.b...@gmail.com on September 24, 2012 10:23:38

In the attached valid SVG file, the comment block contains a < circle / > tag. When the comment block is placed after the < /svg > tag, Fritzing's part editor (either the both old or the new one) produces an error. When the comment is placed just before the < /svg > tag, the file works just fine.

To my knowledge, there is no relevant limitation is the XML and SVG specifications that could explain the problem. The file validates at w3c. http://validator.w3.org/check --> This document was successfully checked as SVG 1.1 + IRI + XHTML5 + MathML 3.0! Use the file selection box above if you wish to re-validate the uploaded file rj45-wurth-61500814221_comment_at_the_end.svg

Fritzing --> Error reading file /tmp/ace51830d7cedfe4e1aabaef059dd0b9/generic_shrouded_pin_header_10_100mil.fzp_ace51830d7cedfe4e1aabaef059dd0b9_30.fzp: unable to create renderer for svg /home/jerome/init/.config/Fritzing/parts/svg/user/pcb/rj45-wurth-61500814221.svg_ace51830d7cedfe4e1aabaef059dd0b9_pcb_29.svg.

Two attached files: ..._at_the_end.svg --> fails to work ..._before_the_end.svg --> works

Attachment: rj45-wurth-61500814221_comment_at_the_end.svg rj45-wurth-61500814221_comment_before_the_end.svg

Original issue: http://code.google.com/p/fritzing/issues/detail?id=2221

davidperrenoud commented 10 years ago

From irasc...@gmail.com on September 24, 2012 13:46:58

Seems like a pretty contrived example with an easy workaround (i.e. remove the comment)

What is the error you are getting?

Status: Accepted
Owner: irasc...@gmail.com
Labels: -Priority-Medium Priority-Low

davidperrenoud commented 10 years ago

From jerome.b...@gmail.com on September 25, 2012 01:11:07

The complete error is quoted above. A window opens with "unable to create renderer…" and does not use the file. The confusing part is that Fritzing keeps all parts ever opened in the part editor in a ~/.config directory and apparently uses the other parts with the same name as a backup when it cannot use the new file. So that the actual behaviour I was seeing is that Fritzing would not apply the minor change I was trying to make (changing the thickness of a copper ring). Even copying the new design directly into the .fzz file would not make it update to the new ring value, as Fritzing was still using a file from its backup.

Sure, the workaround is easy to apply, it only took me 3 days of perplexity to figure out what the problem was.

So when I found that against all odds it was due to a comment block, I felt the need to document the issue.

davidperrenoud commented 10 years ago

From irasc...@gmail.com on September 25, 2012 01:46:52

Fair enough; my apologies--it didn't occur to me you were reporting the result of a long investigation.

I am not able to replicate this on the PC. Are you on Mac or Linux?

davidperrenoud commented 10 years ago

From jerome.b...@gmail.com on September 25, 2012 05:46:08

Here is the instructions for

Result (binary 0.7.7b 32 bits)

  1. The attached error window appears (the FIRST attached image).
  2. After the user presses the OK button, Fritzing 0.7.7b crashes.

When using svn r6381 with new parts editor with similar instructions: 3b. Right click->Edit and press Yes. (new part editor) 4b. Choose the third tab (PCB view), do File/Open and Choose the file with the name _comment_at_the_end.svg

Immediately after choosing this file, the error appears (the SECOND attached file)

5b. In the metadata, change the variant name to variant2. Save the component. 6b. same as 6.

Result ( r6381 ) 7b. The old file definition (which is is this case, a shrouded header) is displayed, not the updated file 8b. No crash.

It works fine when repeating the steps 0 to 6 changing for the file …_comment_before_the_end.svg

Attachment: bug-comment.png bug-comment1.png

davidperrenoud commented 10 years ago

From jerome.b...@gmail.com on September 25, 2012 06:08:39

Small mistake in the version description given in the above message. The text should read " r6481 ".

KjellMorgenstern commented 2 weeks ago

Still an issue. For example, in Fritzing parts, SMD_D2Pak.svg, add the circle comment:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg id="svg2825" width="61.654" height="39.331" version="1.1" xmlns="http://www.w3.org/2000/svg">
 <g id="silkscreen">
  <rect x=".17717" y=".17716" width="42.165" height="38.976" ry=".5" rx=".5"  fill="none" stroke="#fff"  stroke-width=".35433"/>
 </g>
 <g id="copper1" fill="#f7bd13">
  <rect id="connector2pad" x=".70866" y=".70865" width="29.764" height="37.913"/>
  <rect id="connector1pad" x="50.315" y="9.0354" width="10.63" height="3.5433"/>
  <rect id="connector0pad" x="50.315" y="26.752" width="10.63" height="3.5433"/>
 </g>
</svg>
<!-- <circle /> -->

This leads to the error fritzing-parts/core/SMD_N-FET.fzp: unable to create renderer for svg fritzing-parts/svg/core/pcb/SMD_D2Pak.svg