zsh-users
 help / color / mirror / code / Atom feed
From: Michael Prokop <news@michael-prokop.at>
To: zsh-users@sunsite.dk
Subject: Using 'command -v' in a shellscript results in a coredump
Date: Thu, 19 Aug 2004 01:29:21 +0200	[thread overview]
Message-ID: <2004-08-19T01-13-05@devnull.michael-prokop.at> (raw)

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]


             reply	other threads:[~2004-08-18 23:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-18 23:29 Michael Prokop [this message]
2004-08-19  7:11 ` Bart Schaefer
2004-10-07 17:55   ` Michael Prokop
2004-10-08 13:53     ` Clint Adams
2004-10-09 20:50       ` simple question about completion and case William Scott
2004-10-11 22:31         ` Bart Schaefer
2004-10-11 22:29     ` Using 'command -v' in a shellscript results in a coredump Bart Schaefer
2004-10-13 22:09       ` Michael Prokop

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2004-08-19T01-13-05@devnull.michael-prokop.at \
    --to=news@michael-prokop.at \
    --cc=zsh-users@sunsite.dk \
    --cc=zsh@michael-prokop.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).