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

main
Jordi Boggiano 3 years ago
parent d465df434c
commit 91a1a471db
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -184,7 +184,14 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
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) {
$this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
}

Loading…
Cancel
Save