[Toybox] [PATCH] wc: fix the column width heuristics even further.

Rob Landley rob at landley.net
Sat Aug 4 09:57:16 PDT 2018


On 07/26/2018 06:38 PM, enh wrote:
> 
> This was found by
> https://kernel.googlesource.com/pub/scm/linux/kernel/git/shuah/linux-kselftest/+/master/tools/testing/selftests/splice/default_file_splice_read.sh
> which broke after the recent change.
> 
> Plus this actually fixes another of our existing test failures on the host.

Reading your description, shouldn't this be:

-  if (!(toys.optc==0 && (toys.optflags & (toys.optflags-1))==0) && toys.optc!=1)
-    space = 7;
+  if (toys.optc>1 || (toys.optflags&(toys.optflags-1))) space = 7;

optc 0 means stdin, optc 1 means a single file, so optc>1 means multiple
lines of output, and then your trick for the "one flag only"...

Which means that the same 2 tests that TEST_HOST=1 fails with also fail here,
except we're indenting with tabs and they're doing readahead. But the "indent
or not indent" decision's the same this way...

> I'm assuming we don't want to try the "exact fit" heuristics until we
> have a concrete need for them. (I haven't fully understood the
> circumstances under which they're used, though the two remaining host
> test failures appear to be because of them.)

Yeah, that one. Tabs instead of measured spaces, but it sounds like that's
what older versions used to do and we're well past what posix says anyway?

Rob



More information about the Toybox mailing list