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

RESOLVED FIXED in Bugzilla 4.0

Status

()

Bugzilla
Extensions
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: miketosh, Assigned: glob)

Tracking

unspecified
Bugzilla 4.0
Bug Flags:
approval +
approval4.0 +

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

7 years ago
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
(Reporter)

Comment 1

7 years ago
Created attachment 500221 [details] [diff] [review]
patch v1 for 4.0RC1

This patch suppresses the warning.
(Reporter)

Updated

7 years ago
Attachment #500221 - Attachment is patch: true
Attachment #500221 - Attachment mime type: application/octet-stream → text/plain

Comment 2

7 years ago
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
Last Resolved: 7 years ago
Resolution: --- → WORKSFORME
(Reporter)

Comment 3

7 years ago
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 → ---

Updated

7 years ago
Summary: Simple extensions throw 'used only once' warnings when called → Single-file extensions throw 'used only once' warnings when called
(Assignee)

Comment 4

7 years ago
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
(Assignee)

Comment 5

7 years ago
Created attachment 513385 [details] [diff] [review]
alternative patch

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)
(Assignee)

Comment 6

7 years ago
Comment on attachment 513385 [details] [diff] [review]
alternative patch

this is wrong
Attachment #513385 - Flags: review?(mkanat)
(Assignee)

Comment 7

7 years ago
Created attachment 513393 [details] [diff] [review]
patch v2

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 8

7 years ago
Comment on attachment 513393 [details] [diff] [review]
patch v2

Awesome, thank you so much. :-)
Attachment #513393 - Flags: review?(mkanat) → review+

Updated

7 years ago
Flags: approval4.0+
Flags: approval+
Target Milestone: --- → Bugzilla 4.0
(Assignee)

Comment 9

7 years ago
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
Last Resolved: 7 years ago7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.