Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Esoteric zsh bug
- X-seq: zsh-workers 25
- From: Zefram <A.Main@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Z Shell workers mailing list)
- Subject: Esoteric zsh bug
- Date: Tue, 23 May 1995 11:04:04 +0100 (BST)
-----BEGIN PGP SIGNED MESSAGE-----
>>> Warning: nothing above this line is part of the message. <<<
A bit of maltreatment of zsh:
% cat >xyzzy.c
main(c,v)char**v;{execlp(*++v,0);}
^D
% cc xyzzy.c
% ./a.out zsh
zsh: segmentation fault ./a.out zsh
zsh falls over if argc is 0, as does ksh, and bash, and csh, and tcsh, and sh.
Not to mention sed, cut, grep, and in fact just about anything that cares about
its command-line arguments. If anyone is actually interested in making zsh
survive this, here's the patch:
*** Src/init.c.old Tue May 23 10:50:26 1995
--- Src/init.c Tue May 23 10:52:49 1995
***************
*** 42,47 ****
--- 42,48 ----
void
main(int argc, char **argv, char **envp)
{
+ static char *defargv[2] = {"zsh", (char *)NULL};
char *zshname;
#ifdef LC_ALL
***************
*** 49,54 ****
--- 50,57 ----
#endif
environ = envp;
permalloc();
+ if (!argc)
+ argv = defargv;
if (!(zshname = strrchr(argv[0], '/')))
zshname = argv[0];
else
-----BEGIN PGP SIGNATURE-----
Version: 2.6.i
iQBVAgUBL8GzEWWJ8JfKi+e9AQEPjAIAk6y9H2cgU3MvuNndoezF77T16aDeh0Sx
vkK3CnvVfGizluoUkhtySP5DPhqOYPYFo0qhg/3YUipglCik9L5jHw==
=N3DP
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author