Last updated April 23, 2009.
Here are some steps to use Cygwin for patching in Windows. There is a videocast on Installing Cygwin on Windows XP that covers installing Cygwin but not actually using it. For applying patches from command line there is another videocast Applying Patches to Drupal Core.
Assumptions
- cygwin is installed at c:\cygwin
- the patch is at c:\mypatch.patch
- The drupal installation is at c:\drupal
- Start a cmd window
- cd c:\drupal
- c:\cygwin\bin\patch.exe -p0 < c:\mypatch.patch
After the patch is applied check for it saying that hunks failed. If it does it will create a reject(.rej) file where you can look at what has failed.
If there are no errors or it only states there are offsets then your patch has been applied successfully.
Comments
File permissions after patch in Cygwin
When applying Drupal core patches under Cygwin the file permissions of patched files may get broken causing "failed to open stream: Permission denied" errors on require_once() etc. calls, which ends up with WSOD.
When checking the 'ls' output from Cygwin, there's an extra + sign missing in file permissions for the patched files, when compared to other files. This indicates that there are extra permissions (from Windows ACLs) applying, which do not fit to traditional user/group/other categories.
The ACLs can be checked and restored by using commands 'getfacl' and 'setfacl' under Cygwin. Just check what ACLs any other file, which was not patched, has, and then apply the same to the patched files.
@okaalto: This bug seems to
@okaalto: This bug seems to be fixed in the current version.
Bug not fixed yet.
I downloaded Cygwin yesterday and tried to use it to apply my first patch today and am getting error messages when trying to open the files.
I am not familiar with unix commands but I managed to work out what @okaalt meant. Here is a bit of help for anyone who is not familiar with getfacl / setfacl.
Tip: I have added the cygwin path (c:/cygwin/bin/) up in the Path of the Environmental Variables in Windows so I don't have to keep typing it in every time I want to use a command (Control Panel > System > Advanced System Settings). This path should be appended to the list and separated by a semi-colon from the previous entry.
The easiest thing is to create a text file containing the permissions from a file that is ok (file1) and then apply those settings to the broken file (file2).
getfacl file1 > acl_file.txtsetfacl -f acl_file.txt file2
-- SweeneyTodd