The question:
Showing given below error, While I am installing the patch file in my Magento version 1.4.2.0. Please help me to find out the reason for the error!
Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.
checking file app/code/core/Mage/Admin/Model/Observer.php
Hunk #1 FAILED at 37 (different line endings).
Hunk #2 FAILED at 44 (different line endings).
Hunk #3 FAILED at 55 (different line endings).
3 out of 3 hunks FAILED
checking file app/code/core/Mage/Core/Controller/Request/Http.php
Hunk #1 FAILED at 37 (different line endings).
Hunk #2 FAILED at 459 (different line endings).
2 out of 2 hunks FAILED
checking file lib/Varien/Data/Collection/Db.php
Hunk #1 FAILED at 421 (different line endings).
1 out of 1 hunk FAILED
The Solutions:
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Method 1
There are modifications in core files (‘app/code/core/Mage/Admin/Model/Observer.php’ for example and so on), these files are saved with different line endings. The solution is to compare your current files with original files from Magento 1.4.2.0 distribution and understand why your files got changed. If you believe there should be no any changes in core files, you can simply replace ‘app/code/core/Mage/Admin/Model/Observer.php’, ‘app/code/core/Mage/Core/Controller/Request/Http.php’ and so on with original files from Magento 1.4.2.0 distribution and re-run the patch.
If it is just line-endings and you have tofrodos installed or are familar with perl or sed inline replacements, converting line endings may be faster than re-uploading files from distro.
Method 2
Source: Hunk #1 FAILED at 1. What’s that mean?
It is an error generated by patch
. If you would open the .patch
file, you’d see that it’s organized in a bunch of segments, so-called “hunks”. Every hunk identifies corresponding pieces of code (by line numbers) in the old and new version, the differences between those pieces of code, and similarities between them (the “context”).
A hunk might fail if the similarities of a hunk don’t match what’s in the original file. When you see this error, it is almost always because you’re using a patch for the wrong version of the code you’re patching. There are a few ways to work around this:
- Get an updated version of
libdvdnav
that already includes the patch (best option). - Get a
.patch
file for the version oflibdvdnav
you’re patching. - Patch manually. For every hunk in the patch, try to locate the corresponding file and lines in
libdvdnav
, and correct them according to the instructions in the patch. -
Take the version of
libdvdnav
that’s closer to whatever version the.patch
file was intended for (probably a bad idea).- Are you sure you are using the version for
CE 1.4.0.0
–1.5.0.1
(the last download option)? - Have you made core modifications to these files?
- Are you sure you are using the version for
The files should match those of the correct version, unmodified.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0