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

Using 'command -v' in a shellscript results in a coredump



Hello,

on my system /bin/sh is a symlink to /bin/zsh4 (version 4.2.1).

I noticed a strange behaviour with the following shellscript:

#!/bin/sh
set -e
command -v blub > /dev/null 2>&1

Running it results in 'zsh: segmentation fault (core dumped)'.
Running the script with /bin/sh pointing to /bin/bash does not
produce a core dump.

Regarding to the zsh-manual 'command' is defined as:

 ,---- [ man zsh ]
 | command [ -pvV ] simple command
 |
 |  The  simple  command argument is taken as an external command
 |  instead of a function or builtin and is executed. If the
 |  POSIX_BUILTINS option is set, builtins will also be executed but
 |  cer- tain  special  properties  of  them are  suppressed.  The -p
 |  flag causes a default path to be searched instead of that in
 |  $path. With the -v flag, command is similar to whence and with -V,
 |  it is equivalent to whence -v.
 `----

Regarding to "IEEE Std 1003.1-2001, Section 12.2, Utility Syntax
Guidelines" 'command -v' is defined as:

 ,---- [ command -v ]
 | -v
 | (On systems supporting the User Portability Utilities option.) Write
 | a string to standard output that indicates the pathname or command
 | that will be used by the shell, in the current shell execution
 | environment (see Shell Execution Environment ), to invoke
 | command_name, but do not invoke command_name.
 `----

I'm not sure whether it's a bug in the shellscript (use of
non-sh-code) or the behaviour of zsh in sh-mode isn't correct.
Could anyone please explain me what's going on?

Thanks && regards,
(-: Michael
-- 
www.michael-prokop.at
~
~
".signature" [New] 1L, 22C [w]



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