* PATCH: typeset -r bug.
@ 2000-06-22 20:53 Peter Stephenson
0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2000-06-22 20:53 UTC (permalink / raw)
To: Zsh hackers list
I know you'll be too amazed to take this in, but there's a bug in typeset.
% foo='Perfectly ordinary parameter minding its own business'
% typeset -r foo='Readonly parameter, but only after typeset has finished'
zsh: read-only variable: foo
The readonly flag was assigned too early.
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.23
diff -u -r1.23 builtin.c
--- Src/builtin.c 2000/06/12 09:27:09 1.23
+++ Src/builtin.c 2000/06/22 20:51:37
@@ -1622,7 +1622,7 @@
arrfixenv(pm->nam, x);
}
}
- pm->flags = (pm->flags | on) & ~(off | PM_UNSET);
+ pm->flags = (pm->flags | (on & ~PM_READONLY)) & ~(off | PM_UNSET);
/* This auxlen/pm->ct stuff is a nasty hack. */
if ((on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER |
PM_EFLOAT | PM_FFLOAT)) &&
@@ -1643,6 +1643,7 @@
zwarnnam(cname, "can't assign new value for array %s", pname, 0);
return NULL;
}
+ pm->flags |= (on & PM_READONLY);
return pm;
}
--
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@CambridgeSiliconRadio.com
Web: http://www.pwstephenson.fsnet.co.uk
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-06-22 20:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-22 20:53 PATCH: typeset -r bug 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).