Friday, November 21, 2008

tcsh madness

Today I had a rather interesting experience with the tcsh.

At the university I attend are different computer pools. There's Windows (recently the machines have been upgraded to Vista), there's Solaris (recently upgraded to Solaris 9 I think) and there is Linux (recently upgraded to a newer version of Suse Linux, I don't know if it's the newest but newer than what was running there before). So obviously over the last summer holidays upgrade mania raged and the machines are all slow as hell. Well, maybe except for the Solaris terminals but I don't get to use them a lot anymore.

In one particular course we always visit the pool with the Suse machines. Fine by me. The default shell is tcsh. Every time I opened a new shell it would use all processor resources for about 10 seconds before showing me the prompt, hogging about 500 megs of RAM as well. I was used to the fact that the machines are slow but that is just ridiculous. It's a shell! But I didn't bother the last few times because in the time I have in the course I need to get some stuff done. Like listening to the professor, trying out stuff he talks about and playing Frozen Bubble. By the way: closing a shell would also take about 15 to 20 seconds.

Today I thought I could speed up the process a bit by spawning a couple of shells right at the beginning. It was only then that I learned about the insanely huge memory hunger as my RAM got used up and finally the machine started to swap. I barely could move my mouse anymore. So I started to look around a bit. At first I started a bash. In the blink of an eye it was there. Then I strace'd a new tcsh and got quite an impressive trace with 3.5 mb in size (compared to a few hundred kb of a new bash). I looked through it and found a lot of lines that resembled Linux commands. Could it be the history? Well yeah. I looked at my .history file and indeed it was about 26 mb in size. While I have to admit that a 26 mb history file is way too large I also fail to understand how anyone could make 500 mb out of it.

So there it was: tcsh read the history, did something with it and then continued. After closing the shell it would write the history back. This also caught me the first time when I deleted the history file. After closing the shell it was back of course. So I just closed all shells (which took quite some time), opended a new one, deleted that pesky file and killed the shell.

I'm a bit more used to bash but changing the shell with chsh didn't work either...