错误修补 Magento 1.7.1 Hunk #1 失败 [英] Error patching Magento 1.7.1 Hunk #1 Failed at

查看:44
本文介绍了错误修补 Magento 1.7.1 Hunk #1 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Magento Dashboard v.1.7.0.2 中看到最后一个 Critical Reminder 通知(2 个重要的安全补丁(SUPEE-5344 和 SUPEE-1533)...)

I see the last Critical Reminder notification in my Magento Dashboard v.1.7.0.2 (2 important security patches (SUPEE-5344 and SUPEE-1533)...)

因此,我在其他 Magento 中正确下载并安装了它们(例如 1.6.01.6.1),但在此版本中出现这些错误 <代码>1.7.0.2

So, I download and istalled them correctly in other Magento's (e.g. 1.6.0, 1.6.1), but I'm getting these errors in this version 1.7.0.2

[root@oc1 httpdocs]# sh PATCH_SUPEE-1533_EE_1.12.x_v1-2015-02-10-08-19-16.sh
Checking if patch can be applied/reverted successfully...
ERROR: Patch can't be applied/reverted successfully.

patching file app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
Hunk #1 FAILED at 444.
1 out of 1 hunk FAILED -- saving rejects to file app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php.rej
patching file app/code/core/Mage/Adminhtml/controllers/DashboardController.php
Hunk #1 FAILED at 92.
1 out of 1 hunk FAILED -- saving rejects to file app/code/core/Mage/Adminhtml/controllers/DashboardController.php.rej

我正在搜索,我发现这个 Magento 补丁无法安装帖子,但是它对我不起作用

I was searching and I found this Magento patch failing to install post, but it didn't work for me

我在 windows、Mac 和 Linux 上下载了 .sh 文件,结果是一样的...一些想法?

I download on windows, Mac and Linux the .sh file, and the resault is the same... Some ideas?

推荐答案

我在本地机器上使用 Windows.服务器当然是Linux.我使用 Git 进行版本控制.

I am using Windows on my local machine. The server is Linux of course. And I use Git for version control.

长话短说:尝试使用 dos2unix 实用程序来尝试获取 .php 文件的行尾以匹配 .sh 补丁文件.(我认为你也可以在 .sh 文件上运行 dos2unix 或在 .sh 文件上运行 unix2dos - 一些组合使它们都相同).

Long story short: Try using dos2unix utility to try to get the line endings of your .php files to match the .sh patch file. (I think you can also run dos2unix on the .sh file or unix2dos on the .sh file - some combination to make them both the same).

虽然我认为你的错误信息和我的有点不同.实际上,您是否查看过拒绝文件"?如果这不是行尾故障,您能想到 1.6 和 1.7 安装之间有什么不同吗?(我已经使用我在此处描述的方法修补了 1.7.0.2 和 1.9.0.1).如果您检查 Graph.php 文件,是否有任何编辑?

Although I think your error messages look a little different to mine. Actually, have you looked in the 'reject file'? If this isn't a line-endings glitch, can you think of anything different between your 1.6 and 1.7 installs? (I have patched 1.7.0.2 and 1.9.0.1 using the method I describe here). If you inspect the Graph.php file, are there any edits in it?

以下是关于对我有用的更多信息:

Here is more about what worked for me:

我使用了 Cygwin(Gitbash 似乎在处理 Linux 和 Windows 文件路径时遇到了困难,并给出了错误 /app/etc must exist).此外,我必须以管理员身份运行 Cygwin 才能解决文件权限错误(这很奇怪,可能是我的设置所独有的).

I used Cygwin (Gitbash seemed to struggle with Linux vs Windows file paths and gave the error /app/etc must exist). Also I had to run Cygwin as administrator to get around a file permission error (which is strange and probably unique to my set up).

但我需要做的主要事情是在补丁试图diff的文件上运行dos2unix.我通过编辑 .sh 补丁文件来做到这一点,您可以在文件末尾看到这些文件包含将要更改的文件的路径.

But the main thing I needed to do was run dos2unix on the files that the patch is trying to diff. I did this by editing the .sh patch files which you can see towards the end of the file has the paths to the files that will be changed.

所以我编辑了 .sh 文件,在注释 #5. File pathes 之前的第 66 行添加了这两行:-

So I edited the .sh file adding these two lines at line 66 before the comment # 5. File pathes :-

# extra steps for windows CRLF:
dos2unix app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
dos2unix app/code/core/Mage/Adminhtml/controllers/DashboardController.php

您可能需要考虑 B 计划并手动编辑文件;没有那么多变化.

You may want to consider a plan B and edit the files manually; there aren't that many changes.

Patch 5344 确实有更多更改.对于那个,我在文件 PATCH_SUPEE-5345_CE_1.7.0.2_v1-2015-02-10-08-11-22.sh#5. File pathes 之前添加了这些行代码> :-

Patch 5344 does have a few more changes though. For that one I added these lines before the comment # 5. File pathes in file PATCH_SUPEE-5345_CE_1.7.0.2_v1-2015-02-10-08-11-22.sh :-

#  extra steps for windows CRLF:
dos2unix lib/Varien/Db/Adapter/Pdo/Mysql.php
dos2unix app/code/core/Mage/XmlConnect/Model/Observer.php
dos2unix app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizeController.php
dos2unix app/code/core/Mage/Core/Controller/Request/Http.php
dos2unix app/code/core/Mage/Admin/Model/Observer.php

这对我有用.我阅读了一些 Stack Overflow 的答案来提出这个解决方案.似乎补丁"命令对行尾非常敏感.您可能会尝试的另一件事是将 -w 标志添加到 diff 命令(再次通过编辑 .sh 文件),这应该会使 diff 忽略行首和行尾的空白,但它对我不起作用.http://unixhelp.ed.ac.uk/CGI/man-cgi?diff

And that worked for me. I read a few Stack Overflow answers to come up with this solution. It seems the 'patch' command is very sensitive to line endings. One other thing you might try is adding the -w flag into the diff command (again by editing the .sh file) which supposedly makes diff ignore white space at the beginning and end of lines but it didn't work for me. http://unixhelp.ed.ac.uk/CGI/man-cgi?diff

作为最后一个问题,我会注意到我需要通过重新运行 Cygwin setup-x86.exe安装或更新"将 patch 命令添加到 Cygwin程序添加到包含 patch 的开发包中.

As a final gotcha I would note that I needed to add the patch command to Cygwin by re-running the Cygwin setup-x86.exe 'install or update' programme to add in the dev packages that contain patch.

这篇关于错误修补 Magento 1.7.1 Hunk #1 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆