-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve reproducibility of autoloader files - add missing sort
#12090
Conversation
76f212c
to
1b2c4a6
Compare
sort
bfd432d
to
9c34034
Compare
@@ -268,6 +268,7 @@ public function dump(Config $config, InstalledRepositoryInterface $localRepo, Ro | |||
foreach ($paths as $path) { | |||
$exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path); | |||
} | |||
sort($exportedPaths); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure but this does not seem safe to me.. If you have a package defining a psr-4 path for a namespace, then another defining the same.. We do want to keep the preference order of packages here, and not just sort alphabetically. This should already be stable sorted via sortPackageMap
so I do not understand how you end up with different orders in different cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't fully explain it either, but we can reproduce it locally. I will dig deeper as soon as I can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added the 2 different autoload_static.php
files in the issue message, in case we need them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added it in the first message of this PR
If removing |
Yes this is weird. I will most probably investigate at some point, but it's not possible yet for me. |
I removed the In this PR, I propose a patch, your inputs/feedback is welcome. |
9c34034
to
34f2f39
Compare
Please see #12263 for an alternative fix, which I believe is more correct and appears to resolve the issue as well by forcing a stable order. |
This release includes an extra patch to fix reproducible outputs, see composer/composer#12090
This release includes an extra patch to fix reproducible outputs, see composer/composer#12090
This release includes an extra patch to fix reproducible outputs, see composer/composer#12090 (cherry picked from commit 097aafd)
While updating PHPDocumentor in Nix (#336145), we encountered instability with the new version of the Composer builder introduced in #308059. In the context of Nix, "unstable" means that the
vendor
directory produced by Composer was not consistently reproducible.To reproduce the issue locally:
Additionally, I've added a commit (I removed it, I was not satisfied with my implementation.refactor: DRY
) to remove duplicated code and clarify the autoloader files generation process. Please let me know if you'd prefer to keep or revert this change.