The subversion source control system replaces certain keywords like $Id$ with some very useful metadata, if and only if the file in question is configured to do so. Normally, file properties are added automatically to subversion at the time the file is added. Unless..., unless there was a mistake. Mistakes happen.
Unfortunately, subversion is not very keen to discover and fix such inconsistencies. That's why I came up with this one-liner:
find . -name .svn -prune -o -type f | while read f; do if egrep -q '\$Id|\$HeadURL' $f; then test "$(svn pget svn:keywords $f)" = "Id HeadURL" || echo $f; fi ; done
This finds all files that contain the $Id$ or $HeadURL$ keywords anywhere in the text, and at the same time do not have the svn:keywords property set to "Id HeadURL".
You might be using other subversion keywords: just change the regexp and the property string accordingly.
This helped me a lot, lately, and I thought I wanted to share it.
2012-05-25
Static network configuration in Ubuntu 12.04 "Precise Pangolin"
After upgrading my Ubuntu to Pangolin, my DNS resolution would not work any more. The exact reasons are not of interest here, I am in a corporate environment with a complicated proxy setup. I must edit /etc/resolv.conf, and configure my static DNS settings there.
However, Pangolin keeps overwriting this file, replacing it with a symlink, and tries to be clever in destructive ways. After a bit of fiddling, I found that Pangolin installs and runs a local DNS server (dnsmasq) without asking. This may make sense in a mobile environment, but here in my static setup, this makes no sense. Get rid of it.
Next, keep Network Manger from overwriting my configuration. Edit /etc/network/interfaces thus:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.177
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
iface wlan0 inet manual
This works for me. When clicking the network icon in the panel, the items "wired network" and "wireless network" are greyed out. That's OK for me, ymmv.
However, Pangolin keeps overwriting this file, replacing it with a symlink, and tries to be clever in destructive ways. After a bit of fiddling, I found that Pangolin installs and runs a local DNS server (dnsmasq) without asking. This may make sense in a mobile environment, but here in my static setup, this makes no sense. Get rid of it.
sudo apt-get purge dnsmasq
rm -f /etc/resolv.conf
echo search mydomain.com > /etc/resolv.conf
echo nameserver 208.67.222.222 >> /etc/resolv.conf
echo nameserver 208.67.220.220 >> /etc/resolv.conf
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.177
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
iface wlan0 inet manual
This works for me. When clicking the network icon in the panel, the items "wired network" and "wireless network" are greyed out. That's OK for me, ymmv.
double colons in Bourne Shell function names
Bourne shell does not like double colons ("::") in identifiers. Other shells, e.g. bash, have no problems with them, and programmers like to use them for generating a pseudo-namespace look.
A problem arises when I want to write an include file that works for both, bash and sh.
Here is a workaround that lets me define function names in Bourne Shell with double colons in their name:
function foo__bar() {
...
}
alias foo::bar=foo__bar
A problem arises when I want to write an include file that works for both, bash and sh.
Here is a workaround that lets me define function names in Bourne Shell with double colons in their name:
function foo__bar() {
...
}
alias foo::bar=foo__bar
2012-04-10
ext2fs_check_if_mount: No such file or directory
My mke2fs suddenly started to print this error:
ext2fs 1.40.2 (12-Jul-2007)
ext2fs_check_if_mount: No such file or directory while determining whether /dev/sda1 is mounted.
(It's a very old binary, see, it's not mke2fs that broke.)
This and similar sounding error messages can have various causes. In my case, it was a missing /etc/mtab.
I fixed it with
ln -s /proc/mounts /etc/mtab
ext2fs 1.40.2 (12-Jul-2007)
ext2fs_check_if_mount: No such file or directory while determining whether /dev/sda1 is mounted.
(It's a very old binary, see, it's not mke2fs that broke.)
This and similar sounding error messages can have various causes. In my case, it was a missing /etc/mtab.
I fixed it with
ln -s /proc/mounts /etc/mtab
2011-11-14
Solaris 11 default route
Q: How to add a default gateway on a Solaris 11 system?
A:
Explanation: If you happened to be a Solaris administrator since version 2.3, like me, you were used to create a file
But not any more! The "route -p" certainly is a good thing, I'll remember that.
A:
route -p add default 192.168.1.1
Explanation: If you happened to be a Solaris administrator since version 2.3, like me, you were used to create a file
/etc/defaultrouter
But not any more! The "route -p" certainly is a good thing, I'll remember that.
2011-11-08
flatten a gnu tar archive
Problem:
I have a tar file with a deep directory hierarchy but only some files in it. I want to extract the files into my current directory and not care for subdirectories. Filenames do not conflict. The gnu tar option --remove-components does not handle this well.Solution:
Fortunately, there is a very general gnu tar option --transform:tar --extract --transform='s/.*\///' --show-transformed-names --file=foo.tarThis deletes pathname up to the first slash character, resulting in the desired effect.
Example:
$ mkdir -p a/b/c/d/e/f/g/h/i $ echo "hi there" > a/b/c/d/e/f/g/h/i/foobar $ tar cvf foo.tar a a/ a/b/ a/b/c/ a/b/c/d/ a/b/c/d/e/ a/b/c/d/e/f/ a/b/c/d/e/f/g/ a/b/c/d/e/f/g/h/ a/b/c/d/e/f/g/h/i/ a/b/c/d/e/f/g/h/i/foobar $ tar --extract --transform='s/.*\///' --show-transformed-names --verbose --file=foo.tar a b c d e f g h i foobar $ cat foobar hi there
2011-03-03
Repairing Windows XP
Repairing Windows XP (e.g. because disk was moved into new box).
- first make sure the administrator account has a password
- download the latest service pack and current patches to disk, e.g. with the help of a Linux live system
- make a backup copy of %SYSTEM32%\WPA.DBL and WPA.BAK
- boot from Windows CD, preferrably a recent one
- you may have to enter the administrator password
- select install (not "R" for repair console)
- select repair ("R")
- if installation of some files fails with a bogus error message, skip
- if you can not boot any more, try to boot safe mode
- install service pack and pachtes (may replace files that you skipped before)
- restore WPA ("Windows Product Activation") files
- check activation state: oobe/msoobe /a
Subscribe to:
Posts (Atom)