Closed
Bug 843457
Opened 12 years ago
Closed 11 years ago
PROJECT environment variable is not honored when mod_perl is enabled
Categories
(Bugzilla :: Bugzilla-General, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 4.2
People
(Reporter: mike, Assigned: LpSolit)
References
Details
(Keywords: regression)
Attachments
(1 file, 1 obsolete file)
1.56 KB,
patch
|
glob
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0
Build ID: 20130206152940
Steps to reproduce:
I upgraded my fully functional Bugzilla 4.0 instance to 4.2. I had a Bugzilla setup using the PROJECT variable setup as defined by the official documentation for multiple Bugzilla instances. I have verified that the PROJECT variable is passed from Apache to Bugzilla so this is not an Apache bug.
http://www.bugzilla.org/docs/4.2/en/html/multiple-bz-dbs.html
Actual results:
The PROJECT variable is not honored by "checksetup.pl" or any other part of Bugzilla. Checksetup.pl created a /etc/bugzilla/localhost instead of /etc/bugzilla/localhost.$PROJECT and is not looking at my $PROJECT template directory.
Expected results:
Same functionality as Bugzilla 4.0 in that it looks at /etc/bugzilla/localhost.$PROJECT and uses my $PROJECT template directory.
See also bug 467324
Reporter | ||
Comment 2•11 years ago
|
||
I found the root cause for this bug.
In Bugzilla/Constants.pm, bz_locations() is being memoize'd and this causes environment variables to not be passed in the first time Bugzilla is loaded. I'm too Perl-ignorant to come up with a fix as removing memoize breaks Bugzilla and I'm not familiar with how to set an environment variable from the BEGIN block. If I hardcode the PROJECT environment variable inside the BEGIN block things work as expected.
This makes sense as Bugzilla 4.0 did not memoize bz_locations().
Assignee | ||
Comment 3•11 years ago
|
||
Looks like a regression due to bug 576670. Per bug 576670 comment 1:
* I noticed that bz_locations was getting called a lot, and it's really a constant, so I Memoize'd it. This is safe to do because its contents will never change, even under mod_perl.
But if PROJECT is set, the contents can change.
Assignee | ||
Comment 4•11 years ago
|
||
Instead of using Memoize, we could cache bz_locations(). I suppose Bugzilla->request_cache would be a good place for it.
Target Milestone: --- → Bugzilla 4.4
Assignee | ||
Comment 5•11 years ago
|
||
http://perldoc.perl.org/Memoize.html#CAVEATS states that:
"Do not memoize a function whose behavior depends on program state other than its own arguments, such as global variables"
But bz_locations() depends on $ENV{'PROJECT'}. IMO, this is severe enough to be backported to 4.2.8.
Assignee: general → LpSolit
Status: NEW → ASSIGNED
Flags: blocking4.4.2+
Flags: blocking4.2.8+
Summary: PROJECT environment variable is not honored → PROJECT environment variable is not honored when mod_perl is enabled
Target Milestone: Bugzilla 4.4 → Bugzilla 4.2
Assignee | ||
Comment 6•11 years ago
|
||
We cannot use Bugzilla->request_cache nor ->process_cache, because Bugzilla::Constants is called early in the installation process, when these caches are not yet available.
Attachment #831511 -
Flags: review?(glob)
Assignee | ||
Comment 7•11 years ago
|
||
I forgot to remove the global variable from _bz_locations().
Attachment #831511 -
Attachment is obsolete: true
Attachment #831511 -
Flags: review?(glob)
Attachment #831513 -
Flags: review?(glob)
Comment on attachment 831513 [details] [diff] [review]
patch, v1.1
r=glob, nice
Attachment #831513 -
Flags: review?(glob) → review+
Reporter | ||
Comment 9•11 years ago
|
||
I can confirm the patch works for me. Thanks, Frédéric!
Assignee | ||
Comment 10•11 years ago
|
||
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Constants.pm
Committed revision 8810.
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.4/
modified Bugzilla/Constants.pm
Committed revision 8636.
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/
modified Bugzilla/Constants.pm
Committed revision 8237.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 11•11 years ago
|
||
Added to relnotes for 4.4.2.
You need to log in
before you can comment on or make changes to this bug.
Description
•