[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: pcb-20081128 is broken



Hello,

I'm having a difficulty getting a recent version of pcb to work on my
system.  First a little background: Ineiev has finished the layout of my
OSDCU board (he has done a great job of it too!), but before I run
pcb -x gerber OSDCU.pcb and send the resulting files to the fab, I would
really like to view the layout in the PCB GUI first.  So far I've been
checking the progress of the work by running pcb -x ps OSDCU.pcb,
lpr'ing the resulting PostScript and viewing it on paper, but this
method is rather limiting - I would like to examine the routing of
certain traces as they wind their way from layer to layer, and that is
really hard to do on paper - being able to bring up the GUI and
highlight the net(s) of interest to me would be much preferable.

The problem is that the only version of PCB that I have working with the
GUI is 20060822, and it's too old to open Ineiev's work: his OSDCU.pcb
has this line in it:

FileVersion[20070407]

So I went out to look for a newer version of pcb.  Going to
pcb.gpleda.org and selecting "Downloads" in the sidebar on the left
takes me to the download page on Sourceforge, and the only thing that's
listed there is the 20081128 release/snapshot.  Judging from the header
comments that's what Ineiev has used to, so it seemed like the right
version.  I have downloaded it, untarred it, configured it for the
lesstif HID and run make - compiled fine.  However, attempting to run
the resulting binary in the GUI mode results in a SIGSEGV crash.
(Running it with -x ps works fine though.)

I have finally found the time to investigate the crash with gdb, and
what I have found is really bizarre.  The crash occurs in this code in
hid/lesstif/menu.c, and my simple peasant mind can't comprehend how
could this code possibly ever work on anyone's system:

Widget
lesstif_menu (Widget parent, char *name, Arg * margs, int mn)
{
  Widget mb = XmCreateMenuBar (parent, name, margs, mn);
  char *filename;
  Resource *r = 0, *bir;
  char *home_pcbmenu, *home;
  int screen;
  Resource *mr;

  display = XtDisplay (mb);
  screen = DefaultScreen (display);
  cmap = DefaultColormap (display, screen);

  /* homedir is set by the core */
  home_pcbmenu = NULL;
  if (home == NULL)
    {
      Message ("Warning:  could not determine home directory (from HOME)\n");
    }
  else 
    {
      home_pcbmenu = Concat (home, PCB_DIR_SEPARATOR_S, ".pcb", 
         PCB_DIR_SEPARATOR_S, "pcb-menu.res", NULL);
    }

[rest of function snipped as it never gets that far]

Here we have an automatic variable declared inside the function
(char *home), it is never initialized, then it is compared with NULL,
and if not NULL, it is passed as the first pointer argument to Concat().

But it's an automatic variable that is never initialized!  Its value
will be random garbage on the stack, and that garbage (which happens to
be nonzero, 0x1e0 specifically on my Slackware Linux system) is passed
to Concat() as a pointer argument.  Concat() then passes this argument
on to strlen(), where the SIGSEGV occurs.

This has me really baffled.  I'm not trying to compile modern pcb on a
VAX or anything like that, I'm building it on a vanilla Slackware 10.2
system, i.e., reasonably modern Linux, but in any case the code is so
fundamentally broken that I can't understand how could it have possibly
ever worked on anyone's system.  How did this code get released, and how
are Ineiev and others seemingly able to run and use it?

And the biggest question of all, what can be done about it?

MS


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user