When submitting attachment to existing bug "Undefined subroutine &Bugzilla::BugMail::editable_bug_fields" error gets thrown. Emails do not get send.

RESOLVED FIXED

Status

P1
blocker
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: andrey.smirnoff, Assigned: LpSolit)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-GB; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Build Identifier: Bugzilla 3.4.3/3.4.4 & Testopia 2.3

When submitting an attachment to an existing bug the following error gets thrown:

Bugzilla has suffered an internal error. Please save this page and send it to myemail@mail.com with details of what you were doing at the time this message appeared.
URL: http://10.100.0.225/attachment.cgi
undef error - Undefined subroutine &Bugzilla::BugMail::editable_bug_fields called at Bugzilla/BugMail.pm line 132, <fh00001install.log> line 1. 

Submitted file name in erorr example: install.log.

Additional Info:
Attachment gets actually saved OK.
No error gets thrown when I create a new bug with or without an attachment. The error gets thrown only when submitting attachment for an existing bug. 

This happens right after installing Testopia 2.3 over Bugzilla 3.4.3+. Without Testopia there is no error observed.

Tested against 3.4.3 and 3.4.4 versions of Bugzilla with Testopia 2.3.

Reproducible: Always

Steps to Reproduce:
1. Sumbmit attachmet for existing bug/ticket > error gets thrown.
(Reporter)

Updated

9 years ago
Severity: normal → major
Priority: -- → P4
Version: unspecified → 2.3
(Assignee)

Comment 1

9 years ago
Greg, I can reproduce on bugzillaqa, as discussed on IRC. This totally blocks my ability to attach patches and Selenium scripts. It's a showstopper for the QA team. Please fix asap, including bugzillaqa.
Severity: major → blocker
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows Server 2003 → All
Priority: P4 → P1
Hardware: x86 → All

Comment 2

9 years ago
I get this error as well, on a clean new installation of Bugzilla 3.4.4 and Testopia 3.4.4 and Testopia 2.3. checksetup.pl and sanitycheck.pl are both clean.

If there is a simple patch or fix, please add that information here. Thank you.
(Assignee)

Comment 3

9 years ago
Note that the error occurs only from attachment.cgi. The changes are the new attachment are committed despite the error, but no email is sent. You then have to go to show_bug.cgi and click "Commit" to send emails. Painful. That's the workaround for now.

Comment 4

9 years ago
I have seen similar things before. It seems that for some reason, Bugzilla::Bug is no longer in the @INC when dealing with attachment.cgi. I have no idea why. The fix would be to add the fully qualified domain in front of the subroutine call in BugMail, but this is outside of Testopia (unless I add it to the patch which I am loathe to do). I do not have a deep enough understanding of Perl to know what is causing this.

Comment 5

9 years ago
In other words, Testopia doesn't come close to touching BugMail.pm or attachment.cgi or anything in between so I am not sure how Testopia is affecting this. It is obvious that the behavior does not show up unless Testopia is installed, but what about installing Testopia causes this is beyond me. My Perl fu is weak apparently. :(

Comment 6

9 years ago
For those of us who know even less about Perlthan you Greg, how do we try and fix this? In the file Bugmail.pm line 172:

    my %values = %{$dbh->selectrow_hashref(
        'SELECT ' . join(',', editable_bug_fields()) . ', reporter,
                lastdiffed AS start_time, LOCALTIMESTAMP(0) AS end_time
           FROM bugs WHERE bug_id = ?',
        undef, $id)};

Do we change editable_bug_fields to Bug::editable_bug_fields or Bugzilla::editable_bug_fields or something?

Comment 7

9 years ago
You will have to make it Bugzilla::Bug::editable_bug_fields()

so 
    'SELECT ' . join(',', editable_bug_fields()) . ', reporter,
            lastdiffed AS start_time, LOCALTIMESTAMP(0) AS end_time
       FROM bugs WHERE bug_id = ?',
    undef, $id)};

would become

    'SELECT ' . join(',', Bugzilla::Bug::editable_bug_fields()) . ', reporter,
            lastdiffed AS start_time, LOCALTIMESTAMP(0) AS end_time
       FROM bugs WHERE bug_id = ?',
    undef, $id)};

Comment 8

9 years ago
Thank you very much Greg, making that changes seems to fix it! Yai!

So what do we do about this in general? Knowing me, next release and patch I shall run into this again. And Googling did not find this bug. How can we avoid that?

Is there any chance we can ask the bugzilla guys to include this minor code change (since it does no harm and will avoid a recurrence of this issue), or make it part of the Testopia patch (I understand your reluctance, but this is needed for it to work, sometimes we have to do what needs to be done), or perhaps someone can lend their Perl guru wisdom as to what causes this? Or can you list it as a workaround or known issue on the Testopia page maybe? At least that way Google will find it next time.

On the surface it looks like a Perl bug to me. Does anyone not get this? What version of Perl are they using? Im using 5.8.8 on XP SP3.
(Assignee)

Comment 9

9 years ago
That's not a bug in Bugzilla. BugMail.pm |use Bugzilla::Bug|, and even attachment.cgi uses it too. I will look into the Testopia code.
(Assignee)

Comment 10

9 years ago
Created attachment 420371 [details] [diff] [review]
patch, v1

You are overriding the EXPORT list of Bugzilla::Bug in Testopia::Environment; that's why.
Assignee: ghendricks → LpSolit
Status: NEW → ASSIGNED
Attachment #420371 - Flags: review?(ghendricks)

Updated

9 years ago
Attachment #420371 - Flags: review?(ghendricks) → review+

Comment 11

9 years ago
Bad copy and paste error dating back to 2007... oi.
Good work LpSolit :D

Comment 12

9 years ago
    Checking in extensions/testopia/lib/Testopia/Constants.pm;
    /cvsroot/mozilla/webtools/testopia/extensions/testopia/lib/Testopia/Constants.pm,v  <--  Constants.pm
    new revision: 1.5; previous revision: 1.4
    done
    Checking in extensions/testopia/lib/Testopia/Environment.pm;
    /cvsroot/mozilla/webtools/testopia/extensions/testopia/lib/Testopia/Environment.pm,v  <--  Environment.pm
    new revision: 1.5; previous revision: 1.4
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED

Comment 13

9 years ago
Is there any chance someone can show the code change to Constants.pm here please? I would like the make the correct fix in case this causes other problems somewhere.

I tried to get the file via cygwin cvs as per earlier instructions from Greg I found via Google:

$ export CVSROOT=:pserver:anon...@cvs-mirror.mozilla.org:/cvsroot 
$ cvs login (Logging in to anon...@cvs-mirror.mozilla.org) 
CVS password: anonymous 

But it is refusing the connection. There also seems to be no way to browse the code via a web browser. Perhaps I need to use mercurial to get it, but the source code path above strongly suggests cv and http://hg.mozilla.org/webtools does not show Testopia...
(Assignee)

Comment 14

9 years ago
(In reply to comment #13)
> Is there any chance someone can show the code change to Constants.pm here
> please?

line 63 of lib/Testopia/Constants.pm:

@Bugzilla::Constants::EXPORT_OK = qw(contenttypes);

"Bugzilla" must be replaced by "Testopia".

Comment 15

9 years ago
Thank you. My apologies, but what about the change in environment.pm?
(Assignee)

Comment 16

9 years ago
(In reply to comment #15)
> Thank you. My apologies, but what about the change in environment.pm?

Look at the patch I attached.

Comment 17

9 years ago
Thank you everyone. I can also confirm that these changes do appear to fix the problem:

line 63 of lib/Testopia/Constants.pm:
Change: @Bugzilla::Constants::EXPORT_OK = qw(contenttypes);
to: @Testopia::Constants::EXPORT_OK = qw(contenttypes);

line 62 of lib/Testopia/Environment.pm:
Change: @Bugzilla::Bug::EXPORT = qw(check_environment);
to: @Testopia::Environment::EXPORT = qw(check_environment);

And with that you do not need to change BugMail.pm.
You need to log in before you can comment on or make changes to this bug.