Bug 1261314

Summary: ksh segfaults under specific circumstances
Product: Red Hat Enterprise Linux 6 Reporter: Vasil Yonkov <vyonkov>
Component: kshAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.7   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-09 08:22:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
ksh segfaults when this example is run (along with add.sh)
none
ksh segfaults when this example is run (along with add.sh) none

Description Vasil Yonkov 2015-09-09 07:46:26 UTC
Created attachment 1071603 [details]
ksh segfaults when this example is run (along with add.sh)

Description of problem:
ksh segfaults when the attached example is run.

Version-Release number of selected component (if applicable):
This was introduced in ksh-20120801-28. ksh-20120801-21 doesn't have such problem.

How reproducible:
100%

Steps to Reproduce:
1. Put 'test.sh' and 'add.sh' into a directory and run 'test.sh'

Actual results:
<current date>
Segmentation fault

Expected results:
<current date>
not to segfault

Additional info:
The setup should really have all the components from the attached example.
If any of the following changes are made, ksh does not segfault:
 - no trap set
 - the trap is not a null string
 - any command (for example - date) is executed before *both* variable and fuction declaration
 - 'just_a_variable' is not the result of a subshell
 - the function is declared using the C-style syntax ( name () {} )
 - the function is not called
 - add.sh does not spawn a subshell

Comment 1 Vasil Yonkov 2015-09-09 07:49:26 UTC
Created attachment 1071599 [details]
ksh segfaults when this example is run (along with add.sh)

Comment 3 Michal Hlavinka 2015-09-09 08:22:24 UTC

*** This bug has been marked as a duplicate of bug 1247383 ***

Comment 4 Vasil Yonkov 2015-09-09 08:37:55 UTC
There seems to be a problem with me adding attachments, so I'll just paste the sripts here:

-- | This is 'test.sh':

#!/usr/bin/env ksh

trap '' HUP

# date

just_a_variable="$( date )"

function temp
{
    os="$( uname )"
    PACE_VAL=2
    dir="$( pwd )"
}

temp

. ./add.sh


-- | This is 'add.sh':

#!/usr/bin/env ksh

( date )