The Old Dog found a bug in Mephisto the other day and found that the author, Rick Olsen, had already posted a remedy on his Google Group. He's a fine fellow, young Mr Olsen, and his bug fix was succinctly expressed as follows:
$ cd /path/to/mephisto
$ curl http://pastie.caboo.se/11620/text | patch -p0
Well I can do the cd bit OK, that uses one of those antidiluvian CMD windows that I so abhor but what's all this curl and patch business? Well, it turns out that they are two very useful utilities that are not native to Windows so I have gone fetch.
1. Curl
Curl, or cURL to be precise, is a simple command-line utility that goes and fetches the contents of a URL. Originally written by Daniel Stenberg, it's very useful as component of other higher level utilities and has an impressive set of options. The Win32 version can be downloaded at the download page but be warned that all you get is a ZIP file full of files and no clues what to do with them. I just bunged curl.exe into C:\Windows\System32 and it seemed to work.
The next problem you hit is that you need LIBEAY32.DLL but this isn't included in the download nor, as far as I can see, is it mentioned in the README. Remember that this is the download for Windows and yet an essential file is omitted as is any mention that you'll need it. And the README is issued as README not README.txt so don't expect it to open when you double-click on it.
Hey ho, let's get back to LIBEAY32.DLL. This is a Windows implementation of OpenSSL, needed to handle HTTPS. It's mentioned in the cURL FAQ but no link is given to it. The OpenSSL site doesn't provide a Windows DLL and the one on Sourceforge.net dates from 2003. So off we trot to Shining Light Productions's download page and grab v0.9.8c. Weighing in at an impressive 7Mb - and please recall, dear reader, that we aren't even trying to use HTTPS - this implementation puts itself into C:\OpenSSL not the Windows standard C:\Program Files. Do you know what to do when it finishes? Delete it. Delete the whole C:\OpenSSL folder. The only bit you need has been dropped into C:\Windows\System32.
Curl now works. Open a CMD window and type curl http://pastie.caboo.se/11620/text to see it at work.
2. Patch
The simple yet ingenious idea of Patch is that it takes standard diff output and applies the changes. It was written 21 years ago by Larry Wall, the daddy of PERL and one of the greats. So if you grab some diff output from somewhere (using cURL of course), you can apply it to your local files. Patch for Windows can be found on SourceForge too and has a proper install. However, on my PC at least, the presence of the executable in C:\Program Files\GnuWin32\bin doesn't do me a lot of good as that folder isn't on my path. I sighed, hurled patch.exe into C:\Windows\System32 and carried on.
Running patch gives some entertaining output:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 613 100 613 0 0 1480 0 --:--:-- --:--:-- --:--:-- 598k
patching file app/controllers/admin/articles_controller.rb
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 137 with fuzz 2.
So I guess that means it worked. I checked with the excellent Tortoise and the change had been applied correctly.
3. Grouse
Tortoise is an excellent example of open software being made beautifully usable on Windows. Patch, cURL and OpenSSL aren't. The people who maintain these packages give the impression that they don't give a toss about the Windows world and by doing so risk alienating a huge number of potential friends. Come on guys. So you don't like Windows. Neither do I as it happens. But you won't win hearts and minds by making our lives difficult. Not this difficult, anyway.
Comments