Subject: bug#32592: s with i modifier seems to work incorrectly

From: Saito Takaaki <[email-masked]>
Date: Wed, 5 Sep 2018 10:02:58 +0900

Hello assaf, thank you very much for the detailed explanation.

> > [3] sed (GNU sed) 4.4.2 on CentOS 7 (64bit)
> (I assume you meant sed-4.2.2 on CentOS)

You are right.  I'm sorry for my critical mistake.

> I don't have access to 32bit cygwin, but on 64bit cygwin (windows 7)
> with sed-4.4-1 I do not experience the bug - can you confirm it still
> happens even in sed-4.4 ?

Here is the result of the command in question and the first three lines
of sed --version on 32bit cygwin on Windows 10.
--------
$ echo abcdefghijkl | sed 'h;G;s/\(a.*\).*\1/(\1)/i'
(abcdefg)hijkl
$ sed --version  | head -3
sed (GNU sed) 4.4
Packaged by Cygwin (4.4-1)
Copyright (C) 2017 Free Software Foundation, Inc.
--------

Additionally, I tried the command with sed 4.4 on ideone and found
it does not happen.
https://ideone.com/pYoF5y

However, a friend showed me a more complex case which is
problematic even with sed 4.4 on ideone.  The last two lines of the
output (for the identical input lines) are  particularly interesting.
https://ideone.com/Sq5xJX

I hope this helps even a bit.
Thank you very much.

-- 
Takaaki Saito