1#!/bin/sh 2# Test slash following an incomplete multibyte character 3 4# Copyright (C) 2016-2020 Free Software Foundation, Inc. 5 6# This program is free software: you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation, either version 3 of the License, or 9# (at your option) any later version. 10 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15 16# You should have received a copy of the GNU General Public License 17# along with this program. If not, see <https://www.gnu.org/licenses/>. 18. "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed 19print_ver_ sed 20 21require_en_utf8_locale_ 22 23# before sed-4.3, a slash following an incomplete multibyte character 24# would be ignored during program compilation, leading to an error. 25 26 27# Test 1: match_slash in 's' command. 28# Before sed-4.3, this would fail with "unterminated `s' command". 29printf 's/\316/X/' > p1 || framework_failure_ 30LC_ALL=en_US.UTF-8 sed -f p1 </dev/null >out1 || fail=1 31compare_ /dev/null out1 || fail=1 32 33# Test 2: match_slash in address regex. 34# Before sed-4.3, this would fail with "unterminated address regex". 35printf '/\316/p' >p2 || framework_failure_ 36LC_ALL=en_US.UTF-8 sed -f p2 </dev/null >out2 || fail=1 37compare_ /dev/null out2 || fail=1 38 39# Test 3: match_slash in 'y' command.. 40# Before sed-4.3, this would fail with "unterminated `y' command". 41printf 'y/\316/X/' >p3 || framework_failure_ 42LC_ALL=en_US.UTF-8 sed -f p3 </dev/null >out3 || fail=1 43compare_ /dev/null out3 || fail=1 44 45 46Exit $fail 47