dosemu2 / comcom64

64bit command.com
https://github.com/dosemu2/comcom32/
GNU General Public License v3.0
32 stars 5 forks source link

SET command with /P option produce Syntax error #56

Closed Patriciogonza9090 closed 3 years ago

Patriciogonza9090 commented 3 years ago

I am migration from DOSEMU to DOSEMU2 and the following bat is not working

echo Elegir impresora: echo 1) Laser Arriba echo 2) Laser Abajo echo 3) Impresora local deskjet (lpt1) echo 4) Salida a archivo s:\pat\impre.prn set /p mvar=Ingrese 1, 2, 3 o 4? This is the line causing Sintax error If %mvar%==1 goto arriba If %mvar%==2 goto abajo If %mvar%==3 goto local If %mvar%==4 goto archivo

This is the output:

Welcome to dosemu2! Build 2.0pre8 Elegir impresora: 1) Laser Arriba 2) Laser Abajo 3) Impresora local deskjet (lpt1) 4) Salida a archivo s:\pat\impre.prn Syntax error Batch file aborted - C:\USERHOOK.BAT, line 20

Then I execute the SET command to find out what happened with mvar variable, please see last line with the weird result.

Apparently not recognizing /P as option, and setting a variable named "/P MVAR"

USERDRV=C SHELLDRV=E DOSEMUDRV=D FDPP_AUTOEXEC=D:\FDPPAUTO.BAT XBATDRV=F SHELL_ALLOW_EXIT=1 COMSPEC=E:\COMMAND.COM PATH=D:\dosemu;E:\;F:\;C:\bin TEMP=C:\tmp ERRORLEVEL=0 BLASTER=A220 I5 D1 H5 P330 T6 MIDI=SYNTH:2 MAP:E MODE:0 DOSEMU_VERSION=2.0pre8 BASES=g:\sistema\dbftele INDICES=g:\sistema\teleprin CLIPPER=//f:150 /P MVAR=Ingrese 1, 2, 3 o 4?

Is there any known solution to this?

stsp commented 3 years ago

Should now be fixed.

Patriciogonza9090 commented 3 years ago

I have updated to the fixed version, now SET /P sets the variable with the proper value

After checking with SET, it shows

. . . CLIPPER=//f:150 MVAR=1

but the IF clause is not branching properly, as if expresion %mvar%==1 has a FALSE condition-

set /p mvar=Ingrese 1, 2, 3 o 4? If %mvar%==1 goto arriba If %mvar%==2 goto abajo If %mvar%==3 goto local If %mvar%==4 goto archivo

stsp commented 3 years ago

Should now work better.

Patriciogonza9090 commented 3 years ago

Thanks, now it's working!

stsp commented 3 years ago

Hope your migration from dosemu1 goes well from now on. Not many users are willing to migrate by hands. Usually they just want dosemu2 to boot their ancient dosemu1 setup, and they quit as soon as this is not happening.

Patriciogonza9090 commented 3 years ago

Thanks a lot for the quick response. I also noticed that I needed to change Putty configuration to VT100+ keyboard emulation to get the function keys properly working in my DOS app. Now starting application testing, all looks pretty good on the dosemu2 side! Still need to configure server functionality to put it on production.

Patriciogonza9090 commented 3 years ago

Hi, I finally have my migrated system working. I have the following situation. Old DOSEMU is running on an old PC with few resources and Redhat9. Dosemu2 is installed in a beter PC with Fedora Core server 34. The same tasks in the DOSEMU side are taking 5 times longer to execute. The only thing that I notice is that I get the KVM error when starting DOSEMU2.

[patricio@fedora ~]$ dosemu -f .dosemurc_pg ERROR: KVM: error opening /dev/kvm: No existe el fichero o el directorio ERROR: term: stderr still on tty, closing

In fact /dev/kvm is not on my server. I have quemu-kvm installed

Let me say that even though I have long time experience with systems, I am not a Linux expert. Is there any check list to confirm if there is anything missing?

I installed with dnf from the COPR repository. And later updated with rpm a fixed version for the SET /P issue.

I tend to think that the performance problem is related to the KVM problem.

I

andrewbird commented 3 years ago

Probably with the old machine you were running a 32bit kernel so dosemu can use vm86() hardware assistance as it's only supported by the processor in 32bit mode. On the newer machine I expect you are running a 64bit kernel as do most people these days. As you spotted the /dev/kvm device is required to switch from software emulation to running KVM, the most usual reason for that to be missing is that VT extensions are not enabled in the BIOS. You should enable that, save settings and do a power off and on. Then see if your /dev/kvm device is created at boot.

andrewbird commented 3 years ago

Oh yes you mentioned using Putty to access Dosemu. Depending upon the distro you may find that logging in over a network connection you aren't automatically given extra access to the /dev/kvm device in the way a desktop user would be. So you will have to check what permissions are on the newly created /dev/kvm and give yourself access in some way. That could be adding yourself into the kvm group or opening its permissions up, but be wary of adding an additional user acl to it as that's likely to be stripped off almost immediately by the login service. Remember if you add yourself into any group, you'll need to log out and back in to collect the revised group membership.

stsp commented 3 years ago

ERROR: KVM: error opening /dev/kvm: No existe el fichero o el directorio

I suppose this says "file does not exist" or alike, so the bios setting looks more plausible than the permission problem.

Patriciogonza9090 commented 3 years ago

You are right, the CPU I am using is quite old and does not support virtualization. I played with dosemurc file, and the only option that works is $_cpu_vm = "emulated". The kernel is 64 bit. I will do some more testing on this install, and then decide if moving to a newer CPU is necesary. By the way, changing to a 32bit kernel, could improve speed by using vm86()?

stsp commented 3 years ago

By the way, changing to a 32bit kernel, could improve speed by using vm86()?

Exactly. But:

  1. It is disabled in all pre-built kernels so you will need to build your own one
  2. It is largely untested under dosemu2 these days
  3. You will probably also want to switch DPMI out of emulator and use $_cpu_vm_dpmi = "native", but this will face the same problems as the above (like disabling in kernel), plus this will be insecure. We currently do not sand-box the native DPMI execution, but KVM is always sand-boxed.

So I am not trying to talk you into not even trying, but you've been warned.

stsp commented 3 years ago

As an experiment you can do $_cpu_vm_dpmi = "native" even now - maybe that will already be fast enough?

Patriciogonza9090 commented 3 years ago

My main concern in using ths application (that is developed originally in Clipper) is that there are 5 users concurently running dosemu. Clipper has the famous problem of taking all the CPU %. In the running instalation of old DOSEMU I could get some improve using "nice".

nice --adjustment=15 /home/Mydos/dosemu/dosemu

The performance is pretty decent. Getting same perfomance with dosemu2 is ok for me.

If there is any parameter that I could use to optimize my scenario please let me know.

stsp commented 3 years ago

I already did.

jschwartzenberg commented 3 years ago

My main concern in using ths application (that is developed originally in Clipper) is that there are 5 users concurently running dosemu. Clipper has the famous problem of taking all the CPU %. In the running instalation of old DOSEMU I could get some improve using "nice".

If I remember correctly, there's a patcher to patch these Clipper executables to reduce their CPU usage.

Patriciogonza9090 commented 3 years ago

Regarding memory usage: Is there a fixed amount of memory that a DOSEMU2 process needs? Does it depend on the applications being executed inside DOSEMU? Is there a way of restricting memory usage for each isntance of DOSEMU? I was force to increase the amount of RAM on the server to 2GB in order to allocate 6 DOSEMU2 simultaneous sessions. The Fedora OOMD automatically kills the older process, when I try to open a new one.

stsp commented 3 years ago

You can try to lower the $_dpmi = (0x20000) which is 128Mb, but I think this will mildly help. dosemu2 was never profiled for the memory usage, nor were its dependencies, which are many (like sdl, pulseaudio client and 100+ more).

There are the obvious problems on your side too tough, like eg no swap configured. And yes, 2Gb on a 64bit server is damn few. There are tweaks that are needed to be applied, like lowering the memory that linux kernel reserves for its internal allocations etc. I had a notebook with 2Gb, and on default ubuntu setup it was barely usable, but the tweaking helps a lot. This all is unrelated to dosemu.

Patriciogonza9090 commented 3 years ago

Hi,

I am getting a Sintax error and i believe it has to do with the Set /p issue.

This is a part of the batch file where it gives the error (lines are numbered)

 45 echo Elija opcion
 46 echo 1)Menu principal
 47 echo 2)Contabilidad
 48 set /p mvar=Ingrese 1/2? :
 49
 50 If %mvar%==1 goto menuexe
 51 If %mvar%==2 goto conta
 52 goto end

To force the error I simply press ENTER at the prompt on line 48, and after doing that I get the following error, it seems to be a problem when the variable is empty.

Elija opcion 1)Menu principal 2)Contabilidad Ingrese 1/2? : Syntax error Batch file aborted - C:\USERHOOK.BAT, line 50

stsp commented 3 years ago

You should write If "%mvar%"=="1" goto menuexe