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 840e8745d..cdbd1074c 100644 --- a/src/Composer/Installer/BinaryInstaller.php +++ b/src/Composer/Installer/BinaryInstaller.php @@ -95,7 +95,7 @@ class BinaryInstaller } elseif ($this->binCompat === "symlink") { $this->installSymlinkBinaries($binPath, $link); } - Silencer::call('chmod', $link, 0777 & ~umask()); + Silencer::call('chmod', $binPath, 0777 & ~umask()); } } @@ -149,7 +149,6 @@ class BinaryInstaller // 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 @@ class BinaryInstaller } if (!file_exists($link)) { file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link)); + Silencer::call('chmod', $link, 0777 & ~umask()); } } @@ -170,6 +170,7 @@ class BinaryInstaller protected function installUnixyProxyBinaries($binPath, $link) { file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link)); + Silencer::call('chmod', $link, 0777 & ~umask()); } protected function initializeBinDir()