FS#40718 - [gprename] does not work with new perl 5.20
Attached to Project:
Community Packages
Opened by Stefan Husmann (stefanhusmann) - Thursday, 05 June 2014, 19:23 GMT
Last edited by Florian Pritz (bluewind) - Monday, 22 September 2014, 10:39 GMT
Opened by Stefan Husmann (stefanhusmann) - Thursday, 05 June 2014, 19:23 GMT
Last edited by Florian Pritz (bluewind) - Monday, 22 September 2014, 10:39 GMT
|
Details
Description: Running gprename gives
Invalid version format (non-numeric data) at /usr/lib/perl5/core_perl/Encode.pm line 12. BEGIN failed--compilation aborted at /usr/lib/perl5/core_perl/Encode.pm line 12. Compilation failed in require at /usr/bin/gprename line 52. BEGIN failed--compilation aborted at /usr/bin/gprename line 52. Additional info: * package version(s) perl 5.20.0-2, gprename 2.7-3 * config and/or log files etc. A simple rebuild of gprename did not change anything here. Steps to reproduce: Run gprename. |
This task depends upon
Closed by Florian Pritz (bluewind)
Monday, 22 September 2014, 10:39 GMT
Reason for closing: Fixed
Additional comments about closing: perl 5.20.1-1
Monday, 22 September 2014, 10:39 GMT
Reason for closing: Fixed
Additional comments about closing: perl 5.20.1-1
Edit: Actually it's an issue in Encode which is part of perl core. Funny. Adding use locale; there fixes it.
Edit: Strangely enough `LC_ALL=de_DE.utf8 perl -e 'use Encode qw(decode encode);'` can't reproduce the issue. Not sure what's going on.
edit: Bug reports:
https://rt.cpan.org/Public/Bug/Display.html?id=96467 for Encode.pm
https://rt.perl.org/Public/Bug/Display.html?id=122105 for Copy.pm
Related forum thread: https://bbs.archlinux.org/viewtopic.php?pid=1422917#p1422917
../ext/Pod-Html/t/cache.t (Wstat: 256 Tests: 10 Failed: 1)
Failed test: 8
Non-zero exit status: 1
Files=2405, Tests=721294, 1000 wallclock secs (79.16 usr 7.69 sys + 586.07 cusr 47.23 csys = 720.15 CPU)
Result: FAIL
makefile:839: recipe for target 'test_harness' failed
make: *** [test_harness] Error 90
makepkg --nocheck
because the check function fails.
The bug we are seeing was supposedly fixed by an earlier version of the "version" CPAN distribution. The error was introduced around version 0.9904 of "version" on 09/02/13 and was supposedly fixed in version 0.00907 on 01/15/14. The version module also exists in the perl core, where the C code is copied into vutil.c so it is even more closely integrated than most core modules. A similar bug was reported and supposedly fixed. I am trying to understand exactly why it isn't working.
https://rt.cpan.org/Public/Bug/Display.html?id=91987
If you use the previous patch, please be aware that it reintroduces a bug similar to one that was fixed in 2011.
https://rt.perl.org/Ticket/Display.html?id=105784
Also the bug can be reproduced by running `LC_ALL=de_DE.utf8 perl -e'use Gtk2 -init; use 5.8.0'`
If you use en_US locale or don't load gtk it will not crash. Best solution would probably be to take a look at gtk and have it set the locale in a way perl knows about. That's assuming it doesn't, but after having read that explanation (and the remaining thread which talks about gtk3 doing just that) I think that's probably the case.
The first claim is simply untrue as far as I can tell. Previous versions of vutil.c used setlocale prior to 1/15/14. See version of the "version" module prior to 0.9907. Here is a diff between 0.9906 and 0.9907. To see for yourself search for STORE_NUMERIC_LOCAL_SET_STANDARD in vutil.c:
https://metacpan.org/diff/file?target=JPEACOCK/version-0.9907/&source=JPEACOCK/version-0.9906/#vutil/vutil.c
The second claim seems to be based on the idea that perl checks the active locale. The locale exists in two senses, the one set internally by perl, by perl code for example which uses "use locale" and the locale currently set for the process by glibc's setlocale. Perl only checks to see if it changed the locale earlier, and doesn't actually call setlocale to retrieve the current active glibc locale. This is theoretically faster but seems more error prone.
Blaming Gtk2 seems counterproductive when reverting the "version" distribution will solve our immediate problem. The version parsing code that parses the "use 5.8.0" needs to revert to properly setting the numeric locale to C before parsing. Just to reiterate, this is exactly what it used to do. This is what it tries to do.
edit: I toned down the tone of the comment. I think because I just woke up I was a little grumpy.
https://gist.github.com/juster/bfb1f50ab0c624c4e4fd
In order to call setlocale directly, to duplicate the bug, I created a rough XS module and simple test script. I didn't want to install Gtk2 solely for this. If anyone is in a similar situation they can use the following XS module. Be sure to read the README if you do.
https://github.com/juster/perl-setlocale
edit: By the way, the patch will cause the porting/customized test to fail in perl's test suite. According to the error message, this is because the SHA1 for vutil.c was changed by changing the file contents.