Bug#270285: dosemu: unix.com -s fails to import env vars with an underscore
Ryan Underwood <nemesis@icequake.net> writes:
> On Mon, Sep 06, 2004 at 03:25:39PM +0100, Roger Leigh wrote:
>> Package: dosemu
>> Version: 1.2.1-3
>> Severity: normal
>>
>> If I want to import environment variables from the Linux environment
>> into the dosemu session using "unix -s varname", only variables without
>> an underscore are imported.
>
> I did the exactly same thing as you, and here are my results:
[snip working results]
Hmm, that's interesting!
> But, these environment vars are not set in the parent shell, because a
> new shell is spawned to run the .bat file and then destroyed when it
> exits.
That's not a problem--they weren't even set within the current shell.
> The only other thing I can think of is that empty environment variables
> are automatically reaped under DOS. So if you try to import a variable
> that exists on the unix side but is empty, nothing will appear to
> happen, because it has the same effect as SET FOO= on the DOS side.
That's what I see, but if the variable /is/ set, the behaviour of
"unix -s" is different whether it's run from (autoexec.bat or a
command specified on the dosemu command line) compared with being run
from the command prompt by hand (which works perfectly).
>> I've also found problems if DOSCOMMAND has arguments to the command e.g.
>> "command arg1 arg2". The args seem to be dropped, though I need to
>> investigate this one further. This also applies to running "dosemu
>> command arg1 arg2" with the appropriate unix command in autoexec.bat.
>
> Hmm, this definitely doesn't happen here (or else it would be impossible
> to invoke the permanent shell option). However, I am using a FreeCOM
> from here:
> http://freedos.sourceforge.net/freecom/FreeCOM.html#-download
> instead of the classic dosemu comcom, which you probably use because it
> is the default command interpreter in dosemu 1.2.
Yes--it's the stock dosemu and dosemu-freedos from unstable. I can't
say I like it (it says "out of memory" when it can't find a command!).
> Just take the
> command.com from the distribution and replace the command.com link in
> /usr/lib/freedos with it.
I tried this. I renamed command.com to command.swp and vspawn.com to
command.com. It won't work unless command.swp is read-write! When I
do start it, either from config.sys or from the comcom.com shell,
"unix -s" fails to work (and I lose the shell history), so something's
not quite right there!
Update: not using vspawn, and making command.com writable lets it run
normally and "unix -s" does then work as expected, but it's still not
quite right:
$ export
declare -x BAR="bar"
declare -x BAZ="baz"
declare -x CSL_ACC="3453"
declare -x CSL_COMMAND="dsfs dfdfdfdfdfdfd /dfdfd"
declare -x CSL_CSBIG="dskf dskf sdf dsf dsfdf dsf dsf"
declare -x CSL_CSNRM="dskf dskf sdf dsf dsfdf dsf dsf"
declare -x FOO="foo"
declare -x FOO_BAR="foobar"
declare -x FOO_BAZ="foobaz"
$ cat test2.bat
UNIX -S FOO
UNIX -S FOO
UNIX -S BAR
UNIX -S BAZ
UNIX -S FOO_BAR
UNIX -S FOO_BAZ
UNIX -S CSL_ACC
UNIX -S CSL_CSNRM
UNIX -S CSL_CSBIG
UNIX -S CSL_COMMAND
SET
PAUSE
$ dosemu
C:\>d:\test2
D:\>UNIX -S FOO
D:\>UNIX -S FOO
D:\>UNIX -S BAR
D:\>UNIX -S BAZ
D:\>UNIX -S FOO_BAR
D:\>UNIX -S FOO_BAZ
D:\>UNIX -S CSL_ACC
D:\>UNIX -S CSL_CSNRM
D:\>UNIX -S CSL_CSBIG
D:\>UNIX -S CSL_COMMAND
D:\>SET
PATH=c:\bin;c:\gnu;c:\dosemu
COMSPEC=C:\FREECOM\COMMAND.COM
HELPPATH=c:\help
PROMPT=$P$G
DOSTMP=/tmp/dosemu.vapgkb/tmp
DOSDRIVE_D=/home/roger
DOSEMU_VERSION=1.2.1.0
FOO=foo
BAR=bar
BAZ=baz
FOO_BAR=foobar
FOO_BAZ=foobaz
CSL_ACC=3453
CSL_CSNRM=dskf dskf sdf dsf dsfdf dsf dsf
CSL_CSBIG=dskf dskf sdf dsf dsfdf dsf dsf
CSL_COMMAND=dsfs dfdfdfdfdfdfd /dfdfd
All of the env vars are there. Now:
$ dosemu d:\\test2
C:\>SET
[same commands as before]
PATH=c:\bin;c:\gnu;c:\dosemu
COMSPEC=C:\FREECOM\COMMAND.COM
HELPPATH=c:\help
PROMPT=$P$G
DOSTMP=/tmp/dosemu.jsddnx/tmp
DOSDRIVE_D=/home/roger
DOSEMU_VERSION=1.2.1.0
FOO=foo
BAR=bar
BAZ=baz
FOO_BAR=foobar
FOO_BAZ=foobaz
CSL_ACC=3453
Notice that the CSL_CSNRM, CSL_CSBIG and CSL_COMMAND vars are now
missing. test2.bat was invoked by this line in autoexec.bat:
unix -e
> so eventually it will be necessary to add FreeCOM to the dosemu-freedos
> package.
That sounds great.
Regards,
Roger
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
Reply to: