Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Failure of "typeset" and exit status



torch% ( () { typeset +g -m \* && echo No error } )
(anon): failed to change user ID: operation not permitted
(anon): failed to change group ID: operation not permitted
(anon): failed to change effective user ID: operation not permitted
(anon): failed to change effective group ID: operation not permitted
No error
torch% 

OK, that's not SO bad, except that "typeset +g -m \*" is intended to
have made all the variables local ... which it has NOT, as you can see
(be sure to do this in a subshell if you try it yourself):

torch% ( () { typeset +g -m \* && unset -m \* } && typeset -p )
(anon): failed to change user ID: operation not permitted
(anon): failed to change group ID: operation not permitted
(anon): failed to change effective user ID: operation not permitted
(anon): failed to change effective group ID: operation not permitted
(anon): read-only variable: HISTCMD
torch% 

If I add the -h flag to mask specials, it works as expected:

torch% ( () { typeset +g -h -m \* && unset -m \* } && typeset -p )
typeset 0=Src/zsh
...
typeset zsh_scheduled_events
torch% 

Why did failure on those five variables result in ignoring +g for all of
the other variables?  And if failure is going to be treated as idempotent,
shouldn't it exit nonzero?

-- 
Barton E. Schaefer



Messages sorted by: Reverse Date, Date, Thread, Author