It shouldn't be possible to link multiple productseries to a sourcepackage in a given distroseries

Bug #196774 reported by Francis J. Lacoste
24
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Unassigned

Bug Description

The unique constraint specified on the Packaging table is
(distroseries, sourcepackagename, productseries).

I think this should really be (distroseries, sourcepackagename). I don't think it makes much sense to allow linking multiple productseries to a sourcepackage. Since there will be only one active link at a time (otherwise, they'll be different sourcepackagenames).

The wrong constraint causes problems:

1. SourcePackage.direct_packaging and SourcePackage.packaging only returns one result, where there should really be way to return the set.
2. Reload several time the +index page of a sourcepackage with multiple productseries link and you'll get a different one each time. Example: https://edge.launchpad.net/ubuntu/+source/tellico

If the historical trail is important, we should add an active boolean flag (or model that state through the packaging column). And only allow one active link.

Related branches

Changed in launchpad:
importance: Undecided → Medium
status: New → Confirmed
Changed in launchpad-foundations:
status: Confirmed → Triaged
Revision history for this message
Curtis Hovey (sinzui) wrote :

This is the underlying cause of bug #352374. I think we can fix that bug by deleting the bad link. But it would be better if this non-sense never happened.

affects: launchpad-foundations → launchpad-registry
Changed in launchpad-registry:
importance: Medium → High
milestone: none → 3.1.10
Revision history for this message
Curtis Hovey (sinzui) wrote :

There are 81 bad packages in staging. I think we can clean fix this constraint, then fix the bad package

select
    distroseries.name as distroseries,
    sourcepackagename.name as sourcepackagename,
    count(sourcepackagename.name)
from
    packaging, sourcepackagename, distroseries
where
    packaging.sourcepackagename = sourcepackagename.id
    and packaging.distroseries = distroseries.id
group by
    distroseries.name, sourcepackagename.name
having count(sourcepackagename.name) > 1
order by
    distroseries.name, sourcepackagename.name;

Curtis Hovey (sinzui)
Changed in launchpad-registry:
status: Triaged → In Progress
Curtis Hovey (sinzui)
Changed in launchpad-registry:
assignee: nobody → Curtis Hovey (sinzui)
Revision history for this message
Curtis Hovey (sinzui) wrote :

The <productseries>/+packaging link allows the user to select any distroseries and any legitimate sourcepackagename regardless of if distroseries already has that package linked.

Once the mistakes is made, any attempt to fix the problem via the UI will cause an oops (bug #352374)
    Retry: duplicate key value violates unique constraint "packaging_uniqueness"

While it is possible to transfer the bad package to another project and series without packaging it cannot be deleted (bug #193469)

Trying to correct this from +addpackaging by leaving an empty sourcepackagename causes an oops (bug #344376) because
the form is not smart enough to know it is required

The user may create multiple packages for different productseries in the same distroseries, which causes two idential packages to be listed in the project page (bug #379017)

Curtis Hovey (sinzui)
Changed in launchpad-registry:
milestone: 3.1.10 → 3.1.11
Revision history for this message
Curtis Hovey (sinzui) wrote :

Fixed in db-devel r8667

Changed in launchpad-registry:
status: In Progress → Fix Committed
Revision history for this message
Curtis Hovey (sinzui) wrote : Bug 196774 Fix released

Fixed released in launchpad-project 3.1.11.

Changed in launchpad-registry:
status: Fix Committed → Fix Released
Curtis Hovey (sinzui)
Changed in launchpad:
assignee: Curtis Hovey (sinzui) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.