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
.