GNOME Bugzilla – Bug 101221
Perl errors with gtkdoc-fixxref
Last modified: 2004-12-22 21:47:04 UTC
When building glib and gtk+ I get: Malformed UTF-8 character (unexpected continuation byte 0xa0, with no preceding start byte) in substitution iterator at /home/andersca/gnome/bin/gtkdoc-fixxref According to Owen this is because James switched the output docs back from UTF-8 to iso-8859-1, but Perl assumes UTF-8 in the most recent vesions.
I have seen this sort of problem with other programs when using Perl 5.8 and utf-8 locales. SpamAssassin is one such program that runs into this. It is possible to work around the problem by setting LANG=C, but I am not sure what the real solution is (we really just want the data passed to the regex to be treated as byte strings, rather than multibyte utf-8).
The perl documentation seems to suggest that adding the following pragma should get rid of the problem: use bytes; This seems to be the same fix the spamassassin people are doing (well, they are actually using 'eval "use bytes";', so that it works with old versions). We would run into the same problems if we were using UTF-8 docs and a user had a locale with a charset such that UTF-8 data was invalid.
I'm pretty sure (and testing confirms) that eval "use bytes"; doesn't work ... 'use bytes' is lexically scoped and eval sets up a new scope. What seems to work is: BEGIN { eval { require "bytes.pm" }; &bytes::import() unless $@; } Which is basically 'use bytes' unfolded and with an error trap around the part that might fail. The alternative seems to be to just require perl 5.6.0 for gtk-doc. Which wouldn't be ridiculous for a developer tool; For timescale ... perl 5.6.0 shipped with Red Hat 7 over 2 years ago now. perl -e 'require v5.6.0;' > /dev/null 2>&1 && echo yes
Requiring Perl 5.6 might be the best idea. IIRC, the last systems I have with Perl < 5.6.0 are a few RH6.2 systems, and I don't use them for development. As this dep only affects the developer (possibly also people compiling from source if a package doesn't disable docs rebuild by default), we may as well make it a hard dependency. They used similar logic for requiring a 2.5x version of autoconf for the latest libtool release (ie. if they aren't going to upgrade to a perl released in the last few years, are they really going to upgrade gtk-doc?) I wouldn't mind hearing Damon's or Matthias's opinion though.
I'm all for it.
Created attachment 13033 [details] [review] "use bytes" in fixxref, and require perl-5.6
Thinking about it a bit more, requiring 5.6 makes a lot of sense; the chance that we can keep gtk-doc working with older versions of Perl when none of people who hack on it use the older versions is slight, so we'd only be pretending to allow them. Only suggestion for the patch is in: +if "$PERL" -e "require v5.6.0"; then to redirect stderr to /dev/null to prevent unsightly spew. if "$PERL" -e "require v5.6.0" > /dev/null 2>&1 ; then Yeah... it's about to die with an error anyways, but it's good autoconf hygiene.
checked in