*Synopsis*: ksh93 crash with static IFS

Due to a change requested by <User 1-5Q-1267>,
this CR is being redispatched:

CR 6990608 changed on Oct 12 2010 by <User 1-5Q-1267>

=== Field ============ === New Value ============= === Old Value =============

Public Comments        New Note                                               
Status                 1-Dispatched                11-Closed                  
SubStatus                                          Not Reproducible           
====================== =========================== ===========================

     
*Change Request ID*: 6990608

*Synopsis*: ksh93 crash with static IFS

  Product: solaris
  Category: shell
  Subcategory: korn93
  Type: Defect
  Subtype: 
  Status: 1-Dispatched
  Substatus: 
  Priority: 3-Medium
  Introduced In Release: 
  Introduced In Build: 
  Responsible Engineer: 
  Keywords: opensolaris

=== *Description* ============================================================
Category
    shell
Sub-Category
    korn93
Description
    The test case here crashes /bin/ksh93:
=================================
function printarray
{
        typeset mode=$1
        nameref ar=$2
        typeset -S IFS # static variable
        
        if [[ $mode == 'set' ]] ; then
                IFS=';'
        elif [[ $mode == 'unset' ]] ; then
                unset IFS
        fi
        
        print -- "${ar[*]}"
}
function run
{
        typeset -a data=(
                'aaa'
                'bbb'
                'ccc'
                'ddd'
        )
        
        printarray set data
        printarray print data
        printarray unset data
        print -- "${data[*]}"
        printarray set data
        printarray print data
        printarray unset data
        print -- "${data[*]}"
}
run
=================================
gdb is less than useful with optimized code:
(gdb) bt
#0  0x00000001001199f0 in ?? ()
#1  0xffffffff7d5535ec in sh_macexpand () from /usr/lib/64/libshell.so.1
#2  0xffffffff7d538370 in sh_argbuild () from /usr/lib/64/libshell.so.1
#3  0xffffffff7d582488 in sh_exec () from /usr/lib/64/libshell.so.1
#4  0xffffffff7d582404 in sh_exec () from /usr/lib/64/libshell.so.1
#5  0xffffffff7d588894 in sh_funscope () from /usr/lib/64/libshell.so.1
#6  0xffffffff7d588cfc in sh_funct () from /usr/lib/64/libshell.so.1
#7  0xffffffff7d583ea4 in sh_exec () from /usr/lib/64/libshell.so.1
#8  0xffffffff7d5823d8 in sh_exec () from /usr/lib/64/libshell.so.1
#9  0xffffffff7d588894 in sh_funscope () from /usr/lib/64/libshell.so.1
#10 0xffffffff7d588cfc in sh_funct () from /usr/lib/64/libshell.so.1
#11 0xffffffff7d583ea4 in sh_exec () from /usr/lib/64/libshell.so.1
#12 0xffffffff7d55c87c in exfile () from /usr/lib/64/libshell.so.1
#13 0xffffffff7d55bc44 in sh_main () from /usr/lib/64/libshell.so.1
#14 0x0000000100000d60 in main ()
Frequency
    Always
Regression
    no
Steps to Reproduce
    Run testcase
Expected Result
    aaa;bbb;ccc;ddd
aaa;bbb;ccc;ddd
aaa bbb ccc ddd
aaa bbb ccc ddd
aaa;bbb;ccc;ddd
aaa;bbb;ccc;ddd
aaa bbb ccc ddd
aaa bbb ccc ddd
Actual Result
    crash, coredump
Error Message(s)
    coredump
Test Case
    function printarray
{
        typeset mode=$1
        nameref ar=$2
        typeset -S IFS # static variable
        
        if [[ $mode == 'set' ]] ; then
                IFS=';'
        elif [[ $mode == 'unset' ]] ; then
                unset IFS
        fi
        
        print -- "${ar[*]}"
}
function run
{
        typeset -a data=(
                'aaa'
                'bbb'
                'ccc'
                'ddd'
        )
        
        printarray set data
        printarray print data
        printarray unset data
        print -- "${data[*]}"
        printarray set data
        printarray print data
        printarray unset data
        print -- "${data[*]}"
}
run
Workaround
    Make typeset -S a global variable
Additional configuration information
    Solaris 11, tosiba laptop

*** (#1 of 2): 2010-10-08 14:00:59 GMT+00:00 <User 1-9HOB9N>

I don't see this on a system running build 150.

*** (#2 of 2): 2010-10-08 14:22:36 GMT+00:00 <User 1-5Q-4611>


=== *Public Comments* ========================================================
Sent a mail to the submitter asking which build he saw this problem on.
Haven't heard from him.
I am closing this CR as not reproducible.
As AlanC pointed out build 134 was the last build community have access
to, so I suggest, please check if you see this issue with 134, if so
discuss with ksh93 community to figure which CR fixed this issue
and make those chanes in your workpace.

*** (#1 of 2): 2010-10-12 06:21:05 GMT+00:00 <User 1-5Q-4611>

ksh93 project lead Roland Mainz reports:

I can reproduce the bug, but it is not easy (understatement) to hit it.
The bug here is a memory corruption which depends on precise memory
layout and allocation/deallocation sequence. Depending on what's in
the environment variables and other things like layout of the script
you may hit it or not.
The good news is that newer ksh93 versions no longer have that, this
was likely killed when we tightened the testing for static variables
(that's why I wrote the test module in
http://svn.genunix.org/repos/on/branches/ksh93/gisburn/scripts/tests/sun_solaris_staticvariables.sh
and later enhanced it a lot to drive out all the crazy bugs hiding
there...).

*** (#2 of 2): 2010-10-12 15:13:07 GMT+00:00 <User 1-5Q-1267>


=== *Workaround* =============================================================

=== *Additional Details* =====================================================
        Targeted Release: 
        Commit To Fix In Build: 
        Fixed In Build: 
        Integrated In Build: 
        Verified In Build: 
  See Also: 
  Duplicate of: 
  Hooks:
        Hook1: 
        Hook2: 
        Hook3: 
        Hook4: 
        Hook5: 
        Hook6: <email address omitted>
  Program Management: 
  Root Cause: 
  Fix Affects Documentation: No
  Fix Affects Localization: No

=== *History* ================================================================
        Date Submitted: 2010-10-08 14:00:58 GMT+00:00
        Submitted By: <User 1-9HOB9N>

        Status Changed    Date Updated                  Updated By
        11-Closed         2010-10-12 06:21:05 GMT+00:00 <User 1-5Q-4611>
        1-Dispatched      2010-10-12 15:13:06 GMT+00:00 <User 1-5Q-1267>


=== *Service Request* ========================================================
        Impact: Critical
        Functionality: Primary
        Severity: 1
        Product Name: solaris
        Product Release: solaris_nevada
        Product Build: snv_01
        Operating System: solaris_nevada
        Hardware: generic
        Submitted Date: 2010-10-08 14:00:59 GMT+00:00


=== *Multiple Release (MR) Cluster* - 0 ======================================

_______________________________________________
ksh93-integration-discuss mailing list
ksh93-integration-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/ksh93-integration-discuss

Reply via email to