This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Patch to fix "excessive bash delays"
- To: gnu-win32 at cygnus dot com
- Subject: Patch to fix "excessive bash delays"
- From: cgf at cygnus dot com (Christopher G. Faylor)
- Date: 23 Aug 1998 19:37:40 GMT
- Newsgroups: cygnus.gnu-win32
- Organization: Cygnus Solutions
- Stamped: newsgate-cygnus
I did some digging around today to determine where bash
was adding an extra '/' when HOME=='/'. The patch below
should solve a couple of such instances.
Adding an extra '/' to the beginning of a file name is
problematic for Windows because it causes Windows to
interpret the filespec as a network share, which means
that accessing the file can result in excessive delays.
This was most noticeable if a cygwin user did not have a
/etc/passwd file causing bash to set the HOME environment
variable to '/'. In this scenario, bash would look for things
like: '//.bashrc' and '//.bash_history'. Most annoyingly it
also periodically checks the file
'<current_directory>/unknown/I have no name!' for mail. If
the <current_directory> is '/' then this will revert to
'//unknown/I have no name!'.
So, a work around for this problem is to either set up
an /etc/passwd file or explicitly set HOME to some directory
besides '/'. Additionally, the MAIL_CHECK variable should
be 'unset'. Or, you can apply the patch below to bash and
rebuild bash.exe
This patch is against Cygnus's version of 2.02.0. I don't
know if it will patch cleanly against any other version.
Index: general.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bash/general.c,v
retrieving revision 1.3
diff -u -p -r1.3 general.c
--- general.c 1998/06/11 04:32:40 1.3
+++ general.c 1998/08/23 19:15:34
@@ -742,7 +742,8 @@ full_pathname (file)
return ((char *)NULL);
}
dlen = strlen (current_dir);
- current_dir[dlen++] = '/';
+ if (dlen > 1)
+ current_dir[dlen++] = '/';
/* Turn /foo/./bar into /foo/bar. */
if (file[0] == '.' && file[1] == '/')
Index: lib/readline/tilde.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bash/lib/readline/tilde.c,v
retrieving revision 1.3
diff -u -p -r1.3 tilde.c
--- tilde.c 1998/06/11 04:33:17 1.3
+++ tilde.c 1998/08/23 19:15:34
@@ -232,11 +232,14 @@ tilde_expand (string)
free (tilde_word);
len = strlen (expansion);
- if ((result_index + len + 1) > result_size)
- result = xrealloc (result, 1 + (result_size += (len + 20)));
+ if (len > 1 || *expansion != '/' || *string != '/')
+ {
+ if ((result_index + len + 1) > result_size)
+ result = xrealloc (result, 1 + (result_size += (len + 20)));
- strcpy (result + result_index, expansion);
- result_index += len;
+ strcpy (result + result_index, expansion);
+ result_index += len;
+ }
free (expansion);
}
--
cgf@cygnus.com "Everything has a boolean value, if you stand
http://www.cygnus.com/ far enough away from it." -- Galena Alyson Canada
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".