[Toybox] strings tests and bugfixes

Rob Landley rob at landley.net
Wed May 31 23:09:40 PDT 2017


On 05/28/2017 11:25 PM, Ilya Kuzmich wrote:
> Found and fixed some strings bugs. duh.

Sorry for the delay, I started a new Japanese class at the local
community college (one of those compressed summer session things) and
between that and $DAYJOB everything else is mostly just on weekends
right now. :)

I glanced at this one to see if it was trivial to apply but:

-    if (nread < 1) break;
+    if (nread < 1) {
+      if (count == wlen) xputc('\n');
+      break;
+    }

We have \n at the end of strings already? Under what circumstances would
it _not_ output them?

  make strings
  $ diff -u <(./strings strings) <(strings strings) | wc
  	0	0	0

As for the offset+1 bit...

  $ ./strings -o strings | head -n 3
      567 /lib64/ld-linux-x86-64.so.2
      646 g"X7
     1600 libc.so.6
  $ strings -o strings | head -n 3
     1070 /lib64/ld-linux-x86-64.so.2
     1207 g"X7
     3101 libc.so.6

I don't see how +1 addresses that? (Or what exactly is going on there.)

Rob



More information about the Toybox mailing list