I ran into an interesting little subversion problem earlier. I was trying to commit a change, and the commit just seemed to hang indefinitely. I couldn’t sent an interrupt, and eventually resorted to killing the process. I tried all sorts of command line options in case there was an authentication problem – with no luck. I then thought I had made a mistake when switching my working copy to a different branch. I checked the logs on the server to find nothing pertinent; it seemed as though svn didn’t get as far as taking to the server. At a loss, I thought there was nothing for it but to run the command with strace. Bingo!
Strace showed that subversion reads from /dev/random as part of the commit, and that’s where the problem seemed to be happening. After doing some research, I discovered that /dev/random generates random numbers using the so-called entropy pool. This entropy pool is just random bits of noise generated from things such as mouse movements, time between keystrokes and so on. For whatever reason, on the client server, this entropy pool was empty! Using /dev/random is cryptographically more random than using /dev/urandom; and /dev/random blocks when the entropy pool is empty, whereas /dev/urandom is non-blocking. Moving /dev/random to /dev/random.old and linking /dev/urandom to /dev/random solved the problem. There may be a better solution to this, and depending on your cryptographic requirements it might be better to find an alternative, but this did the trick for me. One svn commit later and all was well.
Despite suppressing updates of my LAMP stack, the upgrade to Ubuntu 10.04 ignored that, and as such I now have PHP 5.3.X installed. Ordinarilly this woud be fine, but one of the open source web applications I work with doesn’t play well with PHP 5.3.X. I needed a simple way to revert to a previous 5.2.X version of PHP. The version in the Ubuntu 9.10 (Karmic) repositories would do the trick, so it was jsut a case of forcing Ubuntu to honour the 9.10 versions of various PHP packages over the 10.04 versions.
First, we get a list of all the currently installed PHP packages:
sudo dpkg -l | grep php > /tmp/php.packages
Next we remove the currently installed PHP packages:
sudo apt-get remove --purge $(dpkg -l | grep php)
Now we need to create an alternative sources list:
sed s/lucid/karmic/g /etc/apt/sources.list |\
sudo tee /etc/apt/sources.list.d/karmic.list
Having done that, we need to generate an aptitude preferences file for PHP:
This preferences file tells aptitude that for each listed package, we want to pin down the installation candidate to that from the Karmic repositories. We can now install the packages that we previously removed, but this time the versions from the Karmic repositories:
Having upgraded my Hardy distribution to Intrepd, I can say that I’m impressed. The changes to the desktop, although subtle, are very much welcome. I haven’t had any teething troubles with any of my hardware; the only ‘glitch’ I’ve noticed involves the title bars of open applications, it goes transparent now and then – but I’m sure I can put up with it until it gets fixed. Good work Ubuntu!
So, you need to take a copy of a subversion working copy, but it has local changes that you also need to copy. This precludes the use of `svn export` since the local changes won’t be included. One option is to do an `svn export` anyway, and then `cp -ra` the local changes. Another solution is to use a find command that excludes subversion metadata, and then copy the resulting files:
`find . -path ‘*/.svn’ -prune -o -type f -print`
I did something similar some time ago, but forgot the command, so here it is for posterity.