Bug#270285: dosemu: unix.com -s fails to import env vars with an underscore

2004-09-06 Thread Roger Leigh
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.

My /etc/freedos/autoexec.bat
@echo off
[snip lredired standard setup]

share
unix -r DOSCOMMAND


so the environment variable DOSCOMMAND will be run.  I have this batch
file in my homedir:

@ECHO OFF
REM Set up environment
unix -s FOO
unix -s BAR
unix -s BAZ
unix -s BAT
unix -s FOO_BAR
unix -s FOO_BAR
unix -s FOO_BAT
set
pause

Each environment variable is set in the parent shell.  The output reads
like this:

SHARE installed.
About to Execute : d:\blank1
COMSPEC=C:\COMMAND.COM
PATH=c:\bin;c:\gnu;c:\dosemu;d:\epicpos
HELPPATH=c:\help
PROMPT=$P$G
DOSTMP=/tmp/dosemu.udm2yf/tmp
DOSDRIVE_D=/home/blank
TEMP=E:\
DOSEMU_VERSION=1.2.1.0
FOO=foo
BAR=bar
BAZ=baz
BAT=bat
Press any key to continue ...

i.e. all the underscored envvars were missed.  In an existing DOS
application which uses the envvars "CSL-ACC", "CSL-CSBIG" and
"CSL-CSNRM", represented in the Linux environment as "CSL_ACC",
"CSL_CSBIG" and "CSL_CSNRM", only CSL_ACC is imported successfully (all
are then converted to the hyphenated form).  I'm unsure what makes
"CSL_ACC" an exception to the apparent "no underscores" rule.


What's really strange is this: if I run dosemu without setting
DOSCOMMAND, and then enter "blank1" as the command to run at the shell,
it runs perfectly:
$ dosemu
SHARE installed.
DOSEMU built-in command.com version  1.0

C:\>d:
D:\>blank1
COMSPEC=C:\COMMAND.COM
PATH=c:\bin;c:\gnu;c:\dosemu;d:\epicpos
HELPPATH=c:\help
PROMPT=$P$G
DOSTMP=/tmp/dosemu.fpjwlj/tmp
DOSDRIVE_D=/home/blank
TEMP=E:\
DOSEMU_VERSION=1.2.1.0
FOO=foo
BAR=bar
BAZ=baz
BAT=bat
FOO_BAR=foobar
FOO_BAT=foobat
Press any key to continue ...

D:\>


Wierd.  It looks like dosemu is not working properly until the shell
starts?


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.


Regards,
Roger


-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.6
Locale: LANG=en_GB, LC_CTYPE=en_GB

Versions of packages dosemu depends on:
ii  libc6 2.3.2.ds1-13   GNU C Library: Shared libraries an
ii  libx11-6  4.3.0.dfsg.1-4 X Window System protocol client li
ii  libxext6  4.3.0.dfsg.1-4 X Window System miscellaneous exte
ii  slang11.4.9dbs-6 The S-Lang programming library - r
ii  xbase-clients 4.3.0.dfsg.1-4 miscellaneous X clients
ii  xlibs 4.3.0.dfsg.1-4 X Window System client libraries m
ii  xutils4.3.0.dfsg.1-4 X Window System utility programs

-- no debconf information



Bug#270285: dosemu: unix.com -s fails to import env vars with an underscore

2004-09-06 Thread Ryan Underwood

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:

FreeCom version 0.82 pl 3 [Dec 10 2003 06:54:37]

D: = LINUX\FS/HOME/NEMESIS  attrib = READ/WRITE
E: = LINUX\FS/TMP/DOSEMU.NDQYZH/TMP  attrib = READ/WRITE
"Welcome to dosemu 1.2.1.0!"
SHARE installed.
About to Execute : d:blank1

PATH=c:\bin;c:\gnu;c:\dosemu
COMSPEC=C:\COMMAND.COM
HELPPATH=c:\help
PROMPT=$P$G
DOSTMP=/tmp/dosemu.ndqyzh/tmp
DOSDRIVE_D=/home/nemesis
TEMP=E:\
DOSEMU_VERSION=1.2.1.0
FOO=bar
BAR=bar
BAZ=bar
BAT=bar
FOO_BAR=bar
FOO_BAT=bat
CSL_ACC=asdf
CSL_CSBIG=asdf
CSL_CSNRM=asdf
Press any key to continue . . .


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.  To get the variables to be saved, DOSCOMMAND needs to be
"c:\command.com /p /c d:\blank1.bat" so that the new shell loaded to
run the batch file becomes permanent.

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.

> 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.  Just take the
command.com from the distribution and replace the command.com link in
/usr/lib/freedos with it.   Comcom is being phased out and already no
longer exists in CVS:
--
date: 2004/02/28 20:57:10;  author: bartoldeman;  state: dead;  lines: +0 -0
Purge coopthreads & comcom
--

so eventually it will be necessary to add FreeCOM to the dosemu-freedos
package.  I filed a bug for this a long time ago and it still sits in
the tracker. ;(


-- 
Ryan Underwood, <[EMAIL PROTECTED]>


signature.asc
Description: Digital signature


Bug#270285: dosemu: unix.com -s fails to import env vars with an underscore

2004-09-06 Thread Roger Leigh
Ryan Underwood <[EMAIL PROTECTED]> 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.



Bug#270285: dosemu: unix.com -s fails to import env vars with an underscore

2004-09-06 Thread Ryan Underwood

On Mon, Sep 06, 2004 at 10:44:52PM +0100, Roger Leigh wrote:
> > I did the exactly same thing as you, and here are my results:
> [snip working results]
> 
> Hmm, that's interesting!

I thought so :)

> 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 can't see such a distinction in the code.  Maybe it's an environment
space thing...

> 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!).

Yeah, I ran into that too.  Unfortunately the maintainer has left the
project and I don't know if a new maintainer has been assigned yet.

> 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"

I did this.

> $ 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

I created a batch file d:\test2.bat containnig this commands.

> $ 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

This works.

> 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

On my side it works
FreeCom version 0.82 pl 3 [Dec 10 2003 06:54:37]

D: = LINUX\FS/HOME/NEMESIS  attrib = READ/WRITE
E: = LINUX\FS/TMP/DOSEMU.YBTZLV/TMP  attrib = READ/WRITE
"Welcome to dosemu 1.2.1.0!"
SHARE installed.
About to Execute : d:\test2.bat

PATH=c:\bin;c:\gnu;c:\dosemu
COMSPEC=C:\COMMAND.COM
HELPPATH=c:\help
PROMPT=$P$G
DOSTMP=/tmp/dosemu.ybtzlv/tmp
DOSDRIVE_D=/home/nemesis
TEMP=E:\
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
Press any key to continue . . .


The plot thickens?  I wish I could reproduce this

Do you have another system where you can try a clean installation of the
packages?  Perhaps something has become messed up.

One thing you could make sure is that your config.sys is running
command.com with an environment size like e:1024 instead of the default,
which I think is only 256.

-- 
Ryan Underwood, <[EMAIL PROTECTED]>


signature.asc
Description: Digital signature