[Toybox] avoiding testing shell builtins

enh enh at google.com
Thu Jun 27 09:41:16 PDT 2019


On Thu, Jun 27, 2019 at 12:11 AM Rob Landley <rob at landley.net> wrote:
>
> On 6/27/19 12:33 AM, enh wrote:
> >> (Well I say it's not a regression. Why are two sed host tests failing now? Is
> >> this an ubuntu->devuan thing? Sigh...)
> >
> > the sed loop test hangs with TEST_HOST=1 for you too now? haven't we
> > had this before where i reported that when google switched from ubuntu
> > to debian?
>
> It's not a hang, two of the tests are failing because the host sed produces
> different results.
>
> FAIL: sed 'y/a\bc/de\f/'
> echo -ne 'abc' | sed 'y/a\bc/de\f/'
> --- expected    2019-06-27 01:57:26.620004181 -0500
> +++ actual      2019-06-27 01:57:26.620004181 -0500
> @@ -1 +1 @@
> -db
>
> \ No newline at end of file
> +de
>
> \ No newline at end of file
> FAIL: sed skip start of range
> echo -ne 'a\nb\n' | sed -e n -e '1,2s/b/c/'
> --- expected    2019-06-27 01:57:26.632004181 -0500
> +++ actual      2019-06-27 01:57:26.632004181 -0500
> @@ -1,2 +1,2 @@
>  a
> -b
> +c
>
> All of 'em passed under ubuntu. Weird.
>
> The first one says escapes aren't being processed inside y ranges. (\b is
> backspace, not b, \f is form feed, those are the standard printf escapes.) But...
>
> $ echo hello | sed 'y/l/\n/'
> he
>
> o
>
> Debian is parsing them in the "to" part of the range, just not "from"...
>
> $ echo hebbo | sed 'y/\b/\f/'
> he
>
>   o
>
> Except it _has_ to be parsing it a little, or \ would become \ (NOP) and b would
> become f not \f... No wait, the ranges would be different sizes and that's an
> error...
>
> $ echo hebbo | sed 'y/\b/xf/'
> sed: -e expression #1, char 8: strings for `y' command are different lengths
>
> Nope, it's parsing it, but parsing it as a single literal b. I think that's a
> bug in the debain sed? (Is this some crazy posix reading? It's not _useful_
> whatever it is...)
>
> The second test is more dubious, if you skip the start of a range the range
> doesn't trigger, but the reason that makes sense is the start could be a regex
> rather than a line: you can mix regex and line number freely and they're treated
> the same way:
>
> $ echo -ne 'a\nb\n' | sed -e n -e '1,2s/b/c/'
> a
> c
> $ echo -ne 'a\nb\n' | sed -e n -e '/a/,2s/b/c/'
> a
> b
>
> I don't know which behavior is "correct" here, but what ubuntu did was
> consistent. I made toybox do what Ubuntu did (produce ab for both). Now debian's
> doing it differently.
>
> *jazzhands*
>
> Rob
>
> (Is this gnu/dammit version skew, or do ubuntu/debian have patches to alter this
> behavior, or...?)

the internet says they don't currently have local patches:
https://sources.debian.org/patches/sed/

but Ubuntu claims the same...

i wonder what sed 4.7 does? (my machines are all sed 4.4.)



More information about the Toybox mailing list