tech-userlevel archive

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

Re: varargs bug in libedit



On Nov 3,  6:21pm, brooks%freebsd.org@localhost (Brooks Davis) wrote:
-- Subject: Re: varargs bug in libedit

| The documentation for EL_SIGNAL is:
| 
|   EL_SIGNAL, int flag
| 	 If flag is non-zero, editline will install its own signal
| 	 handler for the following signals when reading command input:
| 	 SIGCONT, SIGHUP, SIGINT, SIGQUIT, SIGSTOP, SIGTERM, SIGTSTP,
| 	 and SIGWINCH.  Otherwise, the current signal handlers will be
| 	 used.
| 
| It provides no way to retrieve the previous value.  el_wget does read
| the value as an int so if you passed &x it wouldn't work in any
| sensible way.
| 
| As you say, this isn't a good API, but it's what's documented and
| implemented.

In editline(3) there are two sections for EL_SIGNAL:


     el_set()
           Set editline parameters.  op determines which parameter to set, and
           each operation has its own parameter list.  Returns 0 on success,
           -1 on failure.

           The following values for op are supported, along with the required
           argument list:

     [....]

           EL_SIGNAL, int flag
                 If flag is non-zero, editline will install its own signal
                 handler for the following signals when reading command input:
                 SIGCONT, SIGHUP, SIGINT, SIGQUIT, SIGSTOP, SIGTERM, SIGTSTP,
                 and SIGWINCH.  Otherwise, the current signal handlers will be
                 used.

     [....]

     el_get()
           Get editline parameters.  op determines which parameter to retrieve
           into result.  Returns 0 if successful, -1 otherwise.

           The following values for op are supported, along with actual type
           of result:

     [....]

           EL_SIGNAL, int *
                 Return non-zero if editline has installed private signal
                 handlers (see el_get() above).


The text for that is wrong since the code does:

el.c:
        case EL_SIGNAL:
                *va_arg(ap, int *) = (el->el_flags & HANDLE_SIGNALS);
                rv = 0;
                break;


And the general description of el_get() contradicts it.

christos


Home | Main Index | Thread Index | Old Index