Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1466676286; bh=l9Un99+zp4pH3IQRmFb1zdGHDbqSWlQKUOsq20Ms1/A=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=Kxl2pmj8XVnXBbziivlsUrX94WZKAdzAT8F2+eGWL0OItGVK8/+A1XF1bcEiIWgKqq8iuJWJbIrhgAs/efnZudXMSbVNxDjX6cxLtUP7ZfXpyWpg91DKhcToSHApkBf8YbEqpZvUa6kl+nMBAp5LlU7ZDKfX9q/iCPbGF0V3aXxL5d2JRl33PXOUL/cXFIEoBJ7ynFFVAEFVe17z2chJbIbu7BChUHHKqxQXTJ6BHDvJEEYG1Leux6h579hvZycz1C2prZdlbiokVj0QyqXhFoImV9L08VjtiIDZcCb3fkVljLI/ujKrbbYccvtbpjTSoA7rpJ1xgChFPqkIppMjqA==
X-Yahoo-Newman-Id: 307564.27269.bm@smtp123.mail.ir2.yahoo.com
X-Yahoo-Newman-Property: ymail-3
X-YMail-OSG: J.ARv84VM1lZ.eMvLhZDhoCsKEZ_8WAzv6EtwlN7spyaHoj
 artW287DwSpkeaAAE4eeUsL4SKIcMx9Ye82rBlBHao15NB4gxvxfG5dZXMi8
 IYGr4KYXFPtIB8hzOHG8f.YafRqsEzalwXADzQOYtrFLaefGqR0wRC7w4nYn
 Ca9ErmhQl5Vg6_dQI0DuBwaaCJ0hViOfTPjE_SNSdt2sv0q4YaRdHngiT3O.
 4OffiDqsA1y03hs6t2.AaD_5ouujaomu2p89NPYJXNzMhSv7DgM1BmJ.0t16
 BcE.y17_DZfANL1y1O5iltFMCHFm4Bsoja0.8YD37nPjytHq3Hj3wdotH.3J
 XTUHC_9DJr2oBz9m72lNvV3uYwOViuYOXx7SVByjAANyApN7diD6EuA3NfI_
 F1Znd1DwLdH0BEuscTkJshcTleTxh2hhG0Uu2e8TJAjVlOJX6wy.mehLiw4f
 UB.h7DQ6bW0lfswXVnD1Jh0OribDooNSBgc_EX6T5zu.zMveRTlgUnGV.Vn7
 yw3IO46x3MRttZgQ4Tip63ERpa01NpQ--
X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI-
In-reply-to: <160622101417.ZM12222@torch.brasslantern.com>
From: Oliver Kiddle <okiddle@yahoo.co.uk>
References: <576a3601.43921c0a.46393.50ee@mx.google.com> <23718.1466581326@thecus.kiddle.eu> <160622101417.ZM12222@torch.brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] print errors to stderr
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <30202.1466676285.1@thecus.kiddle.eu>
Date: Thu, 23 Jun 2016 12:04:45 +0200
Message-ID: <30203.1466676285@thecus.kiddle.eu>
X-Seq: zsh-workers 38752

Bart wrote:
> } I think this behaviour is actually intentional. It is arguably not an
> } error - the whence command's purpose is to search for something and
> } report on whether it is found. So it doesn't rely on finding it. Also,
> } this is compatible with csh and tcsh - the which command was a csh thing
> } first.
>
> Maybe it's time for either the doc or a code comment to explain this,

Sounds sensible.

Oliver

diff --git a/Src/builtin.c b/Src/builtin.c
index c2fb81e..bfb9e69 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3633,6 +3633,7 @@ bin_whence(char *nam, char **argv, Options ops, int func)
 		}
 	    }
 	    if (!informed && (wd || v || csh)) {
+		/* this is information and not an error so, as in csh, use stdout */
 		zputs(*argv, stdout);
 		puts(wd ? ": none" : " not found");
 		returnval = 1;
@@ -3652,7 +3653,7 @@ bin_whence(char *nam, char **argv, Options ops, int func)
 	    }
 	    informed = 1;
 	} else {
-	    /* Not found at all. */
+	    /* Not found at all. That's not an error as such so this goes to stdout */
 	    if (v || csh || wd)
 		zputs(*argv, stdout), puts(wd ? ": none" : " not found");
 	    returnval = 1;

