*Synopsis*: *ksh93* (20080624_snapshot) doesn't execute CHLD trap

CR 6722134 changed on Jul 31 2008 by <User 1-6Y4MMS>

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

Description            New Note                                               
====================== =========================== ===========================


*Change Request ID*: 6722134

*Synopsis*: *ksh93* (20080624_snapshot) doesn't execute CHLD trap

  Product: solaris
  Category: shell
  Subcategory: korn93
  Type: Defect
  Subtype: 
  Status: 6-Fix Understood
  Substatus: 
  Priority: 5-Very Low
  Introduced In Release: 
  Introduced In Build: 
  Responsible Engineer: <User 1-5Q-5151>
  Keywords: opensolaris

=== *Description* ============================================================
Category
   shell
Sub-Category
   korn
Description
   With "set -o monitor" on and "set -o notify" off, ksh88 executes the CHLD
trap while waiting for interactive input when a background job completes.
ksh93 appears not to execute the CHLD trap when a background job terminates.
Probably related:  I noticed that with no CHLD trap set, but -o monitor and
-o notify set, there should be a similar asynchronous job completion notice.
It works in ksh88 but not in this ksh93 build.
Frequency
   Always
Regression
   Solaris 10
Steps to Reproduce
   $ ksh93
$ set -o monitor
$ trap -- 'jobs -l' CHLD
$ sleep 5 &
$           # (wait at the prompt for the background job to complete.)
Expected Result
   $ sleep 5 &
[1]     12451
$ 
[1] + 12451      Done                    sleep 5 &
      (When the background job finishes, 'jobs -l' is executed.
      If you hit return afterward you will just get a prompt.)
Actual Result
   $ sleep 5 &
[1]     12454
$ 
      (There is no output at all when the background job finishes.
      If you hit return you will get the job notice resulting from the
      monitor option.)
Error Message(s)
   
Test Case
   
Workaround
   
Submitter wants to work on bug
   No
Additional configuration information
   Tried on snv_62 and snv_81.

*** (#1 of 2): 2008-07-03 02:35:19 GMT+00:00 <User 1-F4SZV>

Testcase (this is a module for the ksh93 test suite) to reproduce the problem:
-------- snip --------
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I%     %E% SMI"
#

function err_exit
{
        print -u2 -n "\t"
        print -u2 -r ${Command}[$1]: "${@:2}"
        (( Errors+=1 ))
}

alias err_exit='err_exit $LINENO'

integer Errors=0

s="$($SHELL -c '
set -o errexit
integer i

trap "print got_child" SIGCHLD

sleep 5 &
sleep 7 &
for ((i=0 ; i < 15 ; i++)) ; do
      print $i
      sleep 1
      
      # external, non-background command for which a SIGCHLD should
      # _not_ be fired
      /bin/true >/dev/null
done
print "loop finished"
wait
print "done"
' 2>&1 )" || err_exit "test loop failed."

[[ "$s" == ~(Er)$'14\nloop finished\ndone' ]] || err_exit "Expected '14\nloop 
finished\ndone' at the end of the output, got ${s}."
[[ "$s" == ~(El)$'0\n1\n2' ]] || err_exit "Expected '0\n1\n2' as at the 
beginning of the output, got ${s}."

integer count
(( count=$(fgrep "got_child" <<< "$s" | wc -l) )) || err_exit "counting failed."
(( count == 2 )) || err_exit "Expected count==2, got count==${count}."

exit $((Errors))
# EOF.
-------- snip --------

*** (#2 of 2): 2008-07-31 23:14:03 GMT+00:00 <User 1-6Y4MMS>


=== *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: 2008-07-03 02:35:19 GMT+00:00
        Submitted By: <User 1-F4SZV>

        Status Changed    Date Updated                  Updated By
        6-Fix Understood  2008-07-03 18:45:45 GMT+00:00 <User 1-5Q-5151>


=== *Service Request* ========================================================
        Impact: Limited
        Functionality: Secondary
        Severity: 4
        Product Name: solaris
        Product Release: solaris_nevada
        Product Build: snv_81
        Operating System: solaris_nevada
        Hardware: x86
        Submitted Date: 2008-07-03 02:35:20 GMT+00:00


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



Reply via email to