VOGONS


First post, by Dwedit

User metadata
Rank Newbie
Rank
Newbie

I don't know whether this happens in all versions or just the CVS build I tested it in, but executing the command "con" freezes the shell with no way to exit. Ctrl+C or Ctrl+Z won't get out.

http://www.dwedit.org/

Reply 2 of 20, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Doesn't happen for me. Tested 0.72, 0.73b2 and h-a-l's Megabuild 4.1.

Edit: Didn't try the bullet thing.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 3 of 20, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

This only happens under certain (and curious) circumstances, and perhaps also only on a Windows host OS. I only tried it as far back as 0.65, but it happens on every build I've tried.

1) It only happens if you have a console window open. If you run DOSBox with the -noconsole switch, you always get "Illegal command: con."

2) It only happens once you've mounted a DOSBox drive to the local "C" drive. It's curious that only the "C" drive is affected. If you have a drive mounted to local "D", it will not happen unless there also is a drive mounted to "C".

According to the log message in debugger builds, DOSBox is attempting to execute "con.COM" after parsing the command.

With all of that said, "con" is not a DOS command. It is a reserved name for the console device, and generally speaking the OS shouldn't allow a program to be named similarly to a device (CON.COM or CON.EXE are illegal names). The problem, if you want to call it that, is probably that DOSBox is parsing the command in such a way that it finds the console device and therefore thinks it exists as a file and attempts to execute CON.COM, resulting in a hang. But again, this is likely only to happen on a Windows host OS where the console device name has special meaning.

Reply 4 of 20, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Post a picture of it.

I'm using DOSBox 0.72 on Windows 2008 x64 and it doesn't happen here.

How To Ask Questions The Smart Way
Make your games work offline

Reply 5 of 20, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Not much to see in a picture, but I've included the status window to emphasize its importance in the issue. Latest CVS build on Windows XP SP2 32-bit.

Attachments

  • dbcon.png
    Filename
    dbcon.png
    File size
    9.29 KiB
    Views
    2092 views
    File license
    Fair use/fair dealing exception
Last edited by ripsaw8080 on 2008-12-24, 19:00. Edited 1 time in total.

Reply 6 of 20, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

1) It only happens if you have a console window open. If you run DOSBox with the -noconsole switch, you always get "Illegal command: con."

2) It only happens once you've mounted a DOSBox drive to the local "C" drive. It's curious that only the "C" drive is affected. If you have a drive mounted to local "D", it will not happen unless there also is a drive mounted to "C".

can't reproduce [Edit: sorry, I CAN reproduce, read the further edit down there]

started Dosbox 0.63, 0.65, 0.7, 0.72 (all official versions) on Windows XP SP3. No conf file and with the -noconsole switch.
Then "mount c c:\"
now either in z:\ or in c:\ con only gives me "Illegal command: con"

Edit: sorry, I misread part 1 of your instructions 😀
I can reproduce it when I DON'T use the -noconsole switch.

Reply 7 of 20, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Interesting that it not only has particular circumstances, but also doesn't happen for everyone. The debug build is giving a strong clue, however: it should not be trying to execute "con.COM"

Edit: heh, OK, that was point number 1 ! 😉

Reply 8 of 20, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

i can't reproduce it on linux. Might be windows specific. Maybe some test for devices missing in the shell or dos_execute.

Water flows down the stream
How to ask questions the smart way!

Reply 9 of 20, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I agree that it's probably confined to Windows, because the CON device name has meaning there. Still, as Harekiet pointed out, not much of an issue when it's based on a command that's both pointless and illegal.

Reply 10 of 20, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Tried some other device names as commands to see what would happen. NUL and LPT1 cause an "Exit to error: CPU:GRP5:Illegal Call 7". These don't depend on the console window, and any local drive (not just "C") mounting will enable them to cause the E_Exit. Again the debugger shows DOSBox is trying to execute "nul.COM" or "lpt1.COM", so it seems it's generally a command parsing issue with reserved device names under Windows.

Reply 11 of 20, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Still can't reproduce it.

Tried it with this command:

dosbox -c "mount C ." -c "C:" -c "CON"

Always gives me "Illegal command: CON."

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 12 of 20, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Doesn't do anything with CON here but it doest give a GRP5 with NUL.

Only works when you switch to the C: drive though. When you run the command on Z: gives illegal command.

Okay, using "mount c .", CON gives illegal command.
Using "mount c c:\windows" causes CON to hang

Last edited by DosFreak on 2008-12-24, 21:02. Edited 1 time in total.

How To Ask Questions The Smart Way
Make your games work offline

Reply 13 of 20, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

@MiniMax: Interesting... apparently mounting with the "." for current directory doesn't cause the same thing. Try changing your mount command to something like "mount c c:\dosgames", and it's important that it's some folder on the "C" drive, because other drives (for some reason) don't seem to have the same problem.

Reply 14 of 20, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Okay, this will hang 0.72:

dosbox -c "mount C C:\Temp" -c "C:" -c "CON"

But the hang is relatively mild. Pressing ENTER twice will bring the prompt back, followed by 3 message lines:

Current mounted drives are:
Drive C is mounted as local directory C:\Temp\
Drive Z is mounted as Internal Virtual Drive

In fact, it is the exact same message as the mount command would give.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 15 of 20, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Usually strange stuff can happen if the OS responds to open-calls.
Like you can "open" emmxxxx0 or con or something on some OSs.
Don't know if anybody is bored enough to pre-catch that stuff as
you'd need to catch them at various places, checking for standard
OS (relict) devices and stuff.

Reply 16 of 20, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

we check for devices at a lot of places already. Think checking Which and the execute functions to see where we don't catch it.
Which uses: DOS_FileExists which doesn't check for devices. Which is partly right and wrong. As devices always exist(so in tests they should exists unless leading directory doesn't exist) ,
but that function could get an alternative like DOS_FileExists_Real or so which does check for devices.

Having said that. DOS_FileExists in only used by DOS_Shell::Which(char * name), we could simply add a devices check to DOS_FileExists and comment that this function should only be used by Which or so.
Problem is easy to fix.

Water flows down the stream
How to ask questions the smart way!

Reply 17 of 20, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

That's why the issue occurs after mounting a drive, because then fopen() is used in drive_local.cpp to test for the existence of files, and device names will return true under Windows.

bool localDrive::FileExists(const char* name) {
char newname[CROSS_LEN];
strcpy(newname,basedir);
strcat(newname,name);
CROSS_FILENAME(newname);
dirCache.ExpandName(newname);
FILE* Temp=fopen(newname,"rb");
if(Temp==NULL) return false;
fclose(Temp);
return true;
}

CON, PRN, AUX, NUL, LPT0-9, COM0-9 are the obvious ones to avoid; any others?

Reply 19 of 20, by Dwedit

User metadata
Rank Newbie
Rank
Newbie

Interesting that pressing Enter twice gets out of the apparently frozen state from executing "con".
But accessing "con\con" in any way freezes Dosbox hard. It's the old Windows 98 bug back from the grave again. Reminds me of the good ol' days when you stuck <img src="file://C:/con/con"> on web pages to crash computers.

http://www.dwedit.org/