[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#119081: nano: On Oldworld PowerPC, nano freezes machine when help is being displayed



On Tue, Nov 13, 2001 at 02:02:47AM -0700, Chris Tillman wrote:
> On Mon, Nov 12, 2001 at 01:41:30PM +0100, Jordi Mallach wrote:
> > Ok, tell me if you can still reproduce. The ftp server thing tells me
> > there's something wrong with that box :\
 
I've got a suspicion of a possible problem. I was experimenting with
the code, turning things on and off to try to narrow down the problem
more. I noticed a va_list in the following functions, and that
triggered something I had read on the list. On searching, I found
dan's explanation of how va_list and va_args can work on i386 and not
on powerpc (I think you were involved with that item too, Michael):

lists.debian.org/debian-powerpc/2001/debian-powerpc-200103/msg00532.html

In that message, dan says there can be problems when the va_list
points to a char, since only promoted types are legal. I'm certainly
wet behind the ears when it comes to this stuff, but could someone
look at these to see if that's what's going on here?

int statusq(int tabs, shortcut s[], int slen, char *def, char *msg, ...)
{
    va_list ap;
    char foo[133];
    int ret;

    bottombars(s, slen);

    va_start(ap, msg);
    vsnprintf(foo, 132, msg, ap);
    va_end(ap);
    ...

and

void statusbar(char *msg, ...)
{
    va_list ap;
    char foo[133];
    int start_x = 0;

    va_start(ap, msg);
    vsnprintf(foo, 132, msg, ap);
    va_end(ap);
    ...

and 

int do_yesno(int all, int leavecursor, char *msg, ...)
{
    va_list ap;
    char foo[133];
    int kbinput, ok = -1, i;
    char *yesstr;		/* String of yes characters accepted */
    char *nostr;		/* Same for no */
    char *allstr;		/* And all, surprise! */
    char shortstr[5];		/* Temp string for above */

    /* Yes, no and all are strings of any length.  Each string consists of
	all characters accepted as a valid character for that value.
	The first value will be the one displayed in the shortcuts. */
    yesstr = _("Yy");
    nostr = _("Nn");
    allstr = _("Aa");

    /* Write the bottom of the screen */
    clear_bottomwin();
    wattron(bottomwin, A_REVERSE);
    blank_statusbar_refresh();
    wattroff(bottomwin, A_REVERSE);

    /* Remove gettext call for keybindings until we clear the thing up */
    if (!ISSET(NO_HELP)) {
	wmove(bottomwin, 1, 0);

	snprintf(shortstr, 3, " %c", yesstr[0]);
	onekey(shortstr, _("Yes"));

	if (all) {
	    snprintf(shortstr, 3, " %c", allstr[0]);
	    onekey(shortstr, _("All"));
	}
	wmove(bottomwin, 2, 0);

	snprintf(shortstr, 3, " %c", nostr[0]);
	onekey(shortstr, _("No"));

	onekey("^C", _("Cancel"));
    }
    va_start(ap, msg);
    vsnprintf(foo, 132, msg, ap);
    va_end(ap);

   ...

and, finally ;-)

/* Die (gracefully?) */
void die(char *msg, ...)
{
    va_list ap;
    char *name;
    int i;

    va_start(ap, msg);
    vfprintf(stderr, msg, ap);
    va_end(ap);

-- 
*----------------------------------------------------------------*
|  .''`.  |   Debian GNU/Linux: <http://www.debian.org>          |
| : :'  : |   debian-imac: <http://debian-imac.sourceforge.net>  |
| `. `'`  |      Chris Tillman        tillman@azstarnet.com      |
|   `-    |            May the Source be with you                |
*----------------------------------------------------------------*



Reply to: