TCSH crashes only when in a TCC console

May 20, 2008
Syracuse, NY, USA
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) {
May 20, 2008
Syracuse, NY, USA
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.
May 20, 2008
Syracuse, NY, USA
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.
Similar threads
Thread starter Title Forum Replies Date
vefatica TCSH problem (was ...) Support 8
Jay Sage TCMD Crashes with "tctoolbar /c /r file" Support 5
S Take Command crashes for aliases with length > 1015 Support 1
C Fixed V25 crashes when adding and then removing in the tabbed toolbar Support 3
S tcc crashes Support 3
L FTYPE crashes TCC v23.00.30-34 Support 17
A Fixed [23.0.22]: TCMD crashes shortly after start, TCC keeps running in background Support 6
vefatica TPIPE.EXE crashes on Ctrl-C Support 9
D Chaining crashes the debugger Support 13
Mike Applebee SHRALIAS crashes on startup Support 2
vefatica TPIPE crashes on Ctrl-C Support 1
M TCC Crashes... Support 3
vefatica IDE crashes every time Support 6
MickeyF TCC v16 crashes when I hit F1 to view help Support 9
cgunhouse Version 19.00.23 Crashes Support 16
G Linux curses (full screen) crashes TC Support 1
MickeyF BDebugger crashes Support 2
T Closing multi-tab TCMD crashes Support 4
M tcmd crashes in this recursive "for /f" loop Support 4
S Fixed TC crashes with a certain batch file Support 6
vefatica DATEMONITOR + Ctrl-C crashes TCCv15 Support 5
A WAD Dir daterange + multiple path wildcards crashes tcc Support 2
M WAD tcmd.exe crashes and leaves an orphaned tcc.exe process Support 6
Peter Murschall TCC 13.03 Build 30 crashes on VER /R Support 15
D ftp crashes tcmd v12.11 and 13.01 Support 10
H Ruby - Running External Ruby script crashes TCC Support 11
gschizas Take Command crashes with TELNET Support 9
T eval[] crashes with negative binary output Support 1
S Crashes when using SFTP Support 7
krischik ERASE crashes TCC Support 10
krischik SYNC crashes TCC Support 6
nikbackm Piping to new TCC instance crashes it Support 1
rfaquino TCMD 12 always crashes when exiting Support 7
cgunhouse IDE Crashes on Exit Support 6
I TCC crashes on gosub after long command line Support 0
D Strange crashes in @CRC32 and @MD5 Support 9
gschizas pdir crashes horribly in one specific folder Support 5
Ville BUG: 'dig' of bind 9.6.0 P1 crashes when used with TC10 Support 6
Phileosophos TCMD 10.00.57 crashes for want of python26.dll Support 5
C for /r %s crashes TCC Support 3
P PSHELL not working in TCC 26 Support 9
vefatica SCRIPT makes TCC disappear. Support 16
MickeyF TCC suddenly crashing (not TCC's fault) Support 2
Z CMDDebug - TCC unknown command Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 28.02.17 Support 0
vefatica TCC startup: /IP not honored after /K Support 1
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
C COMSPEC constantly reset to TCC.EXE Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
C How to? starting TCC/TCMD v25 Support 2

Similar threads