TCSH crashes only when in a TCC console

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Since a UNIX-like shell was mentioned in another thread, I thought I'd see how TCSH was working (after a long time). I'll make a long story short. TCSH's built-in "title" command (set the console title) crashes TCSH like this (ONLY if TCSH was started by TCC).
v:/> title foo
title: No match.
free(0x7fbd7748) bad block. (memtop = 0x7fc0f000 membot = 0x7fbb0000)
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
(along with a message box: "tcsh.exe has stopped working)
This does not happen if TCSH was started by a stand-alone CMD, by a stand-alone PowerShell, or by a CMD started by TCC. The story is odd for TCSH started by a PowerShell started by TCC. If I had not manually set PowerShell's title ($Host.UI.RawUI.WindowTitle = "some title") then TCSH will crash as above. If I had manually set PS's title, TCSH's "title" command works OK.

I can't imagine why being in a TCC console would make a difference. FWIW, here's TCSH's "dotitle" code.
void dotitle(Char **vc, struct command * c) {
    int k;
    char titlebuf[512];
    char errbuf[128],err2[128];
    char **v;
    vc = glob_all_or_error(vc);
    cleanup_push(vc, blk_cleanup);
    if ((k=GetConsoleTitle(titlebuf,512) ) != 0) {
    v = short2blk(vc);
    cleanup_push((Char **)v, blk_cleanup);
    for (k = 0; v[k] != NULL ; k++){
        __try {
            StringCbCat(titlebuf,sizeof(titlebuf)," ");
        __except(GetExceptionCode()) {
    if (!SetConsoleTitle(titlebuf) ) {
    cleanup_until((Char **)v);
void docls(Char **vc, struct command *c) {
I found where TCSH's "title" command is crashing, in the "setcopy" function below (not in "str2short").
    if ((k=GetConsoleTitle(titlebuf,512) ) != 0) {
That's entirely CRT stuff (TCSH setting the shell variable "oldtitle"). There appears to be some very, very strange CRT anomaly that's vaguely related to TITLEPROMPT.

TCSH's "title" command does not crash if I start TCSH like this
title foo & g:\tcmd\tcsh.exe
And TCSH does not misbehave if I start it from a TCC where TITLEPROMPT is not set. So it would seem to be the case that something in the RTL prevents TCSH's "title" command from working correctly if the last TCC title was set via the TITLEPROMPT mechanism. It's very strange, but I have tested it thoroughly. I remember a couple years ago when TCMD's crashing at shutdown was mysteriously related to the TITLEPROMPT mechanism.
Never mind. It is entirely TCSH's problem. My TITLEPROMPT contains "[%_PID]" and when saving the old title, TCSH crashes when trying to de-reference (not sure why) the bracketed string inside. I reported the issue. Actually I had reported the crash 4 years ago but at that time I didn't know what caused it.