Discussion:
[ast-developers] Reproducer scripts for a ksh93 variable's failing to be unset bug
Kalman Reti
2013-10-31 13:54:57 UTC
Permalink
This (tiny) tar file contains a set of reproducer scripts (written by a
colleague)
whittled down from a larger and much more complicated original test
case. The original test case was trying to make sure that a particular
script wasn't recursively invoked between its beginning and end, so it
set a unique variable at the beginning and unset it at the end. The bug
is that if this script was called twice in a row, the second invocation
would erroneously see the unique variable set, i.e. the unset somehow
failed to happen.

In the whittled down script, both the nested dotting in and the extra
variables
(defined after the unique variable in the bottom script) are necessary for
the
bug to appear; remove even one of the variables or a level of dotting and
the bug does not occur.

I downloaded and compiled the most recent release and alpha versions
from the site, and the bug reproduced in both. (I was on a RHEL 6.0
platform). The versions of ksh93 in all current Red Hat 6 and SuSe 11
versions
exhibit the bug. It does not fail in the Red Hat 5.7 version of ksh93 which
reports as 93t+ 2010-02-02.

There is a readme in the tar file, but basically you get t4.ksh which
defines
a function which dots in t4a.ksh which defines a function which dots in
t4b.ksh,
the final level. This last conditionally sets ccc at the begining and
complains
if it is already set. Then it defines several other variables and finally
unsets ccc.

The top level script invokes the function it defines twice, and the error
occurs
when the second invocation of the bottom script sees ccc set at the
beginning.
If the script t4.ksh script produces no output, that's a success, if it
complains
that ccc shouldn't be set, that's a failure.

Sincerely,

Kalman Reti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.research.att.com/pipermail/ast-developers/attachments/20131031/59ece8c5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t4.tar
Type: application/x-tar
Size: 10240 bytes
Desc: not available
URL: <http://lists.research.att.com/pipermail/ast-developers/attachments/20131031/59ece8c5/attachment-0001.tar>
Loading...