bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32494: t incorrectly branching


From: Ruben Maes
Subject: bug#32494: t incorrectly branching
Date: Tue, 21 Aug 2018 12:36:25 +0200

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

Attachment: pgpAXSKGHlOUg.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]