Hi!
On Fri, 2023-01-06 at 16:58:44 +0800, Shengjing Zhu wrote:
> Package: libdpkg-perl
> Version: 1.21.13
> Severity: normal
> X-Debbugs-Cc: z...@debian.org
> Given input `-flto=auto -flto=auto`, $bf->strip($flag, "-flto=auto") returns
> `-flto=auto`.
> However if given `-flto=auto -ffat-lto-objects -flto=auto`, it will return
> `-ffat-lto-objects`. (two -flto=auto are tripped)
>
> I read the code has `g` in regexp, so I think you want to strip duplicated
> flag. But the regexp pattern is bit buggy when two duplicated flags are
> together.
Ah, indeed nice catch, this is caused due to the space left at the
beginning which then does not match on the subsequent iteration.
Fixing it for 1.21.18.
> Background:
>
> In dh-golang, I use $bf->strip to strip lto flags
> https://salsa.debian.org/go-team/packages/dh-golang/-/merge_requests/18
>
> It works for a while in Debian. But I found Ubuntu still carries an LTO
> patch in the Go compiler. Then I wonder whether my dh-golang hack doesn't
> work for them.
>
> In Ubuntu, for unknown reason, their dpkg-buildflags gives a duplicated lto
> flags. `-flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects`.
> After $bf->strip($flag, "-ffat-lto-objects -flto=auto"), it becomes
> `-flto=auto`.
> Still one lto flag left...
This is a problem in the Ubuntu dpkg delta, which they have
kept incorrectly rebasing, and have been applying the off-tree lto patch
even after it got merged upstream, so now they are injecting these twice.
I mentioned this at the time, and reminded the recent person doing the
merge to fix, but that's entirely on their hands.
Thanks,
Guillem