Source-Changes-D archive

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

Re: CVS commit: src/lib/libedit



hi, all.

i found one more big problem.
we had lost source/binary level backward compatibility, sigh.

el_set(3) defines EL_GETCFN flag, and some application(such as Asterisk) use it:

     el_set()
           Set editline parameters.  op determines which parameter to set, and
           each operation has its own parameter list.

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

           EL_GETCFN, int (*f)(EditLine *, char *c)
                 Define the character reading function as f, which is to
                 return the number of characters read and store them in c.
                 This function is called internally by el_gets() and
                 el_getc().  The builtin function can be set or restored with
                 the special function name ``EL_BUILTIN_GETCFN''.


but, this commit silently added following change(and it doesn't
expected by anyone)

    int(*f)(EditLine *, char *) -> int (*f)(EditLine *, wchar_t *)

so if old application binary link new libedit, it doesn't work anymore ;-<.


[src/lib/libedit/el.c]

281     case EL_GETCFN:
282     {
283             el_rfunc_t rc = va_arg(ap, el_rfunc_t);
284             rv = el_read_setfn(el, rc);
285             el->el_flags &= ~NARROW_READ;
286             break;
287     }

[src/lib/libedit/read.h]
@@ -35,7 +35,7 @@
 #ifndef        _h_el_read
 #define        _h_el_read

-typedef int (*el_rfunc_t)(EditLine *, char *);
+typedef int (*el_rfunc_t)(EditLine *, Char *);

 typedef struct el_read_t {
        el_rfunc_t      read_char;      /* Function to read a character */


what shoulld we do to solve this problem?
 i believe tempolary backout this patch is the way we have to go.

# i'm now started completely rewriting wide-character support for libedit.
# but it still need lots of time.

very truly yours.
-- 
Takehiko NOZAKI<takehiko.nozaki%gmail.com@localhost>


2010/1/14 Takehiko NOZAKI <takehiko.nozaki%gmail.com@localhost>:
> hi, all.
>
> i found following problems this patch:
>
> 1. don't write UTF-8 locale dependent ``cheat'' code in locale
> independent libedit,
> such as enc_width(), utf8_islead() and so on, completely meaningless.
>
> our locale implementation is "CodeSet Independ" policy, wchar_t != UCS4.
> please read itojun@'s paper.
> http://www.usenix.org/events/usenix01/freenix01/hagino.html
>
>
> 2. cast wchar_t -> wint_t in the argument of isw* function.
> consider sizeof(wchar_t) < sizeof(wint_t) case (for integer promotion).
>
>
> 3. kill evil __STDC_ISO_10646__ usage.
> if you want kick some encodings not compatible with ASCII(like EBCDIC),
> use __STDC_MB_MIGHT_NEQ_WC__ instead.
> see http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_321.htm
>
>
> 4. library function must not use thread unsafe version of mb/wc conversion,
> like mbtowc, wctomb and so on. use mbrtowc/wcrtomb instead.
> this may broke compatibility some old apllication that uses mbtowc/wctomb.
>
>
>
> i'm willing to fix them, but i'm busy now, not enough time to do it til 
> April...
>
> very truly yours.
> --
> Takehiko NOZAKI<takehiko.nozaki%gmail.com@localhost>
>


Home | Main Index | Thread Index | Old Index