Chi
Chi

Reputation: 1410

Magento: Patch 7405 Hunk #1 failed

I have a magento 1.9.0.1 and I'm trying to do the patch 7405. However, when I try this, I get the following error:

app/code/core/Mage/Customer/controllers/AccountController.php
Hunk #1 FAILED at 68 (different line endings).

The patches that I successfully applied so far are: 1533, 4291, 5344, 5944, 6285, 6482, 6788, 7616

I don't know what to do now, is there a way to find the file the patch is comparing my AccountController.php to so I can check what's different? Is there any other way to handle this? Because right now I don't know what to do.

Upvotes: 0

Views: 705

Answers (4)

Mehdi Chaouch
Mehdi Chaouch

Reputation: 455

You can also add this --ignore-whitespace in you PATCH_SUPEE-...sh like this change:

    PATCH_APPLY_REVERT_RESULT=`$SED_BIN -e '1,/^__PATCHFILE_FOLLOWS__$/d' "$CURRENT_DIR""$BASE_NAME" | $PATCH_BIN $DRY_RUN_FLAG $REVERT_FLAG -p0`

for

    PATCH_APPLY_REVERT_RESULT=`$SED_BIN -e '1,/^__PATCHFILE_FOLLOWS__$/d' "$CURRENT_DIR""$BASE_NAME" | $PATCH_BIN $DRY_RUN_FLAG $REVERT_FLAG -p0 --ignore-whitespace`

Upvotes: 0

Mike T
Mike T

Reputation: 1296

I had success simply running the patch (sh .\PATCH_SUPEE-...) in Windows (git posh shell that comes with the github client). If I tried running from inside my virtual environment, I received the line ending errors when trying to patch.

Upvotes: 0

Fiasco Labs
Fiasco Labs

Reputation: 6457

Probably a good indicator of the issue is the following message:

Hunk #1 FAILED at 68 (different line endings).

Run app/code/core/Mage/Customer/controllers/AccountController.php through dos2unix to remove the offending line endings (probably CRLF instead of *nix LF), then look at the patch section for what's expected in that section of code and make sure there isn't an extra newline.

The other answer has the patch section. The - line is the original, the + line is what will replace it. For the patch to run, the code must match character for character, everything not including the + line and with any lines starting with - having the - exchanged with a space.

Upvotes: 2

Max Bongiorno
Max Bongiorno

Reputation: 166

This is the part of PATCH_SUPEE_7405 for 1.9.0.1 CE patching AccountController.php file.

    diff --git app/code/core/Mage/Customer/controllers/AccountController.php app/code/core/Mage/Customer/controllers/AccountController.php
index 19c4507..1dbcf88 100644
--- app/code/core/Mage/Customer/controllers/AccountController.php
+++ app/code/core/Mage/Customer/controllers/AccountController.php
@@ -68,7 +68,7 @@ class Mage_Customer_AccountController extends Mage_Core_Controller_Front_Action
             return;
         }

-        $action = $this->getRequest()->getActionName();
+        $action = strtolower($this->getRequest()->getActionName());
         $openActions = array(
             'create',
             'login',

It only modifies $action = $this->getRequest()->getActionName(); TO $action = strtolower($this->getRequest()->getActionName());

Upvotes: 0

Related Questions