Currently HTK V3.4.1 can't load compressed HMMs and TMFs. The same problems arises for compressed lattices. If the wrong filename or path is given at the command line, a file descriptor is returned anyway and the program crashes when it tries to load it. The problem lies in the C popen() function which is used in HTK FOpen() function. This returns a file descriptor even if the file to be loaded does not exist (*). I propose a modification to V3.4.1 to handle this problem in a more general way (no need for the extra 'HMMCheckFilter' variable): 1) 'NoFilter' must be changed to 'HMMDefFilter' in InitXFormScanner() in HModel.c (2 occurrences!) 2) In HShell.h the 'wait.h' header file must be loaded if platform is not WIN32. This provides function WEXITSTATUS (**) that will be used in HModel.c [...] #ifdef WIN32 /* WIN32 modification */ #include #include #else x #include #include #endif [...] 3) in HShell.c, if platform is WIN32, WEXITSTATUS must be mapped to the identity function (***) [...] #ifdef WIN32 #define popen _popen #define pclose _pclose x #define WEXITSTATUS(status) (status) #endif [...] 4) in HShell.c change FOpen() function from: [...] if (FilterSet(filter,cmd)){ SubstFName(fname,cmd); f = (FILE *)popen(cmd,mode); *isPipe = TRUE; [...] to: [...] if (FilterSet(filter,cmd)){ SubstFName(fname,cmd); f = (FILE *) popen(cmd,mode); x if (WEXITSTATUS(pclose(f)) != 0) x f = NULL; x else x f = (FILE *)popen(cmd,mode); *isPipe = TRUE; [...] The above modifications allow to actually use the return value provided by FOpen() and to throw an error accordingly. Currently this is not always exploited in several HTK functions probably because of the unreliability of the return value. ---------------------------------------------------------------------- (*) this because popen calls fork() and pipe() and return an error only if the latter do. (**) this is POSIX compliant (***) popen under UNIX returns a value between 0 and 255, which is converted by WEXITSTATUS to 0 and 1. _popen under WIN32 returns -1 in case of failure.