Skip to content

Commit

Permalink
Fix source binaries not being made executable when symlinks cannot be…
Browse files Browse the repository at this point in the history
… used, fixes #9961
  • Loading branch information
Seldaek committed Jun 9, 2021
1 parent 2d54a27 commit bf37130
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Composer/Installer/BinaryInstaller.php
Expand Up @@ -95,7 +95,7 @@ public function installBinaries(PackageInterface $package, $installPath, $warnOn
} elseif ($this->binCompat === "symlink") {
$this->installSymlinkBinaries($binPath, $link);
}
Silencer::call('chmod', $link, 0777 & ~umask());
Silencer::call('chmod', $binPath, 0777 & ~umask());
}
}

Expand Down Expand Up @@ -149,14 +149,14 @@ protected function installFullBinaries($binPath, $link, $bin, PackageInterface $
// add unixy support for cygwin and similar environments
if ('.bat' !== substr($binPath, -4)) {
$this->installUnixyProxyBinaries($binPath, $link);
@chmod($link, 0777 & ~umask());
$link .= '.bat';
if (file_exists($link)) {
$this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
}
}
if (!file_exists($link)) {
file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
Silencer::call('chmod', $link, 0777 & ~umask());
}
}

Expand All @@ -170,6 +170,7 @@ protected function installSymlinkBinaries($binPath, $link)
protected function installUnixyProxyBinaries($binPath, $link)
{
file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
Silencer::call('chmod', $link, 0777 & ~umask());
}

protected function initializeBinDir()
Expand Down

0 comments on commit bf37130

Please sign in to comment.