validate_enabled_restricted_families applies to all non-virtualized archives, not just main archives

Bug #897999 reported by William Grant
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Critical
William Grant

Bug Description

The newish form validation when setting an archive's restricted architectures is this:

    def validate_enabled_restricted_families(self, data, error_msg):
        enabled_restricted_families = data['enabled_restricted_families']
        require_virtualized = data.get('require_virtualized', False)
        proc_family_set = getUtility(IProcessorFamilySet)
        if (not require_virtualized and
            set(enabled_restricted_families) !=
                set(proc_family_set.getRestricted())):
            self.setFieldError('enabled_restricted_families', error_msg)
            self.setFieldError('require_virtualized', error_msg)

That is, it rejects an attempt to restrict the architectures of any non-virtual archive.

But from Archive._getEnabledRestrictedFamiles():

        if self.is_main and not self.require_virtualized:
            return getUtility(IProcessorFamilySet).getRestricted()

Only non-virtual archives that are also main archives implicitly get all architectures. And they do *implicitly* get all architectures, regardless of the setting of the checkboxes. This means, for example, that Ubuntu's primary archive probably doesn't have the armhf checkbox ticked, but still builds on armhf.

Except now I see it's even sillier than that. Apparently the validator doesn't run if you check no architectures at all. So you can't restrict a non-virtual PPA to a non-null subset of the restricted architectures: it's all or nothing. And the form may lie if used on a non-virtual main archive, suggesting that some architectures are forbidden when they are in fact allowed.

ARM builders are a scarce resource, so it's important it be possible to restrict an archive from one or more of the ARM subarches.

Related branches

William Grant (wgrant)
Changed in launchpad:
assignee: nobody → William Grant (wgrant)
status: Triaged → In Progress
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Changed in launchpad:
status: In Progress → Fix Committed
William Grant (wgrant)
tags: added: qa-ok
removed: qa-needstesting
William Grant (wgrant)
Changed in launchpad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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