Subject: t incorrectly branching
From: Ruben Maes <[email-masked]>
To: Sed Bugs <[email-masked]>
Date: Tue, 21 Aug 2018 12:36:25 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

printf 'Hello\n' | sed '
	s/foobar//
	t end
	s/Hello/Goodbye/
	:end'

This works as expected, it prints Goodbye.

printf 'Hello\n' | sed '
	s/Hello/Hello to you/
	s/foobar//
	t end
	s/Hello/Goodbye/
	:end'

Since t should only look at whether the *last* substitution changed the pattern space, it is my understanding that this should print:
	Goodbye to you
But sed prints instead:
	Hello to you

If I got this right, that means there's a bug in sed – maybe resetting the "last substitution was successful" flag isn't done properly? Or am I misunderstanding something here after all?

Tried on these versions, both did exactly the same:

$ sed --version | head -n1
sed (GNU sed) 4.2.2
sed (GNU sed) 4.5