Closed Bug 390442 Opened 17 years ago Closed 17 years ago

Bugzilla/Template.pm fails on perl 5.9.5

Categories

(Bugzilla :: Bugzilla-General, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 2.22

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

(Whiteboard: [relnote for 2.22.6])

Attachments

(2 files)

Attached patch v1 (3.0)Splinter Review
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.
Attachment #274754 - Flags: review?(LpSolit)
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?
(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.
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.
(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.
Attached patch patch, v2 (tip)Splinter Review
Isn't it cleaner this way?
Attachment #277218 - Flags: review?(mkanat)
CC'ing myk who wrote the original patch in bug 280770.
Comment on attachment 277218 [details] [diff] [review]
patch, v2 (tip)

Yes. Let's use yours on the trunk and mine on the branch.
Attachment #277218 - Flags: review?(mkanat) → review+
Comment on attachment 274754 [details] [diff] [review]
v1 (3.0)

Looks good. r=LpSolit
Attachment #274754 - Flags: review?(LpSolit) → review+
I will let you decide if you want it for 3.0.1 or 3.0.2.
Flags: approval3.0?
Flags: approval+
Sure, couldn't hurt for 3.0. We'll wait until after release, though.
Flags: approval3.0? → approval3.0+
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
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Keywords: relnote
Resolution: --- → FIXED
Attachment #274754 - Attachment description: v1 → v1 (3.0)
Attachment #277218 - Attachment description: patch, v2 → patch, v2 (tip)
Has been relnoted in 3.0.2.
Keywords: relnote
(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.
Flags: approval2.22+
Whiteboard: [relnote for 2.22.6]
Target Milestone: Bugzilla 3.0 → Bugzilla 2.22
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
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.
You need to log in before you can comment on or make changes to this bug.