Closed Bug 1001846 Opened 6 years ago Closed 6 years ago

When editing cc_accessible using Bug.update, the method sometimes returns is_cc_accessible and sometimes cc_accessible as being changed

Categories

(Bugzilla :: WebService, defect)

4.4.4
defect
Not set

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: LpSolit, Assigned: LpSolit)

References

Details

Attachments

(1 file)

Run this script several times. Before each call, make sure cc_accessible = 1:

    $call = rpc_call('Bug.update', {ids => [$bug_id], is_cc_accessible => 0});
    say Dumper($call->result->{bugs}->[0]->{changes});

Sometimes, I get:

$VAR1 = {
          'cc_accessible' => {
                             'removed' => '1',
                             'added' => '0'
                           }
        };

and sometimes:

$VAR1 = {
          'is_cc_accessible' => {
                                'added' => '0',
                                'removed' => '1'
                              }
        };

Note that the field name is not the same: cc_accessible vs is_cc_accessible. This is inconsistent and makes QA tests to fail randomly, because the name of the field varies from run to run. This happens with Perl 5.18.1. I suspect this is due to the new randomization of hashes in Perl 5.18, see bug 997281 for details.
The problem is here, in WebService/Bug.pm:

  my %api_name = reverse %{ Bugzilla::Bug::FIELD_MAP() };


It uses reverse, but FIELD_MAP contains:

use constant FIELD_MAP => {
    cc_accessible    => 'cclist_accessible',
    is_cc_accessible => 'cclist_accessible',
    ....
};

So cc_accessible and is_cc_accessible will overwrite each other, randomly. Per bug 578513, we should return is_cc_accessible, always.
Depends on: 578513
Attached patch patch, v1Splinter Review
When mkanat added is_cc_accessible into FIELD_MAP, he forgot to remove the obsolete cc_accessible.
Assignee: webservice → LpSolit
Status: NEW → ASSIGNED
Attachment #8413195 - Flags: review?(dkl)
Comment on attachment 8413195 [details] [diff] [review]
patch, v1

Review of attachment 8413195 [details] [diff] [review]:
-----------------------------------------------------------------

r=dkl
Attachment #8413195 - Flags: review?(dkl) → review+
Flags: approval?
Flags: approval4.4?
Flags: approval?
Flags: approval4.4?
Flags: approval4.4+
Flags: approval+
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   4ad3e58..7505025  master -> master

To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   dc47bf8..14208d5  4.4 -> 4.4
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Flags: approval4.2?
Target Milestone: Bugzilla 4.4 → Bugzilla 4.2
Approved for 4.2, failing tests is bad on a release branch.
Flags: approval4.2? → approval4.2+
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   feca0d8..9d068ba  4.2 -> 4.2
You need to log in before you can comment on or make changes to this bug.