Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Using 'command -v' in a shellscript results in a coredump
- X-seq: zsh-users 8045
- From: Michael Prokop <news@xxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Using 'command -v' in a shellscript results in a coredump
- Date: Thu, 7 Oct 2004 19:55:03 +0200
- In-reply-to: <Pine.LNX.4.61.0408181746400.6030@xxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <2004-08-19T01-13-05@xxxxxxxxxxxxxxxxxxxxxxxxx> <Pine.LNX.4.61.0408181746400.6030@xxxxxxxxxxxxxxxxxx>
- Reply-to: Michael Prokop <zsh@xxxxxxxxxxxxxxxxx>
* Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> [20040819 09:15]:
> On Thu, 19 Aug 2004, Michael Prokop wrote:
> > #!/bin/sh
> > command -v blub > /dev/null 2>&1
> > Running it results in 'zsh: segmentation fault (core dumped)'.
> The following prevents the core dump without producing any errors from
> "make test", but I suspect there's something deeper that should be fixed
> instead.
> The crash happens whenever 'command -v' or 'command -V' is used with the
> POSIXBUILTINS option set.
> The problem is that the code in execcmd() near line 1848 assigns 'hn' to
> point at the special 'commandbn' struct, but then 1952 is reached and
> tries (again) to find the builtin named "command" which fails. Nothing
> picks up the error after that and a null 'hn' is eventually dereferenced
> by execbuiltin().
> Index: Src/exec.c
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
> retrieving revision 1.69
> diff -u -r1.69 exec.c
> --- Src/exec.c 29 Jul 2004 15:09:51 -0000 1.69
> +++ Src/exec.c 19 Aug 2004 07:03:43 -0000
> @@ -1949,7 +1949,7 @@
> is_shfunc = 1;
> break;
> }
> - if (!(hn = builtintab->getnode(builtintab, cmdarg))) {
> + if (!hn && !(hn = builtintab->getnode(builtintab, cmdarg))) {
> if (cflags & BINF_BUILTIN) {
> zwarn("no such builtin: %s", cmdarg, 0);
> lastval = 1;
Thanks, Bart. (I'm replying with latency because I wanted to wait
for any updates on this topic.)
In the current CVS sources from zsh (2004-10-07) this bug isn't
fixed AFAICS (refering to line 1978 of Src/exec.c).
Some post-install scripts on Debian systems use 'command -v'.
I'm using zsh as the '/bin/sh'-shell on my systems. When I'm
upgrading the systems I often have to do a 'rm /bin/sh; ln -s
/bin/bash /bin/sh' and point it back after process of upgrading to
avoid the mentioned core dumps.
Any chance to see this bug fixed in upcoming versions of zsh (with
above code)?
thx && regards,
(-: Michael
Messages sorted by:
Reverse Date,
Date,
Thread,
Author