Skip to content

Commit

Permalink
Fix path repo bug causing symlinks to be left behind when uninstalling,
Browse files Browse the repository at this point in the history
fixes #10023
  • Loading branch information
Seldaek committed Aug 18, 2021
1 parent d465df4 commit 91a1a47
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Composer/Downloader/PathDownloader.php
Expand Up @@ -184,7 +184,14 @@ public function remove(PackageInterface $package, $path, $output = true)
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");
}
Expand Down

0 comments on commit 91a1a47

Please sign in to comment.