Reviewing svn changes

I have a habit of reviewing my changes before committing them to the repository. What suprises me is that so far I have only seen home-brewed scripts to perform a ‘batch’ review of all changed files. But ok, how difficult is that? So for my current project I came up with a similar solution. Here are some lines of bash script:


#!/bin/sh

# Find the list of changed files.
FILES=`/usr/local/bin/svn st | grep ^M | /usr/bin/sed ‘s/^M[ ]*\(.*\)/\1/’`
for FILE in $FILES; do
# Invoke favorite diff viewer to see the changes.
svn diff –diff-cmd /Users/oleksii/Scripts/diffwrap.sh $FILE
done

It could have been beautified a bit, but what a heck… BTW, the ‘magic’ diffwrap.sh’ looks like the following for me (use any other diff tool if you like, I just happen to use DiffMerge because it is available for all the platforms I am using now):


#!/bin/sh

DIFF=/Applications/DiffMerge.app/Contents/MacOS/DiffMerge

LEFT=${6}
RIGHT=${7}

$DIFF $LEFT $RIGHT

It should not be difficult to see which OS I am using here :).

Killing time with vsftpd

It seems that I am out of luck for the last 24 hours. I have tried to set up virtual ftp users for my server and seen the number of posts on this topic it should have been a piece of cake. I wish… Some good posts worth having a look though (and reading CAREFULLY!):

Several lessons on this topic:

  1. Make sure you have pam_passwd.so. By default it is NOT present on Ubuntu (at least 8.04). Get it by issuing

    sudo apt-get install libpam-pwdfile
  2. Don’t try to be smarter than you are. The following command (without -m switch!) do the trick with the passwd file:

    sudo htpasswd -c /etc/vsftpd/passwd user_name

Damn, was it worth sleepless 4 hours of headaches?

Getting wireless iface up and running on boot under Ubuntu 8.04

Well, this was driving me crazy for several days. My wlan0 interface was not getting ip address from my router, which was pretty bad considering that machine it supposed to be a server. After all I’ve started getting dreadful
WPA: EAPOL-Key Replay Counter did not increase - dropping packet
messages, which I couldn’t get at all.

Setup

  • Ubuntu 8.04 (server)
  • Linksys WMP54G PCI wireless network card (almost stopped trusting Linksys since this one); driver WinXP 64 bit via ndiswrapper
  • Linksys WRT54GL w/Tomato firmware (yeah, finally got to it and it is so much better than the original;

Issues

  • No IP address after restart on the host; the IP address is provided when doing manual
    sudo ifdown wlan0
    and then
    sudo ifup wlan0

Damn… that’s not how I want to run a headless server that I have planned to put somewhere in the house to get rid of the noise (therefore the wireless to make freely movable).

Tips & Tricks

  • Check if you’re running multiple wpa_supplicant instances by running

    ps ax | grep wpa_supplicant

    If so, stop them by issuing

    wpa_cli terminate

  • The following wpa_supplicant.conf worked for me

    ctrl_interface=/var/run/wpa_supplicant
    ctrl_interface_group=0
    eapol_version=1
    ap_scan=2
    fast_reauth=0

    network={
    pairwise=TKIP
    scan_ssid=1
    proto=WPA
    key_mgmt=WPA-PSK
    ssid="..."
    psk=...
    }

    And here is the reference to it in the /etc/network/interfaces:

    auto lo wlan0
    iface wlan0 inet dhcp
    wpa-driver wext
    wpa-conf /etc/wpa_supplicant.conf

    Finally, there was no luck in obtaining DHCP consistently, I have used the same hack as described in the Ubuntu WIFIDocs, and added the
    ifdown wlan0
    ifup wlan0

    to the /etc/rc.local :(. This works properly since it will be executed when the rest is properly started.

    p.s. This seem to be a known bug #53387, so I am not the only one spending my time for nothing. Welcome to the wonderful world of Linux (you have to set it up and you will be setting it up… forever…).