Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 06 Nov 1995 04:53:00 -0800
From:      "Jordan K. Hubbard" <jkh@time.cdrom.com>
To:        ache@freefall.FreeBSD.org
Cc:        hackers@freefall.FreeBSD.org
Subject:   Ack!  Help, Andrey!  I'm having troubles in libdialog!
Message-ID:  <25875.815662380@time.cdrom.com>

next in thread | raw e-mail | index | archive | help
I thought the subject might get your attention.. :)

Anyway, in all seriousness, I'm having a bit of trouble figuring this
out and I could really use your (or anyone else's) help..  I will dive
on this one tomorrow as soon as I wake up again (in 4 hours :-( ) and
get back from some early appointments I have scheduled, but if you or
someone else were to give it a look in the interim, I'd be most
grateful.

Anyway, on to the symptoms:

One of the 1104 SNAP users reported that when he went to the new
package menu in sysinstall, selected the "All" category and checked
off a bunch of packages, it core dumped!  Naturally concerned, I went
to check it out and found some odd things..

First off, the package menu works by sucking in an INDEX file, parsing
the fields and building a link list hierarchy of package categories
and packages.  If we're a menu of package categories (right now
there's only one, at the very top) we use a normal menu to show them.
If we're a menu of packages (e.g. inside a category) then we use a
checklist menu to show which ones are selected.

This generally works just great *unless you check off more than 10
items in a scrolling list menu*, then the dialog_checklist menu
scrambles the stack!

The code fragment in question is here:

	if (hasPackages)  /* XX Point A XX */
	    rval = dialog_checklist(top->name, top->desc, -1, -1,
				    n > MAX_MENU ? MAX_MENU : n, n,
				    (unsigned char **)nitems, result);
	else	/* It's a categories menu */
	    rval = dialog_menu(top->name, top->desc, -1, -1,
			       n > MAX_MENU ? MAX_MENU : n, n,
			       (unsigned char **)nitems, result, pos, scroll);
	/* XX Point B XX */
	if (!rval && plist && strcmp(result, "UP")) {

If you go into dialog_checklist() at point A and check off 10
items or less, you'll come out just fine.  If you check off MORE
than 10 items in the menu, at point B the stack will be spam
and the values "plist" and "top" will point to garbage locations.

As you might expect, I blow up pretty good right after this.. :-)

I've traced this a fair bit and am pretty sure that it's not
my code, especially since all my variables are happy *before* entry
to dialog_checklist(), but not at all upon coming out.  I've also
checked the arguments (n, nitems, etc) and they all look just fine.

Help?  This kind of screws up the package installation menu! :)

					Jordan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?25875.815662380>