Open djacques4gorilla opened 3 years ago
Adding
$cwd = $cwd ?: getcwd();
at vendor/vaimo/composer-patches/src/Shell.php:39 locally allowed patches to be installed successfully.
Note taken + many thanks for the fix provided! will be addressing this this weekend!
Hi @allanpaiste ,
Do you have any ETA for the new tag that will include this fix? Magento Cloud has updated their Composer version on their build server to an incompatible version, so we had to move some projects to a fork including the fix in order to continue to apply patches. If anyone else is using your extension on Magento Cloud in graceful mode, they might be deploying their projects without any patches applied unbeknownst to them, potentially exposing them to security issues or bugs that were previously fixed thanks to the patches. Since Magento Cloud doesn't keep snapshot build tags, even if they do find out the patches aren't applying afterward, they will be unable to rollback to a state where patches were applied.
@zamoroka Any movement on this issue? I see you have published your first new version since I reported the bug, but it's unclear whether the issue has been resolved or not.
When upgrading to Composer ~1.10.21, patches fail to apply due to a new exception being thrown by Composer. ` Executing command (CWD): which patch The given CWD for the process does not exist:
0 /var/www/html/vendor/vaimo/composer-patches/src/Shell.php(57): Composer\Util\ProcessExecutor->execute('which patch', Object(Closure), '')
` Applying the patches works properly with the same patch list and same version of Vaimo Composer Patches when using Composer 1.10.20 or earlier. Since Composer 1.10.21 introduces support for the new format of GitHub tokens, upgrading environments to that version or later is important, but can't be completed until this error is resolved.
Pre-requisites
To Reproduce Steps to reproduce the behavior:
composer install
Expected Patches apply successfully
Actual The first patch fails with "The given CWD for the process does not exist" and the patch application process is halted.
Notes See https://github.com/composer/composer/commit/abcf9e993bb2787a1ce59154a406341eb33d379f#diff-0d77dff282a3465a0ecf922a588d76fb9e09d64655c5c31fd6b702a63640574e for the related changes to Composer. It looks like previous versions of Composer would simply silently fail and still run the CLI command even if CWD was null or invalid. Since the command is
which patch
, it would work from any directory, so it didn't matter what the current one was. I suppose one way to fix this would be to properly define the value of$cwd
when unspecified in the call toexecute()
so that the exception isn't being thrown.