Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: _whois



On Nov 9,  9:58am, Sven Wischnowsky wrote:
} Subject: Re: PATCH: _whois
}
} (patch-readers will notice that there even is some
} redundancy in this patch, trying to avoid getting this bug again
} later).

I always experience some ambivalence about this sort of thing:

} +    if (s) {
} +	char *os = s, *p = compqstack;
[...]
} +	return (s == os ? dupstring(s) : s);
}      }
} -    return (s == os ? dupstring(s) : s);
} +    return NULL;
}  }
}  
}  /**/
}  char *
}  tildequote(char *s, int ign)
}  {
} -    int tilde;
} +    if (s) {
} +	int tilde;
[...]
} +	return s;
} +    }
} +    return NULL;
}  }

On the one hand, it's never good for the shell to crash.

On the other hand, too much of this kind of "defensive programming" can
conceal the actual source of the error, leading to other, more confusing
failures in other places; cause bugs to go unfixed; and slow down the
execution with redundant error checking.

So it would seem to me that there should at least be a DPUTS() in there,
to mitigate the first couple of those effects.

Index: compcore.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-3.1/Src/Zle/compcore.c,v
retrieving revision 1.8
diff -c -r1.8 compcore.c
--- compcore.c	1999/11/09 10:48:22	1.8
+++ compcore.c	1999/11/09 10:51:14
@@ -938,6 +938,7 @@
 	}
 	return (s == os ? dupstring(s) : s);
     }
+    DPUTS(1, "BUG: null pointer in multiquote()");
     return NULL;
 }
 
@@ -956,6 +957,7 @@
 
 	return s;
     }
+    DPUTS(1, "BUG: null pointer in tildequote()");
     return NULL;
 }
 

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author