On Wed, Jul 25, 2018 at 06:49:02AM -0400, Thomas Dickey wrote:
> On Tue, Jul 24, 2018 at 09:12:07AM -0400, James McCoy wrote:
> > Ironically, the change in format was prompted by comments that upstream
> > saw in unibilium's source code.
> 
> That couldn't possibly be true, since I began the work for the formatting
> change (specifically the part which we're discussing) in Februrary
> 2017, in a branch, publishing the first changes early in March:
> 
> http://lists.gnu.org/archive/html/bug-ncurses/2017-03/msg00006.html
> 
> The first comments about unibilium relative to this work
> were a few months later, on the ncurses mailing list:
> 
> http://lists.gnu.org/archive/html/bug-ncurses/2017-08/msg00031.html
> 
> You may be referring to this:
> 
> http://lists.gnu.org/archive/html/bug-ncurses/2018-04/msg00002.html
> 
> which is a refinement: unibilium ignored the value, and ncurses wasn't
> making effective use of it.

I'm referring to this change:

  $ git diff upstream/6.1+20180210 upstream/6.1+20180630 -- 
doc/html/man/term.5.html
  @@ -175,69 +175,72 @@
   
               (3)  count of extended string capabilities

  -            (4)  size of the extended string table in bytes.
  +            (4)  count of the items in extended string table
   
  -            (5)  last offset of the extended string table in bytes.
  +            (5)  size of the extended string table in bytes
   
  -       Using the counts and sizes, ncurses allocates arrays and reads data 
for
  +       The count- and size-values for the extended string  table  include  
the
  +       extended capability <EM>names</EM> as well as extended capability 
<EM>values</EM>.
  +
  +       Using the counts and sizes, <STRONG>ncurses</STRONG> allocates arrays 
and reads data for
          the extended capabilities in the same order as the header information.

Header 4 used to report how many offsets followed the extended bool and
num capabilities, which unibilium used to perform a consistency check:

https://github.com/mauke/unibilium/blob/e3b16d6219ca1cb92d98b1d9cc416b49a3ac468e/unibilium.c#L337-L342

            extalllen = 0;
            extalllen += extboollen;
            extalllen += extnumlen;
            extalllen += extstrslen;


            DEL_FAIL_IF(extofflen != extalllen + extstrslen, EINVAL, t);

Now header 4 is reporting how many elements are in the string table.
Since the number of valid extended string capabilities (those with a
name and value) may be less than the number of extended string
capabilities reported by header 3, this self-check no longer works.

This is pretty clear in the diff of the screen entry before and after
the format change:

  $ diff -u <(xxd -g 1 6.1+20180210-4/lib/terminfo/s/screen) <(xxd -g 1 
6.1+20180714-1/lib/terminfo/s/screen)
  --- /proc/self/fd/16    2018-07-25 07:49:24.471395993 -0400
  +++ /proc/self/fd/20    2018-07-25 07:49:24.471395993 -0400
  @@ -93,12 +93,12 @@
   000005c0: 00 1b 5b 32 34 7e 00 1b 5b 31 4b 00 1b 5b 33 39  ..[24~..[1K..[39
   000005d0: 3b 34 39 6d 00 1b 5b 4d 00 1b 5b 33 25 70 31 25  ;49m..[M..[3%p1%
   000005e0: 64 6d 00 1b 5b 34 25 70 31 25 64 6d 00 00 03 00  dm..[4%p1%dm....
  -000005f0: 01 00 0b 00 1a 00 43 00 01 01 00 00 01 00 00 00  ......C.........
  +000005f0: 01 00 0c 00 12 00 46 00 01 01 00 00 01 00 00 00  ......F.........
   00000600: ff ff 04 00 ff ff ff ff ff ff ff ff ff ff ff ff  ................
  -00000610: ff ff ff ff 00 00 03 00 06 00 09 00 0c 00 0f 00  ................
  -00000620: 12 00 15 00 18 00 1e 00 24 00 28 00 2c 00 30 00  ........$.(.,.0.
  -00000630: 34 00 1b 28 42 00 1b 28 25 70 31 25 63 00 41 58  4..(B..(%p1%c.AX
  -00000640: 00 47 30 00 58 54 00 55 38 00 45 30 00 45 33 00  .G0.XT.U8.E0.E3.
  -00000650: 53 30 00 58 4d 00 6b 45 4e 44 35 00 6b 48 4f 4d  S0.XM.kEND5.kHOM
  -00000660: 35 00 6b 61 32 00 6b 62 31 00 6b 62 33 00 6b 63  5.ka2.kb1.kb3.kc
  -00000670: 32 00 78 6d 00                                   2.xm.
  +00000610: ff ff ff ff ff ff 00 00 03 00 06 00 09 00 0c 00  ................
  +00000620: 0f 00 12 00 15 00 18 00 1b 00 21 00 27 00 2b 00  ..........!.'.+.
  +00000630: 2f 00 33 00 37 00 1b 28 42 00 1b 28 25 70 31 25  /.3.7..(B..(%p1%
  +00000640: 63 00 41 58 00 47 30 00 58 54 00 55 38 00 45 30  c.AX.G0.XT.U8.E0
  +00000650: 00 45 33 00 53 30 00 54 53 00 58 4d 00 6b 45 4e  .E3.S0.TS.XM.kEN
  +00000660: 44 35 00 6b 48 4f 4d 35 00 6b 61 32 00 6b 62 31  D5.kHOM5.ka2.kb1
  +00000670: 00 6b 62 33 00 6b 63 32 00 78 6d 00              .kb3.kc2.xm.

Unibilium would have to parse the string offsets first to know which are
valid and then perform a similar consistency check.

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB

Reply via email to