[gnu.bash.bug] Arrg! Bug in my bugfix!

ray@MAXWELL.PHYSICS.PURDUE.EDU (Ray Moody) (08/06/89)

    There was a bug in my bugfix for polite_directory_format.  I was
trying to fix it so that /a/raymond would not appear as ~mond if my
home directory was /a/ray.  In reality, I broke it so that it would
never use a ~.  Here is a correct (i hope) patch.

    Sorry about this.  I guess I will go spend my 10 minutes in the
agonizer booth now.

								Ray
-------------------------------------------------------------------------------
RCS file: RCS/builtins.c,v
retrieving revision 1.2.1.1
diff -c -r1.2.1.1 builtins.c
*** /tmp/,RCSt1011325	Sat Aug  5 14:28:00 1989
--- builtins.c	Fri Aug  4 21:42:24 1989
***************
*** 2680,2686
    char *home = get_string_value ("HOME");
    int l = home ? strlen (home) : 0;
  
!   if (l && strncmp (home, name, l) == 0) {
      strcpy (tdir + 1, name + l);
      tdir[0] = '~';
      return (tdir);

--- 2680,2686 -----
    char *home = get_string_value ("HOME");
    int l = home ? strlen (home) : 0;
  
!   if (l > 1 && strncmp (home, name, l) == 0 && (name[l] == '/' || name[l] == '\0')) {
      strcpy (tdir + 1, name + l);
      tdir[0] = '~';
      return (tdir);

bfox@AUREL.CALTECH.EDU (Brian Fox) (08/06/89)

   Date: Sat, 5 Aug 89 14:29:13 EST
   From: ray@maxwell.physics.purdue.edu (Ray Moody)

       There was a bug in my bugfix for polite_directory_format.  I was

Yeah, I noticed that.

Brian