From 4af421bce157992952ee221fdb2e868e00531e11 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sat, 22 Feb 2014 17:30:47 +0100 Subject: [PATCH 1/6] Update aliases.md added another example to make clear how it works. fixes #2741 --- doc/articles/aliases.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/articles/aliases.md b/doc/articles/aliases.md index 26a9c46ab..9e8f3da89 100644 --- a/doc/articles/aliases.md +++ b/doc/articles/aliases.md @@ -7,7 +7,7 @@ ## Why aliases? When you are using a VCS repository, you will only get comparable versions for -branches that look like versions, such as `2.0`. For your `master` branch, you +branches that look like versions, such as `2.0` or `2.0.x`. For your `master` branch, you will get a `dev-master` version. For your `bugfix` branch, you will get a `dev-bugfix` version. From 714a47ef93d2387b66a6eff2cb9e2191c79b8d6d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 23 Feb 2014 17:13:38 +0100 Subject: [PATCH 2/6] Fix detached head handling for non-committish sources, fixes #2732 --- src/Composer/Package/Loader/RootPackageLoader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index 2dc4e220d..f177f8eab 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -210,7 +210,7 @@ class RootPackageLoader extends ArrayLoader // find current branch and collect all branch names foreach ($this->process->splitLines($output) as $branch) { - if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from [a-f0-9]+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) { + if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) { if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ') { $version = 'dev-'.$match[2]; $isFeatureBranch = true; From e8a3fc5c1c12203b7dc38406e73331f871c5f56e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 24 Feb 2014 08:24:01 +0100 Subject: [PATCH 3/6] Run tests on PHP 5.6 on travis too --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 800a4f2f1..576b2bcbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 5.3 - 5.4 - 5.5 + - 5.6 - hhvm matrix: From eed5ba7752c0151887d2c5c8cd33cbecdee31b5c Mon Sep 17 00:00:00 2001 From: Sandy Pleyte Date: Mon, 24 Feb 2014 09:40:02 +0100 Subject: [PATCH 4/6] Updated the troubleshooting doc with a chapter for the proc_fork errors that happen on a tiny VPS with no swap space. Also added the solution provided in #1849, #1101, #945. --- doc/articles/troubleshooting.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index 2fc7bb487..fc9faa8d5 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -118,3 +118,22 @@ your GitHub account and to solve this issue you need to: 2. Add it to the configuration running `composer config -g github-oauth.github.com ` Now Composer should install/update without asking for authentication. + +## proc_open(): fork failed errors +If composer shows proc_open() fork failed on some commands: + + PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar + +This could be happening because the VPS runs out of memory and has no Swap space enabled. + + [root@my_tiny_vps htdocs]# free -m + total used free shared buffers cached + Mem: 2048 357 1690 0 0 237 + -/+ buffers/cache: 119 1928 + Swap: 0 0 0 + +To enable the swap you can use for example: + + /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 + /sbin/mkswap /var/swap.1 + /sbin/swapon /var/swap.1 From 2c01c9dd05db405dd756d3f841ffab73d738ef5a Mon Sep 17 00:00:00 2001 From: Richard George Date: Mon, 24 Feb 2014 11:28:08 +0000 Subject: [PATCH 5/6] Avoid "Package foo/* listed for update is not installed" error Previously 'compose update foo/*' gave an error "Package foo/* listed for update is not installed. Ignoring" even if some foo/* packages were present; however the packages *would* then be updated as requested. This removes the false error iff foo/SOMEPACKAGE is required. --- src/Composer/Installer.php | 41 ++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index e1dbd496f..358d35d94 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -105,6 +105,11 @@ class Installer protected $verbose = false; protected $update = false; protected $runScripts = true; + /** + * Array of package names/globs flagged for update + * + * @var array|null + */ protected $updateWhitelist = null; protected $whitelistDependencies = false; @@ -785,9 +790,8 @@ class Installer } foreach ($this->updateWhitelist as $whiteListedPattern => $void) { - $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern)); - - if (preg_match("{^".$cleanedWhiteListedPattern."$}i", $package->getName())) { + $patternRegexp = $this->packageNameToRegexp($whiteListedPattern); + if (preg_match($patternRegexp, $package->getName())) { return true; } } @@ -795,6 +799,19 @@ class Installer return false; } + /** + * Build a regexp from a package name, expanding * globs as required + * + * @param $whiteListedPattern + * @return string + */ + private function packageNameToRegexp($whiteListedPattern) + { + $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern)); + $patternRegexp = "{^" . $cleanedWhiteListedPattern . "$}i"; + return $patternRegexp; + } + private function extractPlatformRequirements($links) { $platformReqs = array(); @@ -844,11 +861,27 @@ class Installer $seen = array(); + $rootRequiredPackageNames = array_keys($rootRequires); + foreach ($this->updateWhitelist as $packageName => $void) { $packageQueue = new \SplQueue; $depPackages = $pool->whatProvides($packageName); - if (count($depPackages) == 0 && !in_array($packageName, $requiredPackageNames) && !in_array($packageName, array('nothing', 'lock'))) { + + $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames); + + if (!$nameMatchesRequiredPackage) { + //maybe the name is a glob or similar that won't match directly + $whitelistPatternRegexp = $this->packageNameToRegexp($packageName); + foreach ($rootRequiredPackageNames as $rootRequiredPackageName) { + if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) { + $nameMatchesRequiredPackage = true; + break; + } + } + } + + if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock'))) { $this->io->write('Package "' . $packageName . '" listed for update is not installed. Ignoring.'); } From 234be0b5e31b2e590c69824ac7239b185e42360c Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 24 Feb 2014 12:49:09 +0100 Subject: [PATCH 6/6] CS fixes, refs #2750 --- src/Composer/Installer.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 358d35d94..4e4502dfe 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -802,14 +802,14 @@ class Installer /** * Build a regexp from a package name, expanding * globs as required * - * @param $whiteListedPattern + * @param string $whiteListedPattern * @return string */ private function packageNameToRegexp($whiteListedPattern) { $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern)); - $patternRegexp = "{^" . $cleanedWhiteListedPattern . "$}i"; - return $patternRegexp; + + return "{^" . $cleanedWhiteListedPattern . "$}i"; } private function extractPlatformRequirements($links) @@ -868,10 +868,10 @@ class Installer $depPackages = $pool->whatProvides($packageName); - $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames); + $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames, true); + // check if the name is a glob pattern that did not match directly if (!$nameMatchesRequiredPackage) { - //maybe the name is a glob or similar that won't match directly $whitelistPatternRegexp = $this->packageNameToRegexp($packageName); foreach ($rootRequiredPackageNames as $rootRequiredPackageName) { if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {