public inbox for linux-msdos@vger.kernel.org
 help / color / mirror / Atom feed
From: Clarence Dang <dang@kde.org>
To: Jan Willem Stumpel <jstumpel@planet.nl>
Cc: linux-msdos@vger.kernel.org
Subject: Re: comcom.com
Date: Sun, 12 Jan 2003 17:16:46 +0000	[thread overview]
Message-ID: <200301121716.46405.dang@kde.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1778 bytes --]

On Fri, 3 Jan 2003 06:24 pm, Bart Oldeman wrote:
> On Fri, 3 Jan 2003, Jan Willem Stumpel wrote:
> > When I use freedos, the command interpreter (in my system
> > /usr/lib/dosemu/commands/comcom.com) has several bugs. Should they
> >   be reported to the freedos people or to the dosemu people?
>
> dosemu, preferrably in the SF bug tracker.
> it is built into dosemu.bin indeed.
>
If you CC me comcom or joystick bug reports they will get fixed faster (as 
opposed to probably not at all :)) since I don't read every single email that 
comes up on MLs.  Just don't deliberately stress-test comcom because it's 
known to be buggy.

>
> > 1) changing directory:
> > C:\>cd\ws\text
> > cd\ws\text: file not found
>
> yes, this is a known bug.
>
Bart, I've recycled your 1.1.3.8 comcom patch and moved it to com_argparse in 
coopthreads to make comcom-space.patch which should solve the problem once 
and for all (argument parsing in comcom is still far from perfect but good 
enough for the time being).  I checked for the possibility of an introduced 
buffer overrun but it shouldn't happen since 256 is much larger than the 
maximum command line length of about 128.

> > 2) running a program in a directory above the present one:
> > C:\>cd \ws\text
> > C:\WS\TEXT>..\ws
> > ..\ws: file not found
> >
> > The file extension is needed: the command ..\ws.exe succeeds.
>
> this one I haven't observed before. Thanks.
>
comcom-exist-exec.patch

> > C:\WS\TEXT>\oldc\tsr\minimon
> > MiniMon Version 1.0 installed. Activate with <Ctrl-Alt-M>
> > C:\WS\TEXT>cd\
> > cd\: insufficient memory
>
> well, first fix bug 1 and then look again :)
>
Does it still happen after the attached patches have been applied?

Clarence

BTW, Stas, I'm looking into the comcom problem at sourceforge.

[-- Attachment #2: comcom-space.patch --]
[-- Type: text/x-diff, Size: 1412 bytes --]

--- 1141pr/src/plugin/coopthreads/coopthreads.c	2002-03-18 21:58:14.000000000 +0000
+++ comhack/src/plugin/coopthreads/coopthreads.c	2003-01-10 15:37:03.000000000 +0000
@@ -1734,6 +1734,20 @@
    }
    else s[1+(unsigned char)s[0]] = 0;
    s++;
+
+   /* transform:
+    *    dir/p to dir /p
+    *    cd\ to cd \
+    *    cd.. to cd ..
+    */
+   p = s;
+   while (isalnum(*p)) p++;
+   if (*p == '\\' || *p == '/' || (*p == '.' && p[1] == '.')) {
+      memmove(p+1, p, s [-1] - (p - s) + 1/*NUL*/);
+      *p = ' ';
+      s[-1]++; /* update length */
+   }
+
    maxarg --;
    for ( ; *s; s++) {
       if (!mode) {
--- 1141pr/src/plugin/commands/comcom.c	2002-12-21 01:27:13.000000000 +0000
+++ comhack/src/plugin/commands/comcom.c	2003-01-10 15:17:29.000000000 +0000
@@ -1324,6 +1324,7 @@
 		i = replen - (s - replbuf);
 		memcpy(p, s, i+1);
 		callbuf[0] = p - (callbuf+1) + i;
+		/* WARNING! callbuf may be modified by com_argparse */
 		j = com_argparse(callbuf, argv+arg0_new, MAXARGS - (argc-arg0_new) -1);
 		saved_dta = PSP_DTA;
 		SET_CHILD_ARGS(arg0_new);
@@ -3276,6 +3277,7 @@
 		if (!bdta.mode) com_doswrite(2, "\r\n", 2);
 
 		memcpy(argbuf, &LEN0A, LEN0A+2); /* save contents */
+		/* WARNING! argbuf may be modified by com_argparse */
 		argc = com_argparse(argbuf, argv, MAXARGS -1);
 		bdta.argcsub = bdta.argc = argc; /* save positional variables */
 		bdta.argvsub = bdta.argv = argv;

[-- Attachment #3: comcom-exist-exec.patch --]
[-- Type: text/x-diff, Size: 947 bytes --]

--- 1141pr/src/plugin/commands/comcom.c	2002-12-21 01:27:13.000000000 +0000
+++ comhack/src/plugin/commands/comcom.c	2003-01-11 19:05:10.000000000 +0000
@@ -1016,10 +1016,20 @@
 	int i;

 	if ((len >4) && (file[len-4] == '.')) {
-		for (i=0; i<3; i++)
-			if (!strncasecmp(file+len-3, extlist[i], 3))
-				if (com_exist_file(file)) return i+1; 
-		return 0;
+		/* '..\ws' does _not_ mean a file with extension '\ws' */
+		boolean isext = TRUE;
+		for (i = len - 3; i < len; i++) {
+			if (!isalnum (file[i])) {
+				isext = FALSE;
+				break;
+			}
+		}
+		if (isext) {
+			for (i=0; i<3; i++)
+				if (!strncasecmp(file+len-3, extlist[i], 3))
+					if (com_exist_file(file)) return i+1;
+			return 0;
+		}
 	}
 	*p++ = '.';
 	for (i=0; i<3; i++) {
@@ -1164,7 +1175,7 @@
 	char *p;

 	if (!expand || (expand && com_doscanonicalize(buf, path)))
-							strcpy(buf, path);
+		strcpy(buf, path);
 	p = basename_of(buf,0);
 	*p = 0;
 	return p - buf;

             reply	other threads:[~2003-01-12 17:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-12 17:16 Clarence Dang [this message]
2003-01-12 10:26 ` comcom.com Jan Willem Stumpel
2003-01-15 12:55   ` comcom.com Clarence Dang
  -- strict thread matches above, loose matches on Subject: below --
2003-01-17 18:47 comcom.com Stas Sergeev
2003-01-17 23:03 ` comcom.com Jochen Reinwand
     [not found] <3E2576E0.6050605@yahoo.com>
2003-01-17 14:38 ` comcom.com Clarence Dang
2003-01-15  3:04 comcom.com Stas Sergeev
2003-01-12 17:15 comcom.com Stas Sergeev
2003-01-15 12:50 ` comcom.com Clarence Dang
2003-01-17 15:56   ` comcom.com Jochen Reinwand
2003-01-03 13:15 comcom.com Jan Willem Stumpel
2003-01-03 18:24 ` comcom.com Bart Oldeman
2003-01-03 19:18   ` comcom.com Jan Willem Stumpel
2003-01-03 22:36     ` comcom.com Bart Oldeman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200301121716.46405.dang@kde.org \
    --to=dang@kde.org \
    --cc=jstumpel@planet.nl \
    --cc=linux-msdos@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox