First post, by romek41
Hi there! I have found a bug in a DOSBox shell. In my dosbox.conf file, in the [autoexec] section I've got only two lines, similar to this:
mount -t dir c /path/to/my/c/directory
set PATH=z:\;c:\;c:\dn;
In the 'DN' directory I've got DOS NAVIGATOR installed (there is a file called DN.COM in the DN directory), all the games are in subdirectories in 'GAMES' directory. After starting DOSBox I type:
Z:\>c:
C:\>cd games
C:\GAMES>dn
This should obviously launch DN.COM located in the C:\DN directory, but instead of this it just says:
Illegal command: c:\dn\c:\dn\c:\dn\c:\dn.COM.BAT.EXE.BAT.BAT.BAT.
My system is Aurox Linux 9.1 (polish Linux distribution, based on RedHat 9.0, with the same kernel, glibc and gcc binaries) on ext3 filesystem, DOSBox 0.61 (but this bug still exists in CVS version I've downloaded not so long ago), Athlon XP1800+ with 256MB RAM. I have tried to investigate this bug myself and I think it exists in method 'localDrive::FileExists' in file 'drive_local.cpp'. The problem is, that Linux (unlike Windows) treats directories like normal files, you can even fopen it (and I think this is the reason, why I couldn't reproduce this bug using Windows...). Let's change this function a bit:
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
bool localDrive::FileExists(const char* name) {
char newname[CROSS_LEN];
struct stat temp_stat;
strcpy(newname,basedir);
strcat(newname,name);
CROSS_FILENAME(newname);
dirCache.ExpandName(newname);
if(stat(newname, &temp_stat)!=0) return false;
if(S_ISREG(temp_stat.st_mode)) return true;
return false;
}
Now it seems to work correct (well, I hope it also works under Windows 😀.
Roman Standzikowski <romek41 at interia dot pl>