Because the total possible points of an assignment are computed by adding up the point totals of assignments by their name, the gradebook attempts to add an index number to assignment names that are duplicated. However, it fails to increment this index number, resulting in an incorrect total possible points for each category if an assignment repeats a name more than twice. This might happen, for example, if a teacher has an assignment named "Participation" each week.
To fix, replace line 182 of grade/lib.php as follows:
$instance->name= $instance->name.' #'.++$i;// GVA fixed problem where there is more than one duplicate named assignment in any category in a given course. Old code: $instance->name= $instance->name.' '.$i.'';
Note that I also change the naming of the duplicate assignment a little from before to make what is happeng more obvious when one looks at the assignment listing in the gradebook. Hence the second instance of an assignment named Participation would be called Participation #2, the third Participation #3, etc.
This affects past and present versions of Moodle including 1.7dev. As it would be a non-obvious incorrect computation of a student's grade, I have marked this bug as critical.