Date: Thu, 20 Apr 2000 13:04:38 -0400 (EDT) Message-Id: <200004201704.NAA16187@indy.delorie.com> From: Eli Zaretskii To: Erik Sandberg CC: djgpp AT delorie DOT com In-reply-to: <3.0.5.32.20000420140020.008e35c0@pop.mail.yahoo.com> (message from Erik Sandberg on Thu, 20 Apr 2000 14:00:20 +0200) Subject: Re: argc (?) bug References: <3 DOT 0 DOT 5 DOT 32 DOT 20000420140020 DOT 008e35c0 AT pop DOT mail DOT yahoo DOT com> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Date: Thu, 20 Apr 2000 14:00:20 +0200 > From: Erik Sandberg > > I'm using win98's DOS shell and grep 2.4, and if I do e.g. > grep \". *.ini |more > in the c:\windows directory (or a search in a different file set, if there > just are some matches), I get strange output: > > C:\WINDOWS>grep \". *.ini |more > netdet.ini:HKLM,System\CurrentControlSet\Services\VxD\NWLINK,cachesize,,"16" > netdet.ini:HKLM,System\CurrentControlSet\Services\VxD\NWLINK\Ndi\params\cach > esiz > e,"",,"16" > netdet.ini:%26%\protocol.ini,NWLINK$,,"cachesize=16" > win.ini:rhide.exe="D:\DJGPP\BIN\rhide.exe" > grep: |more: No such file or directory (ENOENT) > grep: EMP=C:\TEMP: No such file or directory (ENOENT) > > In a more complex situation, there were trash characters instead of > "EMP=C:\TEMP". I can confirm this problem on Windows 98. > It looks like a bug in DOS (the same thing occur to BCC's grep), somehow > DOS seems to report the wrong argc/argv if there's a \" in the parameter > list. In any case it would be cool if DJGPP could add a workaround for it. I don't think this has anything to do with DJGPP. I can actually crash a DOS box ("This program performed an illegal instruction...") on Windows 98 by typing this: echo \" | more Since ECHO is an internal command in COMMAND.COM, this looks like a bug in COMMAND.COM. Depending on the context, it either crashes or passes some wild command-line tail to the programs it invokes. As far as I could see, the crashes happen even before the DJGPP program starts running its startup code. I don't see any way to fix this in DJGPP. The crashes obviously happen before our code runs, and as for corrupted command lines, what can we do except trust the shell to pass us correct command lines? You can use Bash to avoid these problems.