From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19934 invoked from network); 18 Aug 2004 23:32:12 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 18 Aug 2004 23:32:12 -0000 Received: (qmail 51412 invoked from network); 18 Aug 2004 23:32:06 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 Aug 2004 23:32:06 -0000 Received: (qmail 16430 invoked by alias); 18 Aug 2004 23:31:22 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7882 Received: (qmail 16421 invoked from network); 18 Aug 2004 23:31:21 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 18 Aug 2004 23:31:21 -0000 Received: (qmail 48797 invoked from network); 18 Aug 2004 23:29:23 -0000 Received: from www.vc-graz.ac.at (HELO proxy.vc-graz.ac.at) (193.171.121.30) by a.mx.sunsite.dk with SMTP; 18 Aug 2004 23:29:22 -0000 Received: from localhost (b-55.vc-graz.ac.at [193.171.241.55]) by proxy.vc-graz.ac.at (8.12.11/8.12.11) with ESMTP id i7INTKLO026432 for ; Thu, 19 Aug 2004 01:29:21 +0200 (MEST) Date: Thu, 19 Aug 2004 01:29:21 +0200 From: Michael Prokop To: zsh-users@sunsite.dk Subject: Using 'command -v' in a shellscript results in a coredump Message-ID: <2004-08-19T01-13-05@devnull.michael-prokop.at> Reply-To: Michael Prokop Mail-Followup-To: zsh-users@sunsite.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-URL: http://www.michael-prokop.at/ X-Operating-System: Debian GNU/Linux - 2.6.2 on a i686 X-Registered-Linux-User: 224337 X-Crypto: GnuPG/1.2.3 http://www.gnupg.org X-GPG-Key-ID: 0x37E272E8 X-GPG-Key: http://www.michael-prokop.at/gpg X-GPG-Fingerprint: 04AE E62C 9502 CD34 A7DA 857B D8DF 53FB 37E2 72E8 User-Agent: Mutt/1.5.6i X-Virus-Scanned: clamd / ClamAV version 0.75.1, clamav-milter version 0.75c on proxy.vc-graz.ac.at X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-0.0 required=6.0 tests=BAYES_40 autolearn=no version=2.63 X-Spam-Hits: -0.0 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]