From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3047 invoked by alias); 16 Sep 2016 03:14:33 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39357 Received: (qmail 3622 invoked from network); 16 Sep 2016 03:14:33 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f50.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.50):SA:0(0.0/5.0):. Processed in 0.404964 secs); 16 Sep 2016 03:14:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 74.125.82.50 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Pp3JvoA2RpjjLcFHY6g6360qwrcZV2XtgYM0xTWhdDk=; b=LlbiEtEIOVB49xLuR1ikvWLTIzHIfBe6yelXSXhcCBwqO8aJVNXOBsytCl+C9skvOj RWbJ5JrKkJjYFNKfWIu8/VRDMNxw8oU3f2HbhXuZm+m24IZelsu37CPPr/vLH1UNzy9g 9R9+XrTPMY7hPx65v65gAS2lixxDOuPT1b+BKzBZqrxheiG5P3UmkVqohTQYdWluWW2U I5VUnLA+comd5EuzkyqYo2gXLsvvg0KgNYprLyQjvwtnlmifp2yzY1WUDc2UiU8yDFMt F2CHa5VtvjSHXw3uLT5nafL03XbELAACZ0eNHl06bR5aODu64MyqHQXdKIe7p9F5x36U 9GtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Pp3JvoA2RpjjLcFHY6g6360qwrcZV2XtgYM0xTWhdDk=; b=N/uAGO3U8ZsBwVqiatu8JQuF4AopzYH4X4YRKa6JB21LpbXdq18wofd1MJy9E3zQWx hPV6GIRFYh6aIN0yleiWgrd+DxRUn40R3VxCjpReFvrphPuSbnLr1wL0IFTgB4O0G3v9 LLOWBSh+seTNAd0OiuunFQgTofA9QYAKh3o0j7aM546djsovjqjzg9voNSI6WR1Vrw00 1iw3OXM9GVkJ62s0de+3+rS1FJrvxAw6hu73Y5R5mZ/DlRxkYCQl9791Qj6LJEmn93bA 2bwtKiMPNP2iswwvK6VKTCljoS0IKmgfdkdFnxtCedbog6ffMzXUf0qUrLMrdQWyGkUe zyKw== X-Gm-Message-State: AE9vXwNZ4w5jFo0Jjhvn4yPsDK8BTFAJBVwXFVAt/a26qEPjb0WLk94G+bSBY6gvrPznUw== X-Received: by 10.194.80.104 with SMTP id q8mr7603820wjx.83.1473938572689; Thu, 15 Sep 2016 04:22:52 -0700 (PDT) Date: Thu, 15 Sep 2016 12:22:50 +0100 From: Stephane Chazelas To: Oliver Kiddle , zsh-workers@zsh.org Subject: wrong "export -p" output for exported but not set variables (Was: PATCH: [[ -v varname ]]) Message-ID: <20160915112250.GA16661@chaz.gmail.com> Mail-Followup-To: Oliver Kiddle , zsh-workers@zsh.org References: <20160905212754.24998-1-tgyurci@gmail.com> <20160908093516.4fc2dd1e@pwslap01u.europe.root.pri> <20160908121628.78977edd@pwslap01u.europe.root.pri> <20160908143128.GA14933@chaz.gmail.com> <20160909085231.GA9717@chaz.gmail.com> <90414.1473890510@hydra.kiddle.eu> <20160915110854.GA10122@chaz.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160915110854.GA10122@chaz.gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) 2016-09-15 12:08:54 +0100, Stephane Chazelas: [...] > declared (or exported or marked readonly) with different types > but not assigned to (at least in zsh, declared/exported > variables are always given a default value) [...] Actually, I was wrong about that and was basing it on the output of typeset -p. $ zsh -c 'export a; export -p a' typeset -x a='' (BTW, it would be nice to have sh-compatible (POSIX at least) output in: $ ARGV0=sh zsh -c 'export a; export -p a' typeset -x a='' ) $ zsh -c 'export a; printenv a' $ zsh -c 'export a=; printenv a' $ $a was not given a default empty value there. It's considered as set though: $ zsh -c 'export a; echo ${a+foo}' foo Which I think breaks POSIX compliance (and no other shell outputs foo there).. It's different for "readonly": $ zsh -c 'readonly a; echo ${a+foo}' foo $ ARGV0=sh zsh -c 'readonly a; echo ${a+foo}' $ -- Stephane