zsh-users
 help / color / mirror / code / Atom feed
* typeset -T shouldn't cause an exit.
@ 2013-04-10 15:59 Larry Schrof
  2013-04-10 17:04 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Larry Schrof @ 2013-04-10 15:59 UTC (permalink / raw)
  To: zsh-users

In my .zshenv, I tie LD_LIBRARY_PATH<->ld_library_path and
CLASSPATH<->classpath.

The problem is that typeset -T causes a fatal exit 126 if one attempts to
tie
variables that are already tied. (Fatal meaning that it stops sourcing
my .zshenv at that line; it does not continue reading.) This seems both
overly
harsh and inconvenient. I'm forced to do something janky like:

typeset -T | grep -q '^LD_LIBRARY_PATH='
if [[ $? -eq 0 ]]; then
  typeset -T LD_LIBRARY_PATH ld_library_path :
fi

Can we fix this behavior so that at worst a warning is issued and zsh
continues along happily?


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

* Re: typeset -T shouldn't cause an exit.
  2013-04-10 15:59 typeset -T shouldn't cause an exit Larry Schrof
@ 2013-04-10 17:04 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2013-04-10 17:04 UTC (permalink / raw)
  To: zsh-users

On Wed, 10 Apr 2013 15:59:10 +0000
Larry Schrof <larrys@fb.com> wrote:
? In my .zshenv, I tie LD_LIBRARY_PATH<->ld_library_path and
> CLASSPATH<->classpath.
> 
> The problem is that typeset -T causes a fatal exit 126 if one attempts to
> tie
> variables that are already tied. (Fatal meaning that it stops sourcing
> my .zshenv at that line; it does not continue reading.) This seems both
> overly
> harsh and inconvenient.
> 
> Can we fix this behavior so that at worst a warning is issued and zsh
> continues along happily?

That seems entirely reasonable, but note you only get the error if it
was tied to something else before, so it's not 100% benign.

diff --git a/Src/builtin.c b/Src/builtin.c
index d91c2d9..cd88643 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2470,7 +2470,7 @@ bin_typeset(char *name, char **argv, Options ops, int func)
 			setsparam(asg0.name, ztrdup(asg0.value));
 		    return 0;
 		} else {
-		    zerrnam(name, "can't tie already tied scalar: %s",
+		    zwarnnam(name, "can't tie already tied scalar: %s",
 			    asg0.name);
 		}
 		return 1;

pws


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

end of thread, other threads:[~2013-04-10 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10 15:59 typeset -T shouldn't cause an exit Larry Schrof
2013-04-10 17:04 ` Peter Stephenson

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