1 | #!/bin/sh
|
---|
2 | # sed would incorrectly copy internal buffers under certain s/// uses.
|
---|
3 | # Before sed 4.6 these would result in an extraneous NUL at end of lines.
|
---|
4 | #
|
---|
5 |
|
---|
6 | # Copyright (C) 2018-2022 Free Software Foundation, Inc.
|
---|
7 |
|
---|
8 | # This program is free software: you can redistribute it and/or modify
|
---|
9 | # it under the terms of the GNU General Public License as published by
|
---|
10 | # the Free Software Foundation, either version 3 of the License, or
|
---|
11 | # (at your option) any later version.
|
---|
12 |
|
---|
13 | # This program is distributed in the hope that it will be useful,
|
---|
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | # GNU General Public License for more details.
|
---|
17 |
|
---|
18 | # You should have received a copy of the GNU General Public License
|
---|
19 | # along with this program. If not, see <https://www.gnu.org/licenses/>.
|
---|
20 | . "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed
|
---|
21 | print_ver_ sed
|
---|
22 |
|
---|
23 | printf '0\n' > in || framework_failure_
|
---|
24 | printf '0\n' > exp || framework_failure_
|
---|
25 |
|
---|
26 | # Before sed 4.6, this would result in: 0x30 0x00 0x0a.
|
---|
27 | sed -e 's/$/a/2' in > out 2> err || fail=1
|
---|
28 |
|
---|
29 | compare exp out || fail=1
|
---|
30 | compare /dev/null err || fail=1
|
---|
31 |
|
---|
32 | # To ease debugging / error reporting (the above 'compare'
|
---|
33 | # will report "binary files differ" - not very helpful here)
|
---|
34 | if test -n "$fail" ; then
|
---|
35 | echo "---- TEST FAILED"
|
---|
36 | echo "out:"
|
---|
37 | od -tx1 out
|
---|
38 | echo "exp:"
|
---|
39 | od -tx1 exp
|
---|
40 | echo "err:"
|
---|
41 | od -tx1 err
|
---|
42 | fi
|
---|
43 |
|
---|
44 |
|
---|
45 | Exit $fail
|
---|