replace: fix build issues on GNU Hurd (#7998)