history file grows indefinitely

1

I believe I get the same problem as this guy. I'm on AIX, with tcsh 6.12.00

After (probably) a bad logout, the history file exponentially grown, until the quota stopped it (and when the quota was hit, several others problems occurred with batch jobs that couldn't run because of that). The content of the history file was just:

 9917 host: path > 
    Use "logout" to logout.

repeated for ever and ever (~50 millions times, actually). Note that

host: path >

is actually the prompt (which I obfuscated a little bit to avoid spammers).

Now, there are two (possible separate) problems that happened:

  1. why that output went to the .history file (instead that -say- my screen when I exited)
  2. why the savehist limit was not enforced (it was 5000 so it should never reached 9917)

The only thing I can think is of a process whose stdout (or err) was redirected there, but this is really odd! Do you have any clue about this problem?

Unfortunately I cannot reproduce the problem at will, which would help debugging.

EDIT: yes this happened with a remote (ssh) login, done from a X terminal emulator in Linux (the remote machine is AIX, the local linux)

EDIT: the only thing I can think is a bug in tcsh, which, in case of something "bad" occurring to the tty, mistakenly use the .history file descriptor, which it was supposed to be open just to update the history. But is it the case? There isn't anything mentioned here

Davide

Posted 2009-10-14T17:17:57.763

Reputation: 625

Answers

1

No definite answers here, but a couple random ideas that may or may not help:

The phrase "Use "logout" to logout." sounds a lot like tcsh got a EOF (^D) character and didn't like it, asking for you to type 'logout' instead. So where did all these (hypothetical) EOFs come from?

Are you, like the person having a problem with this in Cygwin, using the shell via an X terminal emulator of some kind (xterm, rxvt, whatever)? I'm wondering if what is happening is the terminal emulator closes, thus closing the ptys that the shell process is connecting to, which causes the shell to read an 'endless' series of EOF characters, at which point it twirls off into infinity. Maybe there is some kind of race here, where the term window closes up shop before actually notifying the shell that the session is complete?

One thing to try would be figuring out a) if tcsh in your configuration actually does accept (or reject) EOF for logging out, and b) if rejecting, figure out the toggle for allowing it.

I know this is speculative at best, I don't use tcsh and my knowledge of X internals and tty emulation is (thankfully for my sanity) rather minimal. But a scenario like this seems plausible, anyway.

Jack Lloyd

Posted 2009-10-14T17:17:57.763

Reputation: 346

Thanks for your answer (I edited my question with details about your comments). I was already suspecting something like that, but this does not explain my points 1 & 2 above. I'll give it a try, but since I'm unable to reproduce the issue I can't be sure that I solved the problem. – Davide – 2009-10-14T20:12:33.870