The zero incident
Damien Tournoud - September 14, 2009 - 22:07
| Project: | CVS integration |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
So. User bago creates a placeholder project and names it "zero". It puts "0" as the "Full project name", which causes validation of the rest of the form to be bypassed:
<?php
function cvs_nodeapi(&$node, $op, $arg = NULL) {
if ($node->type == 'project_project') {
switch ($op) {
[...]
case 'validate':
if ($node->title) {
// Do the validation
[...]
}
}
}
}
?>The project is saved with an empty "cvs directory", and all the files on drupal.org got reassigned to the zero project:
<?php
db_query("UPDATE {cvs_files} SET nid = %d WHERE rid = %d AND file LIKE '%s%%'", $node->nid, $node->cvs['repository'], $node->cvs['directory']);
?>Hilarity ensues.

#1
Committed http://drupal.org/cvs?commit=262966 as a stop gap solution.
#2
Here is what I ran to fix the files ownership:
<?php$res = db_query('SELECT nid, rid, directory FROM {cvs_projects} WHERE rid = 2');
while ($project = db_fetch_object($res)) {
db_query("UPDATE {cvs_files} SET nid = %d WHERE rid = %d AND file LIKE '%s%%'", $project->nid, $project->rid, $project->directory);
}
?>
Followed by:
UPDATE cvs_files SET nid = 0 WHERE nid = 577366;(the zero project had no code)
#3
Cool! Sorry for hitting the bug and I'm happy it served to find and fix a bug without creating major issues!
@Damien I also wrote you about "policies" but I understand this was not about policy but about a bug in d.o. code.
#4
Moving to the CVS queue. There is no need for this to rotten in the infrastructure queue anymore, the issue on drupal.org has been fixed.