diff options
author | Dengke Du <dengke.du@windriver.com> | 2016-09-01 05:42:10 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-23 15:27:05 +0100 |
commit | cce2867828f34d2364b6bb0598f422aea0a86f6a (patch) | |
tree | 139352df3a38569f7fdda76ffd834283d04f3750 /meta-selftest/lib | |
parent | 0458275013964626b6d3680afbec334c253e788b (diff) | |
download | poky-cce2867828f34d2364b6bb0598f422aea0a86f6a.tar.gz |
busybox: fix "sed n (flushes pattern space, terminates early)" testcase failure
It is a busybox upstream known bug. When the busybox sed sub-command 'n'
hit the files EOF, it print an extra character that have been printed, but
the GNU sed would not print it.
In busybox source code ../editors/sed.c
------------------------------------------------------------------------
case 'n':
if (!G.be_quiet)
sed_puts(pattern_space, last_gets_char);
if (next_line) {
free(pattern_space);
pattern_space = next_line;
last_gets_char = next_gets_char;
next_line = get_next_line(&next_gets_char, &last_puts_char, last_gets_char);
substituted = 0;
linenum++;
break;
}
/* fall through */
/* Quit. End of script, end of input. */
case 'q':
/* Exit the outer while loop */
free(next_line);
next_line = NULL;
goto discard_commands;
------------------------------------------------------------------------
when read at the end of the file, the 'next_line' is null, it would go
"case 'q'" and goto discard_commands, the discard_commands would print
the old pattern space which have been printed.
So in order to comply with GNU sed, in case 'n', when the next_line is null
I add "else" at the end of the second "if": "goto again;" and send it to
the busybox upstream, the busybox maintainer adopt it and make a little
changes to the patch, we can see it at:
His reply:
http://lists.busybox.net/pipermail/busybox/2016-September/084613.html
The new patch on busybox master branch:
https://git.busybox.net/busybox/commit/?id=76d72376e0244a5cafd4880cdc623e37d86a75e4
(From OE-Core rev: 5a680c267454d7c135c4bfe4e551a780f38a5087)
(From OE-Core rev: efcd439977d111b10bd2c74ff3bc4fa30d8b394d)
Signed-off-by: Dengke Du <dengke.du@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-selftest/lib')
0 files changed, 0 insertions, 0 deletions