1
0
Fork 0

Fix path repo bug causing symlinks to be left behind when uninstalling, fixes #10023

pull/10065/head
Jordi Boggiano 2021-08-18 11:25:00 +02:00
parent d465df434c
commit 91a1a471db
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 8 additions and 1 deletions

View File

@ -184,7 +184,14 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
return \React\Promise\resolve(); return \React\Promise\resolve();
} }
if (realpath($path) === realpath($package->getDistUrl())) { // ensure that the source path (dist url) is not the same as the install path, which
// can happen when using custom installers, see https://github.com/composer/composer/pull/9116
// not using realpath here as we do not want to resolve the symlink to the original dist url
// it points to
$fs = new Filesystem;
$absPath = $fs->isAbsolutePath($path) ? $path : getcwd() . '/' . $path;
$absDistUrl = $fs->isAbsolutePath($package->getDistUrl()) ? $package->getDistUrl() : getcwd() . '/' . $package->getDistUrl();
if ($fs->normalizePath($absPath) === $fs->normalizePath($absDistUrl)) {
if ($output) { if ($output) {
$this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path"); $this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
} }