[alt.msdos.programmer] Problem with DOS 4.01 COMMAND.COM batch files -- comments wanted

otto@tukki.jyu.fi (Otto J. Makela) (01/23/90)

I have discovered a bug in COMMAND.COM on MS-DOS 4.01, which I believe to
exist in several other versions (I've had similar problems on 3.30).
 
You can crash the system if a batch file line expands to over 127 characters
with variable substitution.  Take the following one-liner:
	PATH A;%PATH%
If your path is set to 80 characters (easy to see on-screen), 20 applications
of this batch will hang your system.
 
This only happens if you have a CONFIG.SYS file with a line like
	SHELL=C:\DOS\COMMAND.COM /P/E:512
that is, you specify a non-standard environment size.  If no CONFIG.SYS exists,
or it does not have a SHELL line, the command fails silently or a "Syntax
error" message will be issued when the PATH tries to grow too long.

This came up when making a batch file to conditionally add stuff to your PATH.
I verified it on a system without an AUTOEXEC.BAT, so it can't be TSRs...
 
I think this is rather serious, since this limitation is not mentioned in any
manuals I have seen (normally it is only noted that command lines may not
exceed 127 characters in length, nothing is said about variable expansion),
and it makes it impossible to set a path of greater than 127 characters, in
spite of not being short of environment space.

I'd like to see comments on this.  Has anybody else noticed this, has it
been mentioned in some documentation I have not seen ?  Anyone at MicroSoft,
where could I send a report of this ?
--
* * * Otto J. Makela (otto@jyu.fi, MAKELA_OTTO_@FINJYU.BITNET) * * * * * * *
* Phone: +358 41 613 847, BBS: +358 41 211 562 (CCITT, Bell 2400/1200/300) *
* Mail: Kauppakatu 1 B 18, SF-40100 Jyvaskyla, Finland, EUROPE             *
* * * freopen("/dev/null","r",stdflame); * * * * * * * * * * * * * * * * * *