4

When downloading and running the Magento PHP 5.4 support patch (Magento-CE-v1.7.0.0-1.7.0.2) from http://www.magentocommerce.com/download, running the script using sh PATCH_SUPEE-2629_EE_1.12.0.0_v1.sh we receive this error:

$ sh PATCH_SUPEE-2629_EE_1.12.0.0_v1.sh
: command not found_1.12.0.0_v1.sh: line 7:
'ATCH_SUPEE-2629_EE_1.12.0.0_v1.sh: line 9: syntax error near unexpected token `{
'ATCH_SUPEE-2629_EE_1.12.0.0_v1.sh: line 9: `_check_installed_tools() {

Strangely, line 7 of the script is blank (here's the head of the file):

#!/bin/bash
# Patch apllying tool template
# v0.1.2
# (c) Copyright 2013. Magento Inc.
#
# DO NOT CHANGE ANY LINE IN THIS FILE.

# 1. Check required system tools
_check_installed_tools() {
    local missed=""

We tried the download in Windows and Mac, in Firefox and Chrome to rule out any encoding problems caused by the download process. The patch seems to be very new - Added Jan 17, 2014

We're running Magento Community Edition 1.7.0.2

Edit

We've tried running the .sh file with bash as well but receive the same response.

Interestingly when the click "download", Magento shows the .sh source in the browser so we tried various combinations of view-source then save; copying the text from the browser window and saving it to a text file. None of these solved the problem although one changed the error message to:

$ sh PATCH_SUPEE-2629_EE_1.12.0.0_v1.sh
Checking if patch can be applied/reverted successfully...
/usr/bin/patch: **** malformed patch at line 238:

ERROR: Patch can't be applied/reverted successfully.

Line 238 is the blank comment line here:

+/**
+ * Abstract helper class for {@link Zend_Pdf_FileParser} that provides the
+ * data source for parsing.
+ *
+ * Concrete subclasses allow for parsing of in-memory, filesystem, and other
+ * sources through a common API. These subclasses also take care of error
+ * handling and other mundane tasks.

We also tried the VI step mentioned here - :set ff unix http://www.magentocommerce.com/boards/viewthread/864518

The error then changed to:

$ sh PATCH_SUPEE-2629_EE_1.12.0.0_v1.sh
Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.

patching file app/code/core/Mage/Catalog/Model/Product.php
Hunk #1 FAILED at 1936.
1 out of 1 hunk FAILED -- saving rejects to file app/code/core/Mage/Catalog/Model/Product.php.rej
patching file app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
Hunk #1 FAILED at 43.
1 out of 1 hunk FAILED -- saving rejects to file app/code/core/Mage/Core/Controller/Varien/Router/Standard.php.rej
patching file app/code/core/Mage/Install/etc/config.xml
patching file app/code/core/Zend/Pdf/FileParserDataSource.php
Daniel Flippance
  • 7,734
  • 5
  • 42
  • 55
  • Look here, maybe it will help a little bit: http://stackoverflow.com/questions/20572320/magento-1-7-2-security-patch-error-via-ssh – sergio Jan 30 '14 at 19:33
  • @sergio, thanks there were some useful ideas there although we haven't found a solution yet. Post updated with the results – Daniel Flippance Jan 30 '14 at 20:04
  • 1
    Before trying to apply the patch!!! Use Chrome or Firefox to do "Save As..." on plaintext file that downloads. Make sure the patch gets uploaded with proper line endings, it's a *nix shell script and doesn't need any CRLF silliness to break it and cause syntax errors when you try to run it from the command line. – Fiasco Labs Jan 31 '14 at 06:26

1 Answers1

3

It turns out that this error is given when the patch file (not the file being patched) has line endings which do not match the system on which it is being run.

eg: You will see this error when:

  • You are running on Linux
  • Your patch file has Windows line endings

I changed the patch file to have Unix line endings using Sublime:

View > Line Endings > Unix

See also Error patching Magento 1.7.1 Hunk #1 Failed at

Community
  • 1
  • 1
Daniel Flippance
  • 7,734
  • 5
  • 42
  • 55