public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* BUGFIX!! ash == /bin/sh fixed for ./configure w95 & NT4
@ 1999-06-12 19:45 Mikey
  1999-06-30 22:10 ` Mikey
  0 siblings, 1 reply; 2+ messages in thread
From: Mikey @ 1999-06-12 19:45 UTC (permalink / raw)
  To: cygwin; +Cc: cygwin-developers, earnie_boyd, JRSON

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 cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* BUGFIX!! ash == /bin/sh fixed for ./configure w95 & NT4
  1999-06-12 19:45 BUGFIX!! ash == /bin/sh fixed for ./configure w95 & NT4 Mikey
@ 1999-06-30 22:10 ` Mikey
  0 siblings, 0 replies; 2+ messages in thread
From: Mikey @ 1999-06-30 22:10 UTC (permalink / raw)
  To: cygwin; +Cc: cygwin-developers, earnie_boyd, JRSON

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 cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-06-30 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-12 19:45 BUGFIX!! ash == /bin/sh fixed for ./configure w95 & NT4 Mikey
1999-06-30 22:10 ` Mikey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).