This is related to #539182: Custom release node validation not happening -- you'll only see this bug once #539182 is fixed...

project_release_exists() is buggy regarding releases with extra. It only compares the fields that a given release defines, not all possible release fields. So, for example, if you have a release like:

6.x-1.0-alpha1

and you try to submit a new release:

6.x-1.0

project_release_exists() incorrectly tells you that release already exists. The problem is that the 2nd release doesn't have a version_extra field at all, so that's not included in the query used to check for duplicates. You get a query that looks like this:

SELECT COUNT(*) FROM {project_release_nodes} p INNER JOIN {term_node} t ON p.nid = t.nid WHERE p.pid = %d AND p.version_major = %d AND p.version_patch = %d AND t.tid = %d

Instead, for any fields not in the release we're considering, we need to add a "$field IS NULL" to the query, to make sure we really match the same release. Like so:

SELECT COUNT(*) FROM {project_release_nodes} p INNER JOIN {term_node} t ON p.nid = t.nid WHERE p.pid = %d AND p.version_major = %d AND p.version_patch = %d AND p.version_minor IS NULL AND p.version_extra IS NULL AND t.tid = %d

I have a patch for this coming soon...

CommentFileSizeAuthor
#1 539190-1.project_release_exists.patch1.58 KBdww

Comments

dww’s picture

Status: Active » Needs review
StatusFileSize
new1.58 KB
dww’s picture

Status: Needs review » Fixed

After a bit more testing, committed #1 to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.