Broken WordPress: debian unstable is called unstable for a reason

Update: The maintainer of the wordpress package released “my” bugfix. It’s available now for those using unstable (sid). I guess it will be available in testing (lenny) soon, since the bug is listed in the release critical bugs list. To bad he credited me with the name Del Gurt, but well… The only thing I did was finding the missing methods in WordPress 2.6. But it’s my first fix in Debian, yeh.

I just ran an apt-get update + apt-get upgrade and after that my WordPress homepage was broken when I’m logged in, it gives a nice "Fatal error: Call to undefined function admin_url() in /usr/share/wordpress/wp-includes/link-template.php on line 470". And so is it for all people using the debian unstable package for WordPress, for example this guy.

I quickly searched what functions where missing and created a patch and submitted it to the related debian bug. I hope they will accept it soon, but well. My WordPress works fine again now.

Creating a patch took me a while, since I never created a patch for a debian package before. Lucky me, there are tutorials on how to create patches for debian packages, so I just had to read up on that. I read about how to submit the patch in the tutorial on how to help squashing Release-Critial bugs.

And I had to read up on dpatch, because the other patches on WordPress where created using that. Lucky me, someone has created a nice short tutorial on how to use dpatch already. Dpatch seems like a good way to keep your patches separated from the original code, so when the original code is updated, you can determine easily if that conflicts with your patches or not.

And then I had to create a GPG key to sign my patch. Since dpkg-buildpackage complains about it otherwise.

So in the end, what I had to do to patch my WordPress and submit the patch (besides generating the GPG key):

Install the required tools
sudo apt-get install build-essential devscripts lintian linda diff patch patchutils dpatch
Get the WordPress package source
apt-get source wordpress
Enter the root directory of the extracted source
cd wordpress-2.5.1
Let the package know I’m making the changes
dch -i
Start the dpatch process
dpatch-edit-patch 009CVE2008-3747.addendum
Make the changes
Exit dpatch process
exit
The wordpress patches are all called .patch so rename it
mv debian/patches/009CVE2008-3747.addendum.dpatch debian/patches/009CVE2008-3747.addendum.patch
Change the e-mail address in the patch
EDIT debian/patches/009CVE2008-3747.addendum.patch
Add the patch to the list of patches
echo "009CVE2008-3747.addendum.patch" >> debian/patches/00list
Test the patch
fakeroot debian/rules binary && sudo dpkg -i ../wordpress_2.5.1-6.1_all.deb
Build the source package
dpkg-buildpackage -kMYKEY -rfakeroot
Create the patch
interdiff -z ../wordpress_2.5.1-6.diff.gz ../wordpress_2.5.1-6.1.diff.gz > ../bug_497524.patch
Email the bugs list with the patch
Email bug control to inform them that a patch has been made for the bug

That was it. Not that hard, if you know the commands + procedure. Now wait and see what the package maintainer is going to do with the patch I created.

Update: seems I forgot to check the edit link itself after the fatal error was gone… It didn’t work anymore. Fixed that as well now.

Update2: for those who find my post and do not want to wait on the maintainer to release the patch, I’ve “released” it. The MD5 of wordpress_2.5.1-6.1_all.deb is: dc46d35743122d933def7db431c8f49e.

Eclipse Subversive SVN+SSH and Putty Agent (pageant)

I’m using Subversive within Eclipse to provide SVN support. But since I’m now using SVN+SSH as connection mechanism to SVN, I wanted to use my SSH Key to do the authentication for me. It took me some time to find out (find with google ;) how I could get this to work. I ended up on another blog which contained a working explanation on how to get it to work.

You need to create an environment variable called “SVN_SSH” that points to an executable file that accepts the same command line arguments as ssh on unix. I did this by doing the following:-

  1. Set up ssh keys. Not going to cover that here as you can easily Google for that. You need to end up with your public key on the SVN server and your private key loaded into Paegent locally.
  2. Download and installed the excellent TortoiseSVN client for Windows.
  3. Set the following environment variable (by right-clicking on My Computer, Properties, Advanced, Environment Variables, New):-

    Variable name:
    SVN_SSH
    Variable value:
    C:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe

    (The “\\” is very important, otherwise it won’t work. Equally, you cannot use the plink.exe that comes with putty as that fires up a command shell window which is really annoying. The TortoisePlink.exe is a windows implementation of plink that doesn’t bring up any UI)
  4. Configure the Subclipse plugin to use JavaHL (JNI)
  5. Restart Eclipse
  6. Do a little victory jig (optional)

Yes the \\ is really needed, don’t (yet) understand why, but it works.

If you dislike Tortoise, then you can set the SVN_SSH variable to c:\\putty\\plink.exe -ssh -2 -A -l username

But as Martin said, plink has one disadvantage. It creates a msdos popup window each time it’s used…

JavaHL is also needed, SVNKit doesn’t use the SVN_SSH variable.

Talking about Tortoise… A while ago I encountered some annoying lock problems (maven clean install didn’t work because maven was not allowed to delete the target directory). This was caused by the Tortoise cache. Now I disabled it in total, which helped against my locking issue, and the performance of my explorer increased as well. So it’s a win/win situation. And since I like to develop using Ubuntu, I’m not used to see the svn status in my explorer window right away anyways (although I’ve to say, it can be useful, if it didn’t cause problems I would have kept it).

Perhaps this locking problem is related to having my workspace on an ext2 fs partition on my usb drive… Not sure who to blame, yet. On my new workstation I’ve not had such locking problems yet, with this tip the cache is performing good enough.

Changing spell checker language in Camino on OS X 10.4

From time to time I use my mac-mini to blog. But the spell checker of OS X is defaulted to Dutch, which is quite annoying if you try to blog in English. And I found that it’s not easy to change the language. In the end I found a FAQ entry (why didn’t I check the site before…) about how to change the spell checker language in Camino. Guess it’s time to switch to 10.5 :-)

Followup on the Belkin F5D8053 and Ubuntu

Seems my previous blog post about the Belkin is found quite often when people search for how to get it to work on Ubuntu in general, also with ndiswrapper. Please note, my post is not about getting it to work with ndiswrapper (that worked fine in my case, but I’m on 32-bit Ubuntu, and didn’t try it on 64-bit). There are quite some posts about getting it to work with ndiswrapper (also posts about it not working, will drop him a comment). This one also explains how to unpack the windows driver if you don’t have a windows installation.

Anyway, so far about using ndiswrapper. Recently ralink released a new version of it’s native linux driver, 1.3.1.0 which can be found on their linux support page, and with this one I got the Belkin F5D8053 working. It doesn’t see the 5Ghz network I’ve over here, but well I don’t want to do normal Wireless over that network anyways, since that will decrease the speed of the Wireless to Wireless bridge I setup. I’m still blaming incompatibility between the Belkin USB stick and the Apple Airport routers for the Belkin not being able to find the 5Ghz network.

What I had to do to get it working.

1. make sure you can build kernel modules: sudo apt-get install build-essential linux-headers-generic
2. check if your Belkin USB id is listed in the driver: lsusb | grep Belkin | awk '{print $6}';, which returns 050d:815c in my case. Then use the id found in grep -i '0x050d,0x815c' include/rt2870.h if that returns a result, then skip step 3 since your device is already supported by the driver (please note the '0x' added before the 2 parts and the ',' in stead of the ':').
3. If it’s not there add it: edit include/rt2870.h Search for Belkin; Copy/Paste that line and change the usb id of your device to that you found in step 2.
4. Edit os/linux/config.mk and change the HAS_WPA_SUPPLICANT=n HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n to =y.
5. Edit Makefile and remove any line containing /tftpboot (still don’t know why they are in there, and running make as normal user fails if they are in there)
6. make && sudo make install
7. Edit (as root) /etc/modules and add rt2870sta to it (remove ndiswrapper if you used that before to get it working).
8. Either reboot or do modprobe rt2870sta to get it working (if you used ndiswrapper before you first need to run modprobe -r ndiswrapper). You will also need a /etc/init.d/networking restart if you won’t reboot.

That was all I needed to do.

Debugging mails being send from applications

Ever needed to test the e-mail functionality of your application, on windows, without having access to a SMTP server? Try SMTP server for developers, a brilliant piece of software, so far.

You need .Net for it. It’s really easy to setup and use. Another advantage of this SMTP server is that when you test your application, you don’t have to worry about test e-mails being send to customers. This because the SMTP server doesn’t really send the messages, but just places all of them on disk.

Update: one disadvantage. You can’t get it to run on any other port then 25, which is inconvenient if McAfee is blocking port 25. I contacted the author a while ago, but no response so far. Guess I’ll have to add this functionality myself, but then I need to get up to speed on .Net first. Ah well, I’ll wait a little longer.

Talking about McAfee… It’s kinda weird, it blocks e-mails on port 25 if I use for example Java to send the e-mail. But if I use telnet to connect to port 25, all is fine?

Keyboard shortcuts

Perhaps you have noted that I added a new site to the list of sites I like: Windows Keyboard Shortcut of the Day. Using keyboard shortcuts just improves your work speed a lot.

A few windows shortcuts that I didn’t know before

Windows + BREAK
Go to system properties
CTRL + SHIFT + ESC
Taskmanager
Windows + R
Run command

Eclipse

I also found a nice blog entry about eclipse shortcuts. But he lacks to explain one of the uses for CTRL + T: if you have a certain function you can find which class implements that function with CTRL + T as well. Very useful when you are working a lot with interfaces.

This is also a good site with Eclipse shortcuts. Not sure if it’s a bad thing that it’s not updated to Eclipse 3.4, yet. One helpful command is missing on that list: CTRL + SHIFT + L. This lists all bound keyboard shortcuts and pressing it again gives you the opportunity to change and export them to .csv (at least the export function is there on Eclipse 3.4).

Mac OS X

And a while ago I found a nice site with lots of Mac OS X keyboard shortcuts. The shortcut to make your mac sleep quickly was provided by me :-) There is also a shortcut to restart your mac quickly without confirm, Cmd + Ctrl + Eject. Quite annoying if you use that one when you want to put your mac to sleep.

Quick status update

So, I’ve been inactive for a while now. With the new job and moving to a new place my time to blog has been very limited. I’ve been preparing some more drafts (the number of drafts is now bigger then the number of posts… Guess I should do something against that).

So, in short an overview of what has been keeping me busy (besides moving and getting used to the new job).

Wireless bridges

Trying to get a wireless to wireless bridge. Since I didn’t want to drill some more holes in my new place, I wanted a wireless to wireless bridge from the closet down stairs to my room upstairs. At Dynabyte they sold me a Belkin wireless N1 router which should, according to them, be able to create a wireless bridge with my Belkin wireless N router. “Of course” that didn’t work, so In the end I settled for a combination of an airport extreme and an airport express, which works perfectly. Even though 1 month had passed, the Dynabyte accepted the return of the N1 router, which is nice of them. And, fortunately for me, the N router has it’s use as well. I’m using it now as an access point, since I’m not able to get my Belkin USB stick to connect with more then 65Mbit to my Airport… And well, it’s better to have the wireless bridge at 5Ghrz and since my mac mini doesn’t support 802.11n I need a non 5Ghrz wireless network as well (oh, that Bekin USB stick doesn’t find the airport at 5Ghrz either, guess that’s why it’s still called Pre-N…)

IPv6

Having to switch to two airports had a nice side effect. I’m now able to use IPv6, which is a good thing IMHO. If only to be able to see the nice animated google logo on http://ipv6.google.com ;-)

APT-Cacher

I was always using apt-proxy to be able to update multiple debian based systems faster, since you only need to download the packages once that way. But a while ago apt-proxy stopped working so I went looking for an alternative. That alternative has become apt-cacher. More on this will follow later.

Quartz Scheduler

For the new job I’ve been looking at Quartz Scheduler, a cluster aware job scheduler. It looks nice, but the cluster features seem to be very limited. I’ll post something about this once the solution is completed.

Changing the <title> of my blog

And last, the page tittle on the blog has been changed a bit. I don’t want it to start with my blog name, since that makes the google results harder to read. So now it starts with the title of the blog entry, and then the name of the blog. It wasn’t that hard to change it, I just had to alter the header.php of the theme. I used this blog entry as a basis and then did my own “magic” with the header.php file and turned the default <title> into

<title><?php 
if (is_home()) {
        bloginfo('name');
        echo " &raquo; ";
        bloginfo('description');
} else if (! is_single() && ! is_page()) {
        wp_title('');
        echo " &raquo; Blog Archive &raquo; ";
        bloginfo('name');
} else {
        wp_title('');
        echo " &raquo; ";
        bloginfo('name');
}
?></title>

The '' in the wp_title call is needed to override the default » that is put before the title otherwise.

Trying to get the Belkin F5D8053 v3 to work on Ubuntu Hardy without ndiswrapper

Update: I got it working now, see my new post about it.

If I look at the Windows driver for my new Belkin F5D8053 it is based on the RT2870 chipset. There is a native driver available for this chipset. Unfortunately so far I’m not able to get it to work. This version is already linux 2.6.24 ready so I don’t need to apply these patches. But even though I’m able to compile it, I’m not able to use it, yet. Side note: the warning in the Ubuntu forums about backing up any existing configurations in /etc/Wireless/RT2870STA is useful, since you need to put your configuration in there and it’s removed by the make install.

One strange thing in the make process is that it wants to copy the result to /tftpboot. I’m not sure why it wants to do that, and I’m almost certain it shouldn’t be a part of the make process…

The first problem I ran into was the fact that the USB Device id for my Belkin, 050D:815C, is missing in the driver (that could be a big hint about it not being able to work for it …) so I added that to the include/rt2870.h (I copied the line for the other Belkin device and changed the device id into mine).

With that added, my Belkin is detected by the driver as ra0. But even when I compile it with:

HAS_WPA_SUPPLICANT=y
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y

I’m not getting my device visible in the gnome network manager, so I tried the command line configuration options.

First I tried only configuring the /etc/Wireless/RT2870STA/RT2870STA.dat. But if I had only that file configured, the activity light was turned off on an ifup ra0. So I guess that’s not right.

Then I tried to configure it in the /etc/network/interfaces as described on the Ubuntu forums. The light staid on when I did ifup ra0 but no DHCP lease. So finally I tried the “iwpriv” way described here. But still no DHCP lease.

So I guess I’ll have to contact ralink, to see if they are able to help me out here.

VMware and Virtual PC images continued

A few days ago I wrote about VMware and the Virtual PC images. I said that it’s not a problem that you don’t have the Windows CD, and that you just had to press cancel when requested.

This was only true for the IE6 image. The IE7 image needs the CD. Without it, it won’t work properly. Now after I used it for IE7, I thought, well lets do that with the IE6 image as well so all is installed properly. How stupid can I be…. With the IE6 image when the mouse driver is installed, it’s no longer working properly!

But, I did another re-install from the converted images while I was writing this post, and guess what: if you wait long enough after the first boot, windows will request a restart even though there is an software install box waiting for you. If you just ignore the software install box, and restart the system, the problem with the mouse is gone.

Oh, another thing. The fix that is needed to be able to compile the kernel module can be applied before you install VMware. I used the following steps for my second install of VMware (using my version didn’t work since I’m on X86_64 and my colleague is on i386).


tar xzvf VMware-player-2.0.3-80004.i386.tar.gz
cd vmware-player-distrib/lib/modules/source
chmod u+w vmmon.tar
tar xvf vmmon.tar
vi vmmon-only/include/vcpuset.h
change line 74 from: #include "asm/bitops.h" to: #include "linux/bitops.h"
tar uvf vmmon.tar vmmon-only/include/vcpuset.h
rm -r vmmon-only
cd ../../../
sudo ./vmware-install.pl

PHP Acceleration with eAccelerator

With high traffic sites, performance issue’s rise. Now one of the solutions is to use an opcode caching mechanism for PHP. There are two mainstream open source solutions for that, APC and eAccelerator. And there is Zend platform and Zend core.

Installing eAccelerator
I found a very straight forward howto about installing eAccelerator (and others) on Debian.

But, as always, there are some problems with that tutorial. First the -- is replaced by a special character on that tutorial (and in my blog if I don’t use the <code> tag) in the configure command, so that doesn’t work if you copy paste it. The working configure command is:


./configure --enable-eaccelerator=shared --with-php-config=/usr/bin/php-config

And you don’t need to do all the work as root, only the apt-get, the make install and the php.ini editing should be done as root (best practice, only use root privileges when needed).

Also the double quotes are changed into a special character in that tutorial, so if you get an error in your logs about unable to load \xe2\x80\x9deaccelerator.so\xe2\x80\x9d you copied them just like I did ;-)

This is what I put in the php.ini, without the special double quotes, and with one change


extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

The tutorial writer creates the cache directory in /tmp. But he fails to make the remark that /tmp is cleared on server restart. So that’s not really a good option. So I’ve done the following in stead


sudo mkdir /var/cache/eaccelerator
sudo chown www-data /var/cache/eaccelerator
sudo chmod 0755 /var/cache/eaccelerator

Yes, the 0644 from the eAccelerator wiki is what you want for the files being created in there, but not for the directory itself.

The big disadvantage of this way of installing it, is that you probably need to recompile it (after a make clean) and reinstall it on every update of PHP. But reading up on APC vs eAccelerator made me choose for the latter.

But does it really help?
Now, the results. What better to test then my own PHP blog (and yes it’s not the fastest one, it’s running on a VPS).

Before installing eAccelerator:

Server Software:        Apache/2.2.8
Server Hostname:        blog.delgurth.com
Server Port:            80

Document Path: / Document Length: 44436 bytes
Concurrency Level: 10 Time taken for tests: 397.121299 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 44796000 bytes HTML transferred: 44436000 bytes Requests per second: 2.52 [#/sec] (mean) Time per request: 3971.213 [ms] (mean) Time per request: 397.121 [ms] (mean, across all concurrent requests) Transfer rate: 110.16 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.3 0 6 Processing: 712 3961 1674.7 3696 10696 Waiting: 368 2177 1013.3 2033 6943 Total: 712 3961 1674.7 3696 10696
Percentage of the requests served within a certain time (ms) 50% 3696 66% 4454 75% 4977 80% 5270 90% 6225 95% 7039 98% 8188 99% 8632 100% 10696 (longest request)

After installing eAccelerator

Server Software:        Apache/2.2.8
Server Hostname:        blog.delgurth.com
Server Port:            80

Document Path: / Document Length: 44436 bytes
Concurrency Level: 10 Time taken for tests: 242.584585 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 44796000 bytes HTML transferred: 44436000 bytes Requests per second: 4.12 [#/sec] (mean) Time per request: 2425.846 [ms] (mean) Time per request: 242.585 [ms] (mean, across all concurrent requests) Transfer rate: 180.33 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.2 0 4 Processing: 430 2419 983.2 2330 6409 Waiting: 100 648 448.6 578 3025 Total: 430 2419 983.2 2330 6409
Percentage of the requests served within a certain time (ms) 50% 2330 66% 2798 75% 3051 80% 3246 90% 3712 95% 4182 98% 4614 99% 4901 100% 6409 (longest request)

So it helps also quite a bit on my wordpress install, it’s about a 33% performance increase!

Some material I read

P.s. yet another wordpress rant, if you have empty lines between <code> tags, wordpress inserts <p> tags there for you. Not very nice to my liking, since it breaks the formatting of the <code> tag, which I used to format the apache bench results…