-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Contents of junctioned (path) repositories still deleted #9583
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
Comments
I don't know enough about Composers internal workings to say which of the following things are supposed to happen and which are not, so I will just report what I saw. After resolving dependencies, an update was scheduled:
I'm not quite sure why it thinks an update is necessary in this case, but I think that doesn't matter: Even when an update is necessary, it should remove the junction and reinstall it directly instead of deleting the contents of the junctioned repositor 8000 y, right? Then in composer/src/Composer/Downloader/DownloadManager.php Lines 260 to 266 in 196601d
And then in This is because Then
|
So I was curious why it even thinks an update is needed in the first place.
While it is true that Composer gets some (wrong) information from Wild guess: This guess is corroborated by the fact that when using 1.8.3 (the last version not affected by this issue) it deletes the junction and freshly clones the repository. |
Can you check if 2.0 is affected? Because we are not really fixing edge case stuff in 1.x at this point.. |
Ping? Would be good to know if this can still be reproduced, as I lack a way to reproduce this reliably. |
Uh oh!
There was an error while loading. Please reload this page.
My `composer.json`:
Output of `composer diagnose`:
This is a continuation of #4955 because I'm still seeing this issue.A similar behavior was already observed in #4955 and fixed in the meantime, but it has regressed in 1.9.0. The last version not affected by this is 1.8.3.
When composer removes a junctioned dependency, instead of removing the junction, it descends into the junctioned repository and deletes everything recursively. That includes the
.git
directory with unpushed branches, reflog, everything, which makes this bug particularly severe.This happened to me many times before, but this time I got "lucky". Composer was unable to delete a file and aborted, which left the junction behind and allowed me to do some debugging.
I copied the
isJunction()
function fromsrc/Composer/Util/Filesystem.php
to a script and called it with the path of the junction. It returnstrue
. So either the detection failed only one time, or it's not this function that causes the bug to happen.(I copied the function from my local composer.phar, but it seems identical to the current master on GitHub.)
Here's the output, which I find interesting because apparently the deletion doesn't happen during the "Removing ..." step, but during the "Installing ..." step:
I will now purposefully lock a file in the junctioned repository (by running
notepad > lockme.txt
on the command line) and do some more debugging...The text was updated successfully, but these errors were encountered: