From bf3713072ca206c599cf20949dc94e1b4507554f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 9 Jun 2021 16:21:19 +0200 Subject: [PATCH] Fix source binaries not being made executable when symlinks cannot be used, fixes #9961 --- src/Composer/Installer/BinaryInstaller.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Composer/Installer/BinaryInstaller.php b/src/Composer/Installer/BinaryInstaller.php index 840e8745d5b2..cdbd1074cd1a 100644 --- a/src/Composer/Installer/BinaryInstaller.php +++ b/src/Composer/Installer/BinaryInstaller.php @@ -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()); } } @@ -149,7 +149,6 @@ 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'); @@ -157,6 +156,7 @@ protected function installFullBinaries($binPath, $link, $bin, PackageInterface $ } if (!file_exists($link)) { file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link)); + Silencer::call('chmod', $link, 0777 & ~umask()); } } @@ -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()