All,

OK, I've tried this really really hard, and tried reading through the Drupal book on the subject, but I just keep getting nowhere.

Basically, I have NEVER gotten a patch to work. Here's a good example.

I read the Issues Log of PoorMansCron over at http://drupal.org/node/view/7513, and it says to fix it to use the patch.

So I download the poormanscron.patch file and put it in the same directory as poormanscron.module in an otherwise empty directory in my Linux box.

I type: patch -p0 poormanscron.patch and it says there forever.

I type: patch -p0 poormanscron.module poormanscron.patch and I get Hunk #1 FAILED at 11.

I type: patch -p1 poormanscron.module poormanscron.patch and I get Patching file poormanscron.module, Hunk #1 FAILED at 11

I have had pretty much the same experience with every patch I have tried with every module over the past 4 months.

Clearly, I am missing something here. What is it?

-Warr

Comments

killes@www.drop.org’s picture

Did you include redirection?

Try:
patch -p0 < poormanscron.patch

wernst’s picture

This (along with -p1) still gives me a Hunk #1 failed at 11 error.

I've tried this in the past as well, but I didn't just try it when writing this original post.

Let me ask this. Can SOMEONE actually download these files, try to patch them, and write back with what command actually worked?

killes@www.drop.org’s picture

I downloaded the 4.4 tarball of that module and successfully applied that patch:

killes@helios:/tmp/killes$ tar zxvf poormanscron-4.4.0.tar.gz
killes@helios:/tmp/killes$ cd poormanscron
killes@helios:/tmp/killes/poormanscron$ patch < ../poormanscron.patch 
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- poormanscron.module.orig   Fri May  7 11:18:16 2004
|+++ poormanscron.module        Fri May  7 11:12:59 2004
--------------------------
Patching file poormanscron.module using Plan A...
Hunk #1 succeeded at 11.
done
wernst’s picture

So, the patch file was one directory higher than the module file in your example?

Therefore, if the patch file and the module file were in the same directory, you could have typed:

patch < poormanscron.patch

and it would have worked?

If this is the case, then it still doesn't work for me. I still get the hunk error. Here's what I did with the patch file one directory higher:

-bash-2.05b$ patch < ../poormanscron.patch
patching file poormanscron.module
Hunk #1 FAILED at 11.
1 out of 1 hunk FAILED -- saving rejects to file poormanscron.module.rej

What am I doing wrong here?

-Warr

wernst’s picture

I figured it out. I wish someone had told me about this a few months ago.

I had been uncompressing the tarballs on my windows system and ftp-ing them to the correct folders. That gave the files DOS-style end-of-lines.

By untarring it on the linux system, the .module files has UNIX-style end-of-lines. THEN the patch works.

As a test, I converted the end-of-lines on my original files from CR/LF to just LF, and then tried the patch, and it worked.

So there you have it. Thanks for the screen dump of your actions. It was untarring it locally that showed me the light.

-Warr