This issue was reported upstream, see bugs
367 and
368. It seems to have been fixed with commit
1732.
1731 is needed to patch cleanly (1732 reverts the change made in this commit),
1741 silences a build warning introduced by 1732 but isn't essential.