zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Regression of typeset output with "private"
Date: Fri, 16 Feb 2024 22:29:10 -0800	[thread overview]
Message-ID: <CAH+w=7YCPhUV=vRW2ue46N2+ZCpE+HeS_nG1CR36ZqwnV06hNA@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7YVBsN-4-TJaTVzzexyEmBq_1pp810TYe_faZPNVmw5wg@mail.gmail.com>

On Fri, Feb 16, 2024 at 12:09 PM Bart Schaefer
<schaefer@brasslantern.com> wrote:
>
> Tangentially, I think there's a regression with "private":
>
> () {
>   zmodload zsh/param/private
>   private foo=local
>   typeset -p foo
> }
>
> That now prints nothing, whereas in e.g. 5.7 it would say
>   typeset foo=local
> which isn't precisely accurate either.

Traced this to here:

>> commit f99f7dca7552d21782354f675c0741896c9785f1
>> Author: Peter Stephenson <p.stephenson@samsung.com>
>> Date:   Mon Oct 8 10:10:42 2018 +0100
>>
>>     43616: Various parameter setting and display fixes.

Specifically to this (pardon any excessive gmail line wrapping):

-    if (printflags & PRINT_TYPESET) {
-       if ((p->node.flags & (PM_READONLY|PM_SPECIAL)) ==
-           (PM_READONLY|PM_SPECIAL) ||
-           (p->node.flags & PM_AUTOLOAD)) {
+    if (printflags & (PRINT_TYPESET|PRINT_POSIX_READONLY|PRINT_POSIX_EXPORT)) {
+       if (p->node.flags & (PM_RO_BY_DESIGN|PM_AUTOLOAD)) {
            /*
             * It's not possible to restore the state of
             * these, so don't output.
             */
            return;
        }


Leaving out PM_RO_BY_DESIGN restores the old behavior.  I understand
the motivation here (the comment), and if we were printing all values
("typeset -p" with no other arguments) it would make more sense, but
in the context of explicitly asking for "typeset -p foo" it surely
ought to print ... something?


  reply	other threads:[~2024-02-17  6:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 20:09 Is this intentional behavior of typeset -g ? Bart Schaefer
2024-02-17  6:29 ` Bart Schaefer [this message]
2024-02-18 19:35   ` Regression of typeset output with "private" Bart Schaefer
2024-02-20  4:54     ` [PATCH] (take 2) Local specials and " Bart Schaefer

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='CAH+w=7YCPhUV=vRW2ue46N2+ZCpE+HeS_nG1CR36ZqwnV06hNA@mail.gmail.com' \
    --to=schaefer@brasslantern.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).