From f5abeba48e4c93fc8df4c81e7ae2a61f469ed5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz?= Date: Sun, 23 Oct 2022 09:51:37 -0700 Subject: sed: handle the unspecified "n as delimiter alias" case more sensibly Print the less-surprising variant in a corner case of POSIX-unspecified behavior. Before, this would print "n". Now, it prints "X": printf n | sed 'sn\nnXn'; echo * sed/compile.c (match_slash): Remove special handling of 'n'. Reported in https://bugs.gnu.org/40242 --- sed/compile.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sed/compile.c b/sed/compile.c index 1942f3b..f96fbca 100644 --- a/sed/compile.c +++ b/sed/compile.c @@ -557,8 +557,6 @@ match_slash (int slash, int regex) ch = inchar (); if (ch == EOF) break; - else if (ch == 'n' && regex) - ch = '\n'; else if (ch != '\n' && (ch != slash || (!regex && ch == '&'))) add1_buffer (b, '\\'); } -- cgit v1.2.1