On 10.06.2016 17:14, Pedro Giffuni wrote: >> Because now strcoll_l() is used as before and it is broken in wide char >> converting process. It is broken for _all_, not just for vfscanf() >> ranges. It should never fail with any args. >> Real fix should be in strcoll_l(). >> > > Yes, it is broken as before however the objective of r301461 was only > to address the ABI breakage. If I revert r301777 then I have to backout > r301461 too, and then we have again the ABI breakage. > > I understand you want to fix all but we are under code freeze and > I have to go back to a known working (although still broken) state.
I can't make strcoll or vfscanf to drop core in my simple tests. Too little info in the bug report. In any case here is vfscanf.c fix attached (by removing collation range). >> It is dependent. vfscanf() and regcomp() use the same code for range >> collation. If we remove range collation from everywhere, we save >> vfscanf(), but strcoll_l() remains broken. >> >> > > We have had a broken regex for a very long time, and we new that > before collation was introduced. I didn't take that decision but > moving to libtre was a lot more work and we really had to have > collation now. No, we have perfectly working single byte regex with collation ranges for many years until those wchars was invaded the code very recently.
Index: vfscanf.c =================================================================== --- vfscanf.c (revision 301779) +++ vfscanf.c (working copy) @@ -816,9 +816,7 @@ static const u_char * __sccl(char *tab, const u_char *fmt) { - int c, n, v, i; - struct xlocale_collate *table = - (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; + int c, n, v; /* first `clear' the whole table */ c = *fmt++; /* first char hat => negated scanset */ @@ -871,29 +869,15 @@ * we just stored in the table (c). */ n = *fmt; - if (n == ']' - || (table->__collate_load_error ? n < c : - __wcollate_range_cmp(table, n, c) < 0 - ) - ) { + if (n == ']' || n < c) { c = '-'; break; /* resume the for(;;) */ } fmt++; - /* fill in the range */ - if (table->__collate_load_error) { - do { - tab[++c] = v; - } while (c < n); - } else { - for (i = 0; i < 256; i ++) - if (__wcollate_range_cmp(table, c, i) < 0 && - __wcollate_range_cmp(table, i, n) <= 0 - ) - tab[i] = v; - } + do { /* fill in the range */ + tab[++c] = v; + } while (c < n); #if 1 /* XXX another disgusting compatibility hack */ - c = n; /* * Alas, the V7 Unix scanf also treats formats * such as [a-c-e] as `the letters a through e'.
_______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"