Hi,

I am installing the memcache module (http://drupal.org/project/memcache) for drupal and I don't understand the meaning of:
"Apply the DRUPAL-5-cache-serialize.patch that comes with the module to your Drupal installation."
- What is the meaning of this? How will I apply the patch? I already installed the memcache module and I am stuck to this instruction.

Thanks in advance.

Mark

Comments

rszrama’s picture

Refer to http://drupal.org/patch/apply and look in the module somewhere for the .patch file.

marknt15’s picture

Thanks for the quick reply. Anyway I tried this:
patch < DRUPAL-5-2-cache-serialize.patch

and it returned this:
can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -ur includes/bootstrap.inc includes/bootstrap.inc
|--- includes/bootstrap.inc 2007-07-26 12:16:45.000000000 -0700
|+++ includes/bootstrap.inc 2008-01-29 13:56:54.000000000 -0800
--------------------------
File to patch:

What is the file to patch?

Thanks again.

john.kenney’s picture

there is a mismatch between where the patch file is and where the file to be patched is, so the command won't work. to solve you either need to change location of the patch file and/or change the form of the command to sync them up.

perhaps you can get some ideas from this page on how to apply a module patch: http://drupal.org/node/620014

ezraw’s picture

Note that you can also just type in the location of the file at the prompt:

/PATH/TO/SITE/includes/bootstrap.inc

Ezra Wolfe
DLC Solutions
EthosCE

rszrama’s picture

Note the instructions for applying patches. You should place the patch in your Drupal root directory and use:

patch -p0 < filename.patch
marknt15’s picture

Hi rszrama,

I tried your instructions. I pasted the patch DRUPAL-5-2-cache-serialize.patch in my drupal root directory and I entered this:
patch -p0 < DRUPAL-5-2-cache-serialize.patch
and it returned this message:

patching file includes/bootstrap.inc
Hunk #1 FAILED at 382.
1 out of 1 hunk FAILED -- saving rejects to file includes/bootstrap.inc.rej
patching file includes/cache.inc
Hunk #1 FAILED at 21.
Hunk #2 FAILED at 43.
Hunk #3 succeeded at 85 (offset 1 line).
Hunk #4 FAILED at 98.
Hunk #5 succeeded at 176 with fuzz 2 (offset 1 line).
3 out of 5 hunks FAILED -- saving rejects to file includes/cache.inc.rej
patching file includes/menu.inc
Hunk #1 FAILED at 208.
1 out of 1 hunk FAILED -- saving rejects to file includes/menu.inc.rej
patching file modules/locale/locale.module
Hunk #1 FAILED at 172.
Hunk #2 FAILED at 231.
2 out of 2 hunks FAILED -- saving rejects to file modules/locale/locale.module.rej

Most of it failed. How can I fix the failed processes?

ezraw’s picture

Are you patching against Drupal 5? If not, I am pretty sure you don't need that patch. If you are, the patch is version specific, so that one would only work with 5-2, which might be the problem.

If you look a the D5 README.txt for the memcache module, it tells you to install the patch. For the D6 version of the module, there is mention of it.

http://drupalcode.org/viewvc/drupal/contributions/modules/memcache/READM...

Ezra Wolfe
DLC Solutions
EthosCE

marknt15’s picture

I am patching a drupal 5.2 project but it still yields an error. The patch I used is DRUPAL-5-2-cache-serialize.patch.

My OS is Snow Leopard 10.6.2 and I have followed this tutorial: http://drupal.org/node/60818

My pwd is:

/Applications/MAMP/htdocs/cec/includes

Then i entered the patch syntax and here is the error message:

$ patch < DRUPAL-5-2-cache-serialize.patch 

patching file bootstrap.inc
Hunk #1 FAILED at 382.
1 out of 1 hunk FAILED -- saving rejects to file bootstrap.inc.rej
patching file cache.inc
Hunk #1 FAILED at 21.
Hunk #2 FAILED at 43.
Hunk #3 FAILED at 84.
Hunk #4 FAILED at 97.
Hunk #5 FAILED at 175.
5 out of 5 hunks FAILED -- saving rejects to file cache.inc.rej
patching file menu.inc
Hunk #1 FAILED at 208.
1 out of 1 hunk FAILED -- saving rejects to file menu.inc.rej
can't find file to patch at input line 107
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -ur modules/locale/locale.module modules/locale/locale.module
|--- modules/locale/locale.module	2006-12-27 05:11:59.000000000 -0800
|+++ modules/locale/locale.module	2008-01-29 13:56:55.000000000 -0800
--------------------------
File to patch:
ezraw’s picture

I'm not a mac guy but everything looks right to me. Maybe someone else can chime in on any mac-specific issues?

Just another thought -- are you using 5.20 or 5.2?

Ezra Wolfe
DLC Solutions
EthosCE

john.kenney’s picture

I am not a Mac guy either, but this is a Linux command, so it shouldn't matter what OS is. (I'm not a Linux guy either, but I'm 99% sure that is true).

The error continues to say that you are not in the right place to be running the command as you have. You can see that it is trying to patch various files that are presumably not the right files: "patching file bootstrap.inc" "patching file menu.inc". It can't find the right lead in code in those files, so generates teh hunk fails.

We can't see the path you need to follow, but what you called pwd is supposed to be the path, then that looks wrong. /Applications/MAMP/htdocs/cec/includes. Presumably the right path ends with .../memcache (assuming that's the module folder name).

Key is: you must have the patch file and the file to be patched in the same folder - meaning they should both be in the memcache module folder.

Then the command should be: $ patch < DRUPAL-5-2-cache-serialize.patch. Note the Linux is case-sensitive, so you must type it exactly as it exists on the system.

This is the same for Windows or Mac and is described on this page marknt15 pointed to earlier: http://drupal.org/node/60818. See para that starts: "Using the 'cd' command..."

So basically, you just take the patch file and put it in the module folder - the same folder where the file to be patched is located.

Then you navigate via cd command to be in that same folder. then you run the command $ patch < DRUPAL-5-2-cache-serialize.patch.

To be sure you are in the right place, us 'ls' command to list files. If 'ls' doesn't list the files in module folder, you are in wrong place and command won't work. Don't run the command until the file list is the correct one.

All the commands / details for doing this navigation as described in detail on this page: http://drupal.org/node/620014 that I pointed to earlier. The commands listed for cygwin should be the same as the ones you would use since this is not operating system specific, but you are using a specialized tool that emulates Linux on Mac same as Cygwin is doing on Windows.

Hope that helps.

marknt15’s picture

Sorry for the late reply John. I tried what you said "So basically, you just take the patch file and put it in the module folder - the same folder where the file to be patched is located."

I copy pasted the 'DRUPAL-5-2-cache-serialize.patch' patch in:

/Applications/MAMP/htdocs/cec/sites/all/modules/memcache

Then I entered this(my pwd is /Applications/MAMP/htdocs/cec/sites/all/modules/memcache):

patch < DRUPAL-5-2-cache-serialize.patch

And got this:

can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -ur includes/bootstrap.inc includes/bootstrap.inc
|--- includes/bootstrap.inc	2007-07-26 12:16:45.000000000 -0700
|+++ includes/bootstrap.inc	2008-01-29 13:56:54.000000000 -0800
--------------------------
File to patch:

I think it is still wrong. What seems to be the problem? Thanks again.

john.kenney’s picture

yes, we are in the same place as with your 2nd post, so no progress has been made.

i finally looked at the actual patch file. it is more complicated than most patches i have seen (which, to be honest, isn't more than a dozen or so).

it appears to include patches to multiple files vs. just a single file. and some of these files do not appear to be in the memcache directory. i have no experience with this type of patch and can't offer any further advice how to make it work.

i think the best thing is to post a question on the memcahce issue queue. i think you need to get advice from people that know this module in detail and how it interacts with other pieces of drupal.

marknt15’s picture

Yes the patch appears to include multiple files. I created a new drupal 5.2 and installed the memcached module and this is the screenshot:
http://i.imgur.com/NjwxG.jpg

I think it worked even though I had trouble in the patches. I just don't know if it will generate an error because of the problems I encountered in the patching.

My another question is I don't know how to use it. Will it work as is after the installation with no additional code required or do I need to add some code in my select statements in order for it to work?

By the way, I followed the installation.txt. I added a memcached process and edited my settings.php and added this:

$conf = array(
   // The path to wherever memcache.inc is. The easiest is to simply point it
   // to the copy in your module's directory.
   'cache_inc' => './sites/all/modules/memcache/memcache.inc',
   // or
   // 'cache_inc' => './sites/all/modules/memcache/memcache.db.inc',
);
ezraw’s picture

A quick workaround would be to Just type in the path manually when it asks "File to patch:"

Ezra Wolfe
DLC Solutions
EthosCE

marknt15’s picture

I typed the absolute path manually plus the filename like

/Applications/MAMP/htdocs/drupal_test/includes/bootstrap.php

but it generated an error:

$ patch < DRUPAL-5-2-cache-serialize.patch 
can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -ur includes/bootstrap.inc includes/bootstrap.inc
|--- includes/bootstrap.inc	2007-07-26 12:16:45.000000000 -0700
|+++ includes/bootstrap.inc	2008-01-29 13:56:54.000000000 -0800
--------------------------
File to patch: /Applications/MAMP/htdocs/cec/includes/bootstrap.inc
patching file /Applications/MAMP/htdocs/cec/includes/bootstrap.inc
Hunk #1 FAILED at 382.
1 out of 1 hunk FAILED -- saving rejects to file /Applications/MAMP/htdocs/cec/includes/bootstrap.inc.rej
can't find file to patch at input line 25
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Only in includes: bootstrap.inc.orig
|diff -ur includes/cache.inc includes/cache.inc
|--- includes/cache.inc	2007-06-26 20:35:48.000000000 -0700
|+++ includes/cache.inc	2008-01-29 13:56:54.000000000 -0800
--------------------------
File to patch:
ezraw’s picture

The file you are patching (bootstrap.inc ) has either already been patched, or is a different version of the file than the patch expects.

I'd recommend you compare the patch with the file and see if it's already been patched or just get a clean version of that file and repatch it.

Ezra Wolfe
DLC Solutions
EthosCE