问题描述
我在Magento信息中心v.1.7.0.2 (2 important security patches (SUPEE-5344 and SUPEE-1533)...)
Critical Reminder
通知因此,我在其他Magento(例如1.6.0
,1.6.1
)中下载并正确安装了它们,但在此版本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修补程序无法安装帖子,但是它对我不起作用
我在Windows,Mac和Linux上下载.sh文件,并且重新安装的方式相同...有什么想法吗?
我正在本地计算机上使用Windows.服务器当然是Linux.而且我使用Git进行版本控制.
长话短说:尝试使用dos2unix
实用工具来尝试获取.php文件的行尾以匹配.sh补丁文件. (我认为您也可以在.sh文件上运行dos2unix或在.sh文件上运行unix2dos-通过某种组合使它们相同).
尽管我认为您的错误消息与我的有所不同.实际上,您是否查看过拒绝文件"?如果这不是行尾故障,那么您能想到1.6和1.7安装之间有什么不同吗? (我使用此处描述的方法修补了1.7.0.2和1.9.0.1).如果您检查Graph.php文件,是否有任何编辑?
这里有更多关于对我有用的东西:
我使用了Cygwin(Gitbash似乎在Linux和Windows文件路径之间苦苦挣扎,并给出了错误/app/etc must exist
).另外,我还必须以管理员身份运行Cygwin来解决文件许可权错误(这很奇怪,可能对我的设置来说很独特).
但是我需要做的主要事情是在补丁试图进入diff
的文件上运行dos2unix
.我是通过编辑.sh补丁文件来做到这一点的,您可以在文件末尾看到具有将要更改的文件的路径.
所以我编辑了.sh文件,在注释# 5. File pathes
之前的第66行添加了这两行:-
# 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并手动编辑文件;变化不大.
补丁5344确实还有更多更改.为此,我在文件PATCH_SUPEE-5345_CE_1.7.0.2_v1-2015-02-10-08-11-22.sh
中的注释# 5. File pathes
之前添加了以下几行:-
# 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的答案来提出这个解决方案.看来"patch"命令对行尾非常敏感.您可能要尝试的另一件事是将-w标志添加到diff命令中(同样通过编辑.sh文件),这应该使diff忽略了行首和行尾的空格,但对我而言不起作用. http://unixhelp.ed.ac.uk/CGI/man-cgi?diff
作为最后的陷阱,我要注意,我需要通过重新运行Cygwin setup-x86.exe
'install or update'程序以将patch
命令添加到Cygwin,以添加包含patch
的开发包. /p>
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)...)
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
I was searching and I found this Magento patch failing to install post, but it didn't work for me
I download on windows, Mac and Linux the .sh file, and the resault is the same... Some ideas?
I am using Windows on my local machine. The server is Linux of course. And I use Git for version control.
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).
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:
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).
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.
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
You may want to consider a plan B and edit the files manually; there aren't that many changes.
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
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
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时出错,失败于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!