I suspect this was related to the gnulib bug https://lists.gnu.org/archive/html/bug-gnulib/2020-01/msg00040.html and fixed in https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=b7d7afe10ddf599452bd80b8a840c830cd474b09 This should be present in the latest sed releases. I can't reproduce it, so it was either that, or a subsequent commit (of which there's been quite a few: https://git.savannah.gnu.org/cgit/gnulib.git/log/?qt=grep&q=canonic).