How do we keep this site running? This post may contain affiliate links — the cost is the same to you, but we get a referral fee. Compensation does not affect rankings. Thanks!
So you’ve got everything working except for one nagging little bug that’s keeping your site from rocking the world. This is normally where patches come in. There are two kinds of patches – those that eventually get rolled into the production version of a module, and those that are temporary hacks to fix a longer term issue. I would recommend only using those you feel will eventually be rolled into the code, and if possible, avoid patches entirely for compatibility reasons. Too often a patch will fix a temporary issue that will later be solved in a different way and render your “patched” database structure obsolete. That being said, here’s how to patch a Drupal module in Windows:
Cygwin is a Linux-like environment that runs in Windows. The dll (cygwin1.dll) acts as a Linux API emulation layer giving you basic Linux API functionality. The complete download comes with a collection of tools that provide a Linux command prompt look and feel. As a first step, you’ll need to download and install the latest version of Cygwin.
You can install the default packages, but make sure you include the “patchutils” package under the “Devel” section.
Common Cygwin Commands:
Here’s a list of the commands you’ll need to access the patch directory:
- ls -al — lists the contents of your current directory
- cd .. — moves you up to the parent directory (note the space between cd and .. if you come from a DOS background!)
- cd foldername — moves you to a specific folder visible from your current directory
Steps to Patch a Drupal Module in Cygwin
Here are the basic steps you’ll need to follow to patch your module:
- Copy the patch file and original module to the same directory, one you can access via the Cygwin commands above.
- Run this command:
patch filetobepatched < patchfile or patch -p0 < patchfile
Voila Post any questions or comments below.
If you’re using Windows Visa, run Cygwin as an administrator. You’ll also need to uncheck the “read only” flag on files you modify, and adjust permissions (under the security tab) to allow full access for your user. Otherwise, you’ll have trouble copying and uploading files – you’ll get “permission denied” errors.