zsh-workers
 help / color / mirror / code / Atom feed
* [BUG] Shell option PRINT_EXIT_VALUE lost on function exit, even when LOCAL_OPTIONS is not set
@ 2023-07-12  7:54 Marlon Richert
  2023-07-12 13:05 ` Mikael Magnusson
  0 siblings, 1 reply; 4+ messages in thread
From: Marlon Richert @ 2023-07-12  7:54 UTC (permalink / raw)
  To: Zsh hackers list

% print $ZSH_PATCHLEVEL
zsh-5.9-0-g73d3173
% setopt
interactive
monitor
norcs
shinstdin
zle
% () { setopt printexitvalue; setopt }
interactive
monitor
printexitvalue
norcs
shinstdin
zle
% setopt
interactive
monitor
norcs
shinstdin
zle
% setopt printexitvalue
% setopt
interactive
monitor
printexitvalue
norcs
shinstdin
zle
%

Also, setopt should list it _after_ norcs, not before (presuming we
want it to list options alphabetically).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] Shell option PRINT_EXIT_VALUE lost on function exit, even when LOCAL_OPTIONS is not set
  2023-07-12  7:54 [BUG] Shell option PRINT_EXIT_VALUE lost on function exit, even when LOCAL_OPTIONS is not set Marlon Richert
@ 2023-07-12 13:05 ` Mikael Magnusson
  2023-08-25  6:55   ` Marlon Richert
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2023-07-12 13:05 UTC (permalink / raw)
  To: Marlon Richert; +Cc: Zsh hackers list

On 7/12/23, Marlon Richert <marlon.richert@gmail.com> wrote:
> % print $ZSH_PATCHLEVEL
> zsh-5.9-0-g73d3173
> % setopt
> interactive
> monitor
> norcs
> shinstdin
> zle
> % () { setopt printexitvalue; setopt }
> interactive
> monitor
> printexitvalue
> norcs
> shinstdin
> zle
> % setopt
> interactive
> monitor
> norcs
> shinstdin
> zle
> % setopt printexitvalue
> % setopt
> interactive
> monitor
> printexitvalue
> norcs
> shinstdin
> zle
> %
>
> Also, setopt should list it _after_ norcs, not before (presuming we
> want it to list options alphabetically).

options are sorted ignoring the "no" prefix.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] Shell option PRINT_EXIT_VALUE lost on function exit, even when LOCAL_OPTIONS is not set
  2023-07-12 13:05 ` Mikael Magnusson
@ 2023-08-25  6:55   ` Marlon Richert
  2023-08-25  9:04     ` Lawrence Velázquez
  0 siblings, 1 reply; 4+ messages in thread
From: Marlon Richert @ 2023-08-25  6:55 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Zsh hackers list

On Wed, Jul 12, 2023 at 4:05 PM Mikael Magnusson <mikachu@gmail.com> wrote:
>
> On 7/12/23, Marlon Richert <marlon.richert@gmail.com> wrote:
> > % print $ZSH_PATCHLEVEL
> > zsh-5.9-0-g73d3173
> > % setopt
> > interactive
> > monitor
> > norcs
> > shinstdin
> > zle
> > % () { setopt printexitvalue; setopt }
> > interactive
> > monitor
> > printexitvalue
> > norcs
> > shinstdin
> > zle
> > % setopt
> > interactive
> > monitor
> > norcs
> > shinstdin
> > zle
> > % setopt printexitvalue
> > % setopt
> > interactive
> > monitor
> > printexitvalue
> > norcs
> > shinstdin
> > zle
> > %
> >
> > Also, setopt should list it _after_ norcs, not before (presuming we
> > want it to list options alphabetically).
>
> options are sorted ignoring the "no" prefix.

Fair enough, but the rest of my bug report is still valid.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] Shell option PRINT_EXIT_VALUE lost on function exit, even when LOCAL_OPTIONS is not set
  2023-08-25  6:55   ` Marlon Richert
@ 2023-08-25  9:04     ` Lawrence Velázquez
  0 siblings, 0 replies; 4+ messages in thread
From: Lawrence Velázquez @ 2023-08-25  9:04 UTC (permalink / raw)
  To: Marlon Richert; +Cc: Mikael Magnusson, Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 740 bytes --]

> On Aug 25, 2023, at 2:56 AM, Marlon Richert <marlon.richert@gmail.com> wrote:
> Fair enough, but the rest of my bug report is still valid.

The behavior you reported is documented under LOCAL_OPTIONS, although it might be helpful to mention it under PRINT_EXIT_VALUE as well.

LOCAL_OPTIONS <K>
If this option is set at the point of return from a shell function, most options (including this one) which were in force upon entry to the function are restored; options that are not restored are PRIVILEGED and RESTRICTED. Otherwise, only this option, and the LOCAL_LOOPS, XTRACE and PRINT_EXIT_VALUE options are restored.

https://zsh.sourceforge.io/Doc/Release/Options.html#index-LOCAL_005fOPTIONS

-- 
vq
Sent from my iPhone

[-- Attachment #2: Type: text/html, Size: 1687 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-25  9:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-12  7:54 [BUG] Shell option PRINT_EXIT_VALUE lost on function exit, even when LOCAL_OPTIONS is not set Marlon Richert
2023-07-12 13:05 ` Mikael Magnusson
2023-08-25  6:55   ` Marlon Richert
2023-08-25  9:04     ` Lawrence Velázquez

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).