Monday 13 June 2016

Dangerous design flaw in wordpress

Wordpress insists on storing fully qualified URLs all over the place. Especially in the database. This means that if you restore a backup of a wordpress installation onto another machine (a test/dev machine for example), you can unexpectedly end up being switched to the live site at any moment.

Add to this the fact that as previously complained about, the whole thing is stored in the database, so you are logging into a dev machine with the same user account as live, and the potential for catastrophe is huge.

Monday 6 June 2016

fun with recursive chown and dotfiles

 rm -rf .*  
removes all hidden subdirectories and their contents, but generates an error and does nothing when it tries to remove '.' and '..'
I've always just accepted that behaviour without thinking. I now discover that it's the wrong thing to do. I discovered this by doing
 chown -R codehare:codehare .*  
This has a very unexpected effect. A very bad, very unexpected effect. It chowns everything that matches .* (i.e. hidden directories) in the current directory, then it starts in the parent directory and recurses through all subdirectories of that. This is not good news. Especially if you do it as root/sudo. Especially if you do it in a home directory. Especially if you use key based authentication.

Well that was a fun start to the week...