RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1173668 - Issue with initialization of nested associative arrays
Summary: Issue with initialization of nested associative arrays
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: ksh
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Hlavinka
QA Contact: Martin Kyral
URL:
Whiteboard:
Depends On:
Blocks:
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)
Environment:
Last Closed: 2015-07-22 06:56:25 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1450 0 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:

---8<---
#!/bin/ksh

typeset -A foo
typeset -A foo[bar]
foo[bar][x]=2
(( foo[bar][x]++ ))
set | grep foo
---8<---

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

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

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

---%<---
#!/bin/ksh
typeset -A foo
typeset -A foo[bar]
set | grep foo
---%<---

results in:
---8<---
_='foo[bar]'
foo=([bar]=([0]='') )
---8<---

The above, and a few more details were reported upstream at
http://lists.research.att.com/pipermail/ast-users/2014q4/004685.html

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

---8<---
2014-12-12 13:23 GMT-02:00 David Korn <dgkorn>:
> 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...]

Thanks!
Paulo
---8<---

Comment 1 Paulo Andrade 2014-12-12 15:54:46 UTC
Created attachment 967695 [details]
ksh-20120801-array.patch

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
reproducible

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.

https://rhn.redhat.com/errata/RHBA-2015-1450.html


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