Closed Bug 621925 Opened 14 years ago Closed 13 years ago

Single-file extensions throw 'used only once' warnings when called

Categories

(Bugzilla :: Extensions, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.0

People

(Reporter: michael.j.tosh, Assigned: glob)

Details

Attachments

(1 file, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 (CK-xxxxxxxxxx) Firefox/3.6.13 (.NET CLR 3.5.30729)
Build Identifier: Bugzilla 4.0 RC1

Each time my extension gets loaded and used, I get a warning in my error_log.

The extension is the single module type, MyExtension.pm, and contains no templates or other libraries.

Per the following page on debian, this error can be suppressed by adding a "no warnings 'once';" command to the code segment in Bugzilla/Install/Util.pm on line 225.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521609

The interesting part is that this error isn't thrown for other extensions even though the errant variable, Bugzilla::Extension::MyExtension::EXTENSION_PACKAGE_DIR, is not used or defined ANYWHERE else but this line.  There is no documentation for it, and without knowing the whole extension architecture I see no need for it.  Perhaps it needs to be documented and the errors ignored.


Reproducible: Always
Attached patch patch v1 for 4.0RC1 (obsolete) — Splinter Review
This patch suppresses the warning.
Attachment #500221 - Attachment is patch: true
Attachment #500221 - Attachment mime type: application/octet-stream → text/plain
I've never seen this error. Suppressing a warning is not something we want to, and shouldn't happen. Perhaps there is some other problem with your extension?
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
This problem is only seen for extensions that are Single File types.

Reopening per Max's suggestion on support-bugzilla
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
Summary: Simple extensions throw 'used only once' warnings when called → Single-file extensions throw 'used only once' warnings when called
confirming, however i see this on non-single-file extensions too:

Util.pm: Name "Bugzilla::Extension::Voting::EXTENSION_PACKAGE_DIR" used only once: possible typo at Bugzilla/Install/Util.pm line 228.

Win32 strawberryperl 5.12.1.0
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch alternative patch (obsolete) — Splinter Review
while EXTENSION_PACKAGE_DIR is undocumented and looks like it can be removed, it's an arbitrary name used to derive the class's path when the $file argument isn't specified.

rather than suppressing the warning, this patch uses __FILE__ instead, which won't trigger the warning.
Assignee: extensions → glob
Attachment #500221 - Attachment is obsolete: true
Attachment #513385 - Flags: review?(mkanat)
Comment on attachment 513385 [details] [diff] [review]
alternative patch

this is wrong
Attachment #513385 - Flags: review?(mkanat)
Attached patch patch v2Splinter Review
as per miketosh's patch, just ignore the warning, but also add a comment to avoid future confusion.
Attachment #513385 - Attachment is obsolete: true
Attachment #513393 - Flags: review?(mkanat)
Comment on attachment 513393 [details] [diff] [review]
patch v2

Awesome, thank you so much. :-)
Attachment #513393 - Flags: review?(mkanat) → review+
Flags: approval4.0+
Flags: approval+
Target Milestone: --- → Bugzilla 4.0
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Install/Util.pm
Committed revision 7724.

Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/4.0/
modified Bugzilla/Install/Util.pm
Committed revision 7561.
Status: NEW → RESOLVED
Closed: 14 years ago13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: