source: vendor/sed/current/testsuite/bug32271-1.sh

Last change on this file was 3611, checked in by bird, 11 months ago

vendor/sed/current: GNU sed 4.9 (sed-4.9.tar.xz sha256:6e226b732e1cd739464ad6862bd1a1aba42d7982922da7a53519631d24975181)

  • Property svn:executable set to *
File size: 1.4 KB
Line 
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
21print_ver_ sed
22
23printf '0\n' > in || framework_failure_
24printf '0\n' > exp || framework_failure_
25
26# Before sed 4.6, this would result in: 0x30 0x00 0x0a.
27sed -e 's/$/a/2' in > out 2> err || fail=1
28
29compare exp out || fail=1
30compare /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)
34if 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
42fi
43
44
45Exit $fail
Note: See TracBrowser for help on using the repository browser.