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.
--- 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;
--- 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;