Bug 1173668 - Issue with initialization of nested associative arrays
Summary: Issue with initialization of nested associative arrays
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: ksh
Version: 6.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Michal Hlavinka
QA Contact: Martin Kyral
Depends On:
TreeView+ depends on / blocked
Reported: 2014-12-12 15:52 UTC by Paulo Andrade
Modified: 2015-07-22 06:56 UTC (History)
3 users (show)

Fixed In Version: ksh-20120801-24.el6
Doc Type: Bug Fix
Doc Text:
A nested associative array contained an unexpected extra empty value after the array was initialized. This update fixes a bug in the associative array initialization code that was causing this problem. As a result, newly-created nested associative arrays are empty as expected.
Clone Of:
: 1193557 (view as bug list)
Last Closed: 2015-07-22 06:56:25 UTC

Attachments (Terms of Use)
ksh-20120801-array.patch (493 bytes, patch)
2014-12-12 15:54 UTC, Paulo Andrade
no flags Details | Diff

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1450 normal SHIPPED_LIVE ksh bug fix update 2015-07-20 18:43:49 UTC

Description Paulo Andrade 2014-12-12 15:52:48 UTC
This problem is specific to all releases, and fedora, up
to rawhide.

  There is an issue with initialization of nested associative
arrays. The test case is:


typeset -A foo
typeset -A foo[bar]
(( foo[bar][x]++ ))
set | grep foo

  On recent fedora and rhel, it will print:
foo=([bar]=([0]='' [x]=3) )

  I have been told on other systems, earlier ksh would print:
foo=([bar]=([0]='' [x]=2) [x]=1)

  But the current Fedora and Rhel result is still not
"good". For example, with a smaller test case, just
creating foo[bar]:

typeset -A foo
typeset -A foo[bar]
set | grep foo

results in:
foo=([bar]=([0]='') )

The above, and a few more details were reported upstream at

Here is a cut&paste of an off-list mail that should
make it easier to see the proposed patch is good:

2014-12-12 13:23 GMT-02:00 David Korn <dgkorn@gmail.com>:
> Thanks for the report and the patch.  However, on the recent beta version
> 93v- 2014-09-29. I am not able to reproduce the bug (at least on ubuntu
> Linux).

  I will make an official RedHat bug report, as it looks like my patch is
good :) For earlier releases it is very unlikely to make a backport of
latest ksh, and usually should only pull patches if a problem is found.

> You can download this release from www.research.att.com/sw/download/beta/
> If you have the problem with this, let me know.

  Looks like I rediscovered the patch :) I downloaded the latest
sources and it has:

        if(fp || (value && value!=Empty))

my patch only had extra spaces:

-        if(fp || value)
+        if(fp || (value && value != Empty))

[...quoted email here...]


Comment 1 Paulo Andrade 2014-12-12 15:54:46 UTC
Created attachment 967695 [details]

This patch is for rhel-7, but this is a one liner
that should be trivial to adapt, but should not
need any changes to apply to fedora or earlier rhel.

Comment 3 Michal Hlavinka 2014-12-12 16:30:28 UTC

Comment 8 errata-xmlrpc 2015-07-22 06:56:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.