Mailing list archives : pcb-rnd

ID:5785
From:rn...@igor2.repo.hu
Date:Wed, 17 Aug 2022 05:40:18 +0200 (CEST)
Subject:Re: [pcb-rnd] Crash on loading old pcb file
in-reply-to:5784 from Philipp Klaus Krause <pk...@spth.de>
 
 
On Tue, 16 Aug 2022, Philipp Klaus Krause wrote:
 
> I have an old pcb file. When trying to load it in pcb-rnd 3.0.4 from the Debian
> package, pcb-rnd just crashes.
 
 
Thank you, nice case! I'm going to share the full story.
 
 
Crash fixed in pcb-rnd r36744, your board now opens with error messages.
 
 
Your data is broken:
 
(which is no excuse for a segfault, of course, thus I had to fix the code)
 
The part of your file that causes the problem is Thermal in line 10. This 
should be a number larger than zero (close to 0.5). This controls "how 
thick thermal fingers should be". But the whole code design is totally 
broken so I recommend leaving it on the default 0.5 for all designs for 
now.
 
 
Fixes in pcb-rnd code I've just done:
 
- you get an error message right on load about having an invalid value 
there
 
- the part of the code being sensitive to this will override your invalid 
value locally to something real small that should still result in valid 
objects - and will give you an error message with coords where this 
happened so you can go and check how badly your thermal ended up
 
 
 
Archeology:
 
When it's zero, the code will end up creating zero-width objects. Since 
pcb 4.x also crashed on the file, I went back to the version I forked 
pcb-rnd from (some 2011 version) which also crashes. Wow, "did it ever 
work?" Then I looked at your file and saw you used a 2005 version. Which 
suggests this corner case used to do something meaningful back in 2005.
 
I had a release from 2006 unpacked on my disk, so after manually tweaking 
that damned autotools ./configure that of course fails after 16 years (due 
to autotool's utterly poor design), I managed to compile and run it. 
It fortunately managed to load the file and came up with real thin thermal 
fingers. Not as thin as ours now, and no error or warning either. Which I 
consider a bug.
 
Looking at the 2006 code, I think this only worked accidentally. Back then 
the code was part of draw.c and did not really tune the polygons, just 
drew some lines. So it was only a visual trick, not real copper. Some time 
between 2006-04 and 2007-02 this has changed and proper thermal handling 
was added: clearance cut out from the sorrunding polygon leaving the 
fingers there from the original polygon. When this happened initially, 
they already forgot to deal with corner cases on ThermScale.
 
 
Conclusion:
 
Your board most probably failed to load and render on any geda/pcb version 
since at least 2007, because it has an invalid value in Thermal which 
triggers a bug in how the whole thermal code is designed from the start. 
Accidentally this used to do something non-crashy pre-2007, that' how you 
got away with it.
 
At the moment, we are not bug-compatible with the 2006 version in the 
sense you won't get the same thickness of the thermal (ours is thinner), 
but we do approximately the same generic behavior plus we have loud error 
messages letting you know. At the end you don't want to attempt to fab 
such thin fingers, neither the 2006 version, nor our current version, so 
you should rather just set a more reasonable thermal scale value.
 
 
 
 
Best regards,
 
Igor2
 
 
 
 

Reply subtree:
5785 Re: [pcb-rnd] Crash on loading old pcb file from rn...@igor2.repo.hu