Closed joergLin closed 6 years ago
Oh boy. Thanks for reporting this. Really not looking forward to debugging this. :/
git--
yep, there's changes in git https://lkml.org/lkml/2017/8/4/481
probably
Git now avoids blindly falling back to ".git" when the setup sequence said we are not in Git repository.
Was also hitting this, see PR for something that fixes this on my system
Having issues installing and updating Drupal Lightning on FreeBSD
composer update -vvv
Running 1.5.2 (2017-09-11 16:59:25) with PHP 7.1.9 on FreeBSD / 10.3-RELEASE-p20
- Applying patches for drupal/core
https://www.drupal.org/files/issues/2652138-41.patch (2652138 - ImageFormatter does not support SVGs)
Downloading https://www.drupal.org/files/issues/2652138-41.patch
cd 'docroot/core' && git --git-dir=. apply --check '-p1' '/tmp//59ca7004e02cf.patch'
Executing command (CWD): cd 'docroot/core' && git --git-dir=. apply --check '-p1' '/tmp//59ca7004e02cf.patch'
warning: unable to access 'config': Is a directory
warning: unable to access 'config': Is a directory
fatal: unknown error occurred while reading the configuration files
Just adding a voice, that I'm also seeing this. Issue posted in acquia/lightning, cross-posting here: https://github.com/acquia/lightning/issues/473
I've confirmed that it does not happen under git 2.13.3, but does happen under git 2.14.1.
I can also confirm, anecdotally, that https://github.com/cweagans/composer-patches/pull/152 fixes the issue I'm seeing.
I'm also seeing these errors when running composer update -vvv
, but the patches do seem to be applied correctly in the end, at least in my test cases.
Can anyone explain that discrepancy, and/or provide a clear case where these errors actually prevent a patch being applied?
This needs to be fixed regardless, but I want to understand the exact scope and severity of this bug.
@danepowell
I am working with the Drupal Lightning distribution on a shared hosting provider. The actual Git-version is 2.15.0. I became aware of the problem with Git-version 2.14.3.
The problem is severe, because the projects are not maintainable on this server, which is important for small projects.
The Drupal Lightning projects are managed with Composer and the Drupal shell Drush. Composer patches are managed with cweagans/composer-patches.
Clean installations and updates fail since patches are not applied. However, I can download the patches and apply them manually.
Software: "cweagans/composer-patches": "^1.6.0", Drush Commandline Tool 9.0-dev-g809c7fc3 (global install) Drush Commandline Tool 9.0.0-beta8 (local install in the project) Composer version 1.5.2 2017-09-11 16:59:25 PHP 7.1.11 (cli) (built: Oct 30 2017 11:34:00) ( NTS )
I get the same error messages as you when running verbose composer commands, but in the end the patches do seem to be applied. I'm trying to understand why the patches are correctly applied for me but not for you (regardless of the error messages).
On my installation, the patches are clearly not applied. In the above installation, I download and apply the first patch:
$ cd docroot
$ wget https://www.drupal.org/files/issues/1356276-408--8.4.x.patch
$ patch -p1 < 1356276-408--8.4.x.patch
All I know is comping from this post:
https://github.com/cweagans/composer-patches/pull/152
By the way:
The installation can be done with an other shared hosting provider and an old Git-version, without issues. The installations and updates run also on my local machines with older Git-versions.
Okay I think I've figured out the discrepancy. This is an interplay between composer-patches, Git, and GNU patch.
composer-patches starts throwing errors for Git versions >= 2.14.0
However, depending on the version of GNU patch on your system, these errors may or may not actually be harmful. It appears that newer versions can recover more gracefully from this problem.
With Git 2.15.0 and Patch 2.5 (the default for Mac OS), I get errors and the patches fail to apply.
With Git 2.15.0 and Patch 2.7.5 (the default for Ubuntu), I get errors but the patches still successfully apply.
uname -a
FreeBSD 10.3-RELEASE-p21 #13 r322349M: Thu Aug 10 09:47:17 UTC 2017
See my new PR for this here, including an in-depth explanation of why patches were still applying in spite of the errors: https://github.com/cweagans/composer-patches/pull/165
Also note that this PR reveals another bug, which is that git apply
probably can't be used to apply patches in this context.
n.b. if you need to update your Patch version on Mac OS: brew install gpatch
and restart your session/shell
This may have introduced a regression for older versions of Git :(
Yes, this is causing patch install to fail on the git version from Ubuntu 16.04 git version 2.7.4
Installing gpatch on OS X 10.12.5 didn't fix this for me, I had to upgrade to High Sierra (10.13.2).
@pwolanin @mortenson Even when using composer-patches 1.6.4?
@grasmash It looks like that released the day I made my comment, so I'm not sure we were on it at the time.
The 1.6.4 release seems to have fixed it.
Unfortunately, my hosting provider will not update patch. So 1.6.4 does not fix the problem.
git version 2.15.1 patch 2.0-12u10 FreeBSD "cweagans/composer-patches": "^1.6.4"
Error messages: Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/1356276-408--8.4.3.patch etc.
@RalfEisler it's unlikely that this bug would produce that particular error. The bug related to patch version generally fails silently. Are you absolutely sure that the patch you are referencing applies cleanly outside of Composer?
Are you absolutely sure that the patch you are referencing applies cleanly outside of Composer?
@danepowell -- I am failing to clean install or update Drupal Lightning projects in a specific context. Patches are not applied.
php --version
PHP 7.1.12 (cli) (built: Dec 11 2017 19:54:55) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.12, Copyright (c) 1999-2017, by Zend Technologies
git version 2.15.1
patch 2.0-12u10 FreeBSD
Composer version 1.5.2 2017-09-11 16:59:25
Drupal Lightning version 2.2.5
"cweagans/composer-patches": "^1.6.4"
However, I could apply them manually:
wget https://www.drupal.org/files/issues/1356276-408--8.4.3.patch
patch -p1 < 1356276-408--8.4.3.patch
Oh it's not just the one core patch, it's every patch not applying. Yeah that seems like a bug, but you should probably open a new issue.
Using Git 2.14.0 breaks appying Patches (Alpine Edge, Composer 1.5). Latest Working Version is 2.13.4.
In the Release Notes (https://github.com/git/git/blob/master/Documentation/RelNotes/2.14.0.txt) are changes to "gitdir" and "git apply", maybe its one of them?