Subject: BUGFIX!! ash == /bin/sh fixed for ./configure w95 & NT4
From: [email-masked] (Mikey)
To: [email-masked]
Cc: [email-masked], [email-masked], [email-masked]
Date: Sun, 13 Jun 1999 02:16:02 GMT

First Thanks to John Hanson
and Earnie Boyd, for their contributions to this fix.

Trying Mr Hanson's JIT patch for gdb that he
posted last week,(works NICE!) running configure
for binutils cvs with ash as /bin/sh gets 6 segfaults in various
dirs.

Sorry Mr Hanson I don't have W2K or 98 so I can't help with
your question :-(

The final patched sh.exe correctly configures binutils+gcc+gdb
on both w95 and NT4 sp3. NO SEGFAULTS!!!!.

Here files still mess up stdin on 95, with 990115 snap,
but I understand that this is fixed in more recent snaps.
Now if I could just get a recent snap to work on 95 ;-)

I noticed that most of the errors were memory allocation
related, so I decided to take Earnie's advice and
link sh.exe against libmmalloc.a

finally the only error left was in expand.c, the fix below
may be a little excessive, but in this case I think if it's not
needed now, it will be in future. At first I just changed the
size to 4096 from 1024, and that worked.

--- ../ash1/expand.c    Thu Feb 18 11:37:24 1999
+++ expand.c    Sat Jun 12 17:20:12 1999
@@ -63,6 +63,11 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include <dirent.h>
+#ifdef __CYGWIN__
+#include <limits.h>
+#else
+#define PATH_MAX 1024
+#endif

 /*
  * Structure specifying which parts of the string should be searched
@@ -646,6 +651,8 @@
        struct strlist **savelastp;
        struct strlist *sp;
        char c;
+        int metamax = 0;
+        int hasmeta = 0;

        while (str) {
                if (fflag)
@@ -655,16 +662,16 @@
                if (p[0] == '/' && p[1] == 'u' && p[2] == '/')
                        str->text = p = expudir(p);
 #endif
-               for (;;) {                      /* fast check for meta chars */
-                       if ((c = *p++) == '\0')
-                               goto nometa;
-                       if (c == '*' || c == '?' || c == '[' || c == '!')
-                               break;
+               for (;;) {
+                       if ((c = *p++) == '\0' && !hasmeta) goto nometa;
+                        else if (c = '\0') break;
+                       if (c == '*'){ metamax++; hasmeta++;}
+                        if ( c == '[' || c == '!' || c == '?') hasmeta++;
                }
                savelastp = exparg.lastp;
                INTOFF;
                if (expdir == NULL)
-                       expdir = ckmalloc(1024); /* I hope this is big enough */
+                 expdir = ckmalloc(4096 + (PATH_MAX * metamax));
                expmeta(expdir, str->text);
                ckfree(expdir);
                expdir = NULL;

--
Want to unsubscribe from this list?
Send a message to [email-masked]