Last Comment Bug 390442 - Bugzilla/Template.pm fails on perl 5.9.5
: Bugzilla/Template.pm fails on perl 5.9.5
Status: RESOLVED FIXED
[relnote for 2.22.6]
:
Product: Bugzilla
Classification: Server Software
Component: Bugzilla-General (show other bugs)
: 3.0
: All All
: -- major (vote)
: Bugzilla 2.22
Assigned To: Max Kanat-Alexander
: default-qa
Mentors:
: 434199 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-01 04:15 PDT by Max Kanat-Alexander
Modified: 2010-08-12 11:30 PDT (History)
4 users (show)
LpSolit: approval+
mkanat: approval3.0+
LpSolit: approval2.22+
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
v1 (3.0) (797 bytes, patch)
2007-08-01 04:15 PDT, Max Kanat-Alexander
LpSolit: review+
Details | Diff | Review
patch, v2 (tip) (2.15 KB, patch)
2007-08-18 06:40 PDT, Frédéric Buclin
mkanat: review+
Details | Diff | Review

Description Max Kanat-Alexander 2007-08-01 04:15:46 PDT
Created attachment 274754 [details] [diff] [review]
v1 (3.0)

Perl 5.9.5 is supposed to be the last development version of Perl before 5.10.0 is released, so we should get ready to support it. I have a testing installation of it, and I've discovered that the only thing that prevents checksetup.pl from completing is this error:

Not a subroutine reference at Bugzilla/Template.pm line 66.

And that line is:

if (defined &{$Bugzilla::Constants::{$constant}}) {

Apparently, the way we do that, perl 5.9.5 doesn't like. There's a better way to write that anyhow, so I've attached a patch that fixes it.

This code exists all the way back to 2.20, but I don't think we have to support any version of Bugzilla older than 3.0 on perl 5.10.
Comment 1 Frédéric Buclin 2007-08-01 04:39:14 PDT
Comment on attachment 274754 [details] [diff] [review]
v1 (3.0)

>Index: Bugzilla/Template.pm
>===================================================================
>RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Template.pm,v
>retrieving revision 1.73
>diff -u -r1.73 Template.pm
>--- Bugzilla/Template.pm	4 Jul 2007 22:56:09 -0000	1.73
>+++ Bugzilla/Template.pm	1 Aug 2007 11:12:04 -0000
>@@ -63,7 +63,7 @@
>     foreach my $constant (@Bugzilla::Constants::EXPORT,
>                           @Bugzilla::Constants::EXPORT_OK)
>     {
>-        if (defined &{$Bugzilla::Constants::{$constant}}) {
>+        if (defined Bugzilla::Constants->$constant) {
>             # Constants can be lists, and we can't know whether we're
>             # getting a scalar or a list in advance, since they come to us
>             # as the return value of a function call, so we have to


If Perl 5.9.5 doesn't understand this syntax, why don't you change the $constants{$constant} = [&{$Bugzilla::Constants::{$constant}}]; line too?
Comment 2 Max Kanat-Alexander 2007-08-01 15:50:30 PDT
(In reply to comment #1)
> If Perl 5.9.5 doesn't understand this syntax, why don't you change the
> $constants{$constant} = [&{$Bugzilla::Constants::{$constant}}]; line too?

  It doesn't complain about that line. I think it has to do with a change to what's allowed after "defined". But we could change that line also, to be consistent.
Comment 3 Frédéric Buclin 2007-08-01 22:54:13 PDT
This would probably be fine. But I would prefer to see this patch landing *after* the release of 3.0.1, and have it for 3.0.2 which will very likely be released on time for Perl 5.10. I would hate to break something a couple of days before the release.
Comment 4 Max Kanat-Alexander 2007-08-01 23:04:40 PDT
(In reply to comment #3)
> This would probably be fine. But I would prefer to see this patch landing
> *after* the release of 3.0.1, and have it for 3.0.2 which will very likely be
> released on time for Perl 5.10. I would hate to break something a couple of
> days before the release.

  Okay. That sounds good to me. That'll also give me more time to check if anything else is broken with perl 5.9.5, and if this is the only thing, then it wouldn't hurt to check it in as far back as 2.20 and 2.22, also.
Comment 5 Frédéric Buclin 2007-08-18 06:40:01 PDT
Created attachment 277218 [details] [diff] [review]
patch, v2 (tip)

Isn't it cleaner this way?
Comment 6 Frédéric Buclin 2007-08-18 06:40:51 PDT
CC'ing myk who wrote the original patch in bug 280770.
Comment 7 Max Kanat-Alexander 2007-08-18 14:04:56 PDT
Comment on attachment 277218 [details] [diff] [review]
patch, v2 (tip)

Yes. Let's use yours on the trunk and mine on the branch.
Comment 8 Frédéric Buclin 2007-08-20 13:09:21 PDT
Comment on attachment 274754 [details] [diff] [review]
v1 (3.0)

Looks good. r=LpSolit
Comment 9 Frédéric Buclin 2007-08-20 13:16:47 PDT
I will let you decide if you want it for 3.0.1 or 3.0.2.
Comment 10 Max Kanat-Alexander 2007-08-20 20:18:48 PDT
Sure, couldn't hurt for 3.0. We'll wait until after release, though.
Comment 11 Max Kanat-Alexander 2007-08-23 14:36:43 PDT
tip:

Checking in Bugzilla/Template.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Template.pm,v  <--  Template.pm
new revision: 1.78; previous revision: 1.77
done

3.0 branch:

Checking in Bugzilla/Template.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Template.pm,v  <--  Template.pm
new revision: 1.68.2.3; previous revision: 1.68.2.2
done
Comment 12 Frédéric Buclin 2008-01-04 06:22:35 PST
Has been relnoted in 3.0.2.
Comment 13 Frédéric Buclin 2008-05-17 14:13:53 PDT
*** Bug 434199 has been marked as a duplicate of this bug. ***
Comment 14 Frédéric Buclin 2008-10-17 07:38:18 PDT
(In reply to comment #4)
> wouldn't hurt to check it in as far back as 2.20 and 2.22, also.

I'm approving and committing attachment 274754 [details] [diff] [review] on the 2.22 branch too. Since I upgraded my OS, I have Perl 5.10.0 installed and I'm unable to test 2.22.x without this fix. I applied it locally and Bugzilla is now working fine again.

About 2.20, I don't think we need to land it there as it's almost EOL and I doubt we will release 2.20.7 as it has currently no code change compared to 2.20.6.
Comment 15 Frédéric Buclin 2008-10-17 07:44:19 PDT
2.22.5+:

Checking in Bugzilla/Template.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Template.pm,v  <--  Template.pm
new revision: 1.41.2.5; previous revision: 1.41.2.4
done
Comment 16 Denis Roy 2010-08-12 11:30:04 PDT
Thanks for this patch.  I still need to maintain a 'tweaked' 3.0.1 instance, and it wasn't working on a newer OS with Perl 5.10.  Patch worked.

I love open source software.

Note You need to log in before you can comment on or make changes to this bug.