Problem/Motivation

The \Drupal\DrupalInstalled::VERSIONS_HASH is calculated from the set of packages installed by composer. Unfortunately the sort order of the packages returned by \Composer\Repository\RepositoryInterface::getPackages() is not guaranteed to be the same for an equivalent set of packages. This can result in otherwise identical builds having a different versions hash.

Steps to reproduce

On 11.x checkout of Drupal:

composer require drupal/gin drupal/entity_usage
// Store version hash to compare for later.
composer remove drupal/gin
composer require drupal/gin
// Check version hash - they should match but they do not.

Proposed resolution

Sort the packages before producing the hash.

Remaining tasks

User interface changes

None

Introduced terminology

N/a

API changes

None

Data model changes

None

Release notes snippet

N/a

Issue fork drupal-3572527

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Issue summary: View changes

alexpott’s picture

Status: Active » Needs review
alexpott’s picture

chr.fritsch’s picture

Status: Needs review » Reviewed & tested by the community

The fix looks good to me and it also fixes the problem it in our multi arch docker build where I first discovered it.

  • catch committed f0666e7b on 11.3.x
    fix: #3572527 \Drupal\DrupalInstalled::VERSIONS_HASH is not consistent...

  • catch committed 9d6f56e4 on 11.x
    fix: #3572527 \Drupal\DrupalInstalled::VERSIONS_HASH is not consistent...

  • catch committed f905d6de on main
    fix: #3572527 \Drupal\DrupalInstalled::VERSIONS_HASH is not consistent...
catch’s picture

Version: main » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to main, 11.x and 11.3.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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