diff --git a/CHANGELOG.md b/CHANGELOG.md index a1c48600b..9b7fc7b14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +### [2.0.12] 2021-04-01 + + * Fixed support for new GitHub OAuth token format (#9757) + * Fixed support for Vagrant/VirtualBox filesystem slowness by adding short sleeps in some places (#9627) + * Fixed unclear error reporting when a package is in the lock file but not in the remote repositories (#9750) + * Fixed processes silently ignoring the CWD when it does not exist + * Fixed new Windows bin handling to avoid proxying phar files (#9742) + * Fixed issue extracting archives into paths that already exist, fixing problems with some custom installers (composer/installers#479) + * Fixed support for branch names starting with master/trunk/default (#9739) + * Fixed self-update to preserve phar file permissions on Windows (#9733) + * Fixed detection of hg version when localized (#9753) + * Fixed git execution failures to also include the stdout output (#9720) + ### [2.0.11] 2021-02-24 * Reverted "Fixed runtime autoloader registration (for plugins and script handlers) to prefer the project dependencies over the bundled Composer ones" as it caused more problems than expected @@ -183,6 +196,11 @@ * Fixed suggest output being very spammy, it now is only one line long and shows more rarely * Fixed conflict rules like e.g. >=5 from matching dev-master, as it is not normalized to 9999999-dev internally anymore +### [1.10.21] 2021-04-01 + + * Fixed support for new GitHub OAuth token format + * Fixed processes silently ignoring the CWD when it does not exist + ### [1.10.20] 2021-01-27 * Fixed exclude-from-classmap causing regex issues when having too many paths @@ -1114,6 +1132,7 @@ * Initial release +[2.0.12]: https://github.com/composer/composer/compare/2.0.11...2.0.12 [2.0.11]: https://github.com/composer/composer/compare/2.0.10...2.0.11 [2.0.10]: https://github.com/composer/composer/compare/2.0.9...2.0.10 [2.0.9]: https://github.com/composer/composer/compare/2.0.8...2.0.9 @@ -1131,6 +1150,7 @@ [2.0.0-alpha3]: https://github.com/composer/composer/compare/2.0.0-alpha2...2.0.0-alpha3 [2.0.0-alpha2]: https://github.com/composer/composer/compare/2.0.0-alpha1...2.0.0-alpha2 [2.0.0-alpha1]: https://github.com/composer/composer/compare/1.10.7...2.0.0-alpha1 +[1.10.21]: https://github.com/composer/composer/compare/1.10.20...1.10.21 [1.10.20]: https://github.com/composer/composer/compare/1.10.19...1.10.20 [1.10.19]: https://github.com/composer/composer/compare/1.10.18...1.10.19 [1.10.18]: https://github.com/composer/composer/compare/1.10.17...1.10.18 diff --git a/doc/03-cli.md b/doc/03-cli.md index 4d49e35dc..74efa3260 100644 --- a/doc/03-cli.md +++ b/doc/03-cli.md @@ -1009,6 +1009,15 @@ cannot be guessed from VCS info and is not present in `composer.json`. By setting this var you can make Composer install the dependencies into a directory other than `vendor`. +### COMPOSER_RUNTIME_ENV + +This lets you hint under which environment Composer is running, which can help Composer +work around some environment specific issues. The only value currently supported is +`virtualbox`, which then enables some short `sleep()` calls to wait for the filesystem +to have written files properly before we attempt reading them. You can set the +environment variable if you use Vagrant or VirtualBox and experience issues with files not +being found during installation even though they should be present. + ### http_proxy or HTTP_PROXY If you are using Composer from behind an HTTP proxy, you can use the standard diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index d7cfd1039..a1ad373b5 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -343,7 +343,9 @@ EOT } if (null === $stability) { - if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) { + if (null === $packageVersion) { + $stability = 'stable'; + } elseif (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) { $stability = $match[1]; } else { $stability = VersionParser::parseStability($packageVersion); diff --git a/src/Composer/Util/Hg.php b/src/Composer/Util/Hg.php index a0ebac01d..fe0649dbb 100644 --- a/src/Composer/Util/Hg.php +++ b/src/Composer/Util/Hg.php @@ -92,7 +92,7 @@ class Hg { if (false === self::$version) { self::$version = null; - if (0 === $process->execute('hg --version', $output) && preg_match('/version (\d+(?:\.\d+)+)/m', $output, $matches)) { + if (0 === $process->execute('hg --version', $output) && preg_match('/^.+? (\d+(?:\.\d+)+)\)?\r?\n/', $output, $matches)) { self::$version = $matches[1]; } } diff --git a/src/Composer/Util/Platform.php b/src/Composer/Util/Platform.php index a18af5356..6293ce80c 100644 --- a/src/Composer/Util/Platform.php +++ b/src/Composer/Util/Platform.php @@ -20,7 +20,7 @@ namespace Composer\Util; class Platform { /** @var ?bool */ - private static $isVagrantGuest = null; + private static $isVirtualBoxGuest = null; /** * Parses tildes and environment variables in paths. @@ -123,34 +123,49 @@ class Platform public static function workaroundFilesystemIssues() { - if (self::isVagrantGuest()) { + if (self::isVirtualBoxGuest()) { usleep(200000); } } /** - * Attempts detection of vagrant guest VMs + * Attempts detection of VirtualBox guest VMs * - * This works based on the process' user being "vagrant", or the COMPOSER_RUNTIME_ENV env var being set to "vagrant" + * This works based on the process' user being "vagrant", the COMPOSER_RUNTIME_ENV env var being set to "virtualbox", or lsmod showing the virtualbox guest additions are loaded * * @return bool */ - private static function isVagrantGuest() + private static function isVirtualBoxGuest() { - if (null === self::$isVagrantGuest) { - self::$isVagrantGuest = false; - if (!self::isWindows() && function_exists('posix_getpwuid') && function_exists('posix_geteuid')) { + if (null === self::$isVirtualBoxGuest) { + self::$isVirtualBoxGuest = false; + if (self::isWindows()) { + return self::$isVirtualBoxGuest; + } + + if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) { $processUser = posix_getpwuid(posix_geteuid()); if ($processUser && $processUser['name'] === 'vagrant') { - return self::$isVagrantGuest = true; + return self::$isVirtualBoxGuest = true; } } - if (getenv('COMPOSER_RUNTIME_ENV') === 'vagrant') { - return self::$isVagrantGuest = true; + if (getenv('COMPOSER_RUNTIME_ENV') === 'virtualbox') { + return self::$isVirtualBoxGuest = true; + } + + if (defined('PHP_OS_FAMILY') && PHP_OS_FAMILY === 'Linux') { + $process = new ProcessExecutor(); + try { + if (0 === $process->execute('lsmod | grep vboxguest', $ignoredOutput)) { + return self::$isVirtualBoxGuest = true; + } + } catch (\Exception $e) { + // noop + } } } - return self::$isVagrantGuest; + return self::$isVirtualBoxGuest; } } diff --git a/src/Composer/Util/ProcessExecutor.php b/src/Composer/Util/ProcessExecutor.php index 36a75cbff..f795a8d52 100644 --- a/src/Composer/Util/ProcessExecutor.php +++ b/src/Composer/Util/ProcessExecutor.php @@ -89,8 +89,8 @@ class ProcessExecutor { if ($this->io && $this->io->isDebug()) { $safeCommand = preg_replace_callback('{://(?P[^:/\s]+):(?P[^@\s/]+)@}i', function ($m) { - // if the username looks like a long (12char+) hex string, or a modern github token (e.g. gp1_xxx) we obfuscate that - if (preg_match('{^([a-f0-9]{12,}|g[a-z]\d_[a-zA-Z0-9_]+)$}', $m['user'])) { + // if the username looks like a long (12char+) hex string, or a modern github token (e.g. ghp_xxx) we obfuscate that + if (preg_match('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+)$}', $m['user'])) { return '://***:***@'; }