Prebuild and download checksums not matching#355
Open
ma4nn wants to merge 1 commit intovtsykun:masterfrom
Open
Prebuild and download checksums not matching#355ma4nn wants to merge 1 commit intovtsykun:masterfrom
ma4nn wants to merge 1 commit intovtsykun:masterfrom
Conversation
…if prebuild_zipball and include_archive_checksum enabled)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
prebuild_zipballandinclude_archive_checksumare enabled, the shasum stored in the Composer metadata (/p2/vendor/package.json) never matched the actual downloaded archive file. This causes Composer to fail checksum verification duringcomposer install/composer update.Root Cause
A version string mismatch between the prebuild and the download path when constructing archive filenames.
Updater::updateArchive()) passed$data->getVersion()toDistManager::buildAndWriteArchive(). For a ComposerPackageInterface, getVersion()returns the normalized version — e.g. 2.1.2.0 (four-part).DistManager::getDist()) builds the cache key from$version->getVersion()on theVersionentity. That method returns$this->version, which is the pretty version stored in the version column — e.g. 2.1.2 (three-part).So for a tag like 2.1.2:
<basedir>/<vendor>/<package>/2.1.2.0-<ref>.zip→ shasum stored in metadata.<basedir>/<vendor>/<package>/2.1.2-<ref>.zip→ cache miss → rebuilt a fresh archive → different (non-deterministic) SHA1 than what the metadata said.Both files ended up coexisting on disk with different contents, and the mismatch was guaranteed on every download. Dev branches (e.g.
dev-release/2.1.2) were unaffected, because their pretty and normalized versions are identical — only tags triggered the bug.Fix
Use the pretty version also for
Updater::updateArchive(). This aligns the prebuild withDistManagerand theVersionentity, which already consistently use the pretty version for cache keys.