zsh-workers
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <larryv@zsh.org>
To: "Michael Smith" <michael.smith@cloudera.com>
Cc: zsh-workers@zsh.org
Subject: Re: Bug: 'export FOO' not idempotent
Date: Mon, 27 Jun 2022 17:43:48 -0400	[thread overview]
Message-ID: <3accd9cb-aede-41ce-96e6-f3e175392b9d@www.fastmail.com> (raw)
In-Reply-To: <CAJV0PfLODd17k524MTGDkdsL0nYzsLL7tp08wXFxSU_uuuq+GA@mail.gmail.com>

On Mon, Jun 27, 2022, at 5:11 PM, Michael Smith wrote:
> Environments tested:
> - macOS 12.4, M1 chip, zsh 5.8.1 (x86_64-apple-darwin21.0)
> - Ubuntu 20.04.4, zsh 5.8 (x86_64-ubuntu-linux-gnu)
>
> If I repeat 'export FOO' to mark an environment variable not give it a 
> value, in bash it consistently does not show up in 'env':
> $ export FOO
>
> $ env | grep FOO
>
> $ export FOO
>
> $ env | grep FOO
>
>
> but in zsh the 2nd invocation will set it to an empty string:
> $ export FOO
>
> $ env | grep FOO
>
> $ export FOO                                                            
>            $ env | grep FOO
>
> FOO=

This was discussed in workers/47531 and the ensuing thread.

https://www.zsh.org/mla/workers/2020/msg01350.html

It was resolved in zsh 5.9 with the introduction of the TYPESET_TO_UNSET
option, but as per workers/47545, "[t]his is a long standing feature
of zsh, so the default behaviour is not going to change."

https://www.zsh.org/mla/workers/2020/msg01364.html


> This is an issue only because a project I'm building uses an empty 
> export for documentation, and it makes that project annoying to work 
> with.

Depending on a variable to be exported but unset is a curious design
decision to say the least.

-- 
vq


  reply	other threads:[~2022-06-27 21:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 21:11 Michael Smith
2022-06-27 21:43 ` Lawrence Velázquez [this message]
2022-06-27 21:46   ` Michael Smith
2022-06-27 21:52     ` Lawrence Velázquez
2022-06-27 21:58       ` Roman Perepelitsa
2022-06-27 22:37         ` Lawrence Velázquez
2022-07-02 22:05           ` Bart Schaefer
2022-07-02 22:14             ` Bart Schaefer
2022-06-27 21:50   ` Roman Perepelitsa

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=3accd9cb-aede-41ce-96e6-f3e175392b9d@www.fastmail.com \
    --to=larryv@zsh.org \
    --cc=michael.smith@cloudera.com \
    --cc=zsh-workers@zsh.org \
    /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).