[ to you only ] it looks like the solaris (and possibly posix) behavior can be replicated by b_sleep() setting SIGALRM to SIG_IGN while it is sleeping -- how hard would that be to implement (e.g., proper SIGALRM reset if other signals arrive)
On Fri, 15 Aug 2008 11:22:56 -0700 (PDT) April Chin wrote: > --Gang_of_Elks_853_000 > Content-Type: TEXT/plain; charset=us-ascii > Content-MD5: tw8KD3dLGMJcEMAP6mLXBg== > > X-Original-To: ksh93-integration-discuss at opensolaris.org > > Delivered-To: ksh93-integration-discuss at opensolaris.org > > Date: Fri, 15 Aug 2008 13:58:01 -0400 > > From: Glenn Fowler <gsf at research.att.com> > > To: ksh93-integration-discuss at opensolaris.org > > Subject: Re: [ksh93-integration-discuss] [Bug 571] New: AST sleep SIGALRM > behavior incompatible with Solaris /usr/bin/sleep > > List-Id: Korn Shell 93 integration/migration project discussion > <ksh93-integration-discuss.opensolaris.org> > > > > > > On Fri, 15 Aug 2008 10:05:19 -0700 (PDT) bugzilla-daemon at np.grommit.com > > wrote: > > > > > In the next ksh93 update in Solaris, the ksh93 built-in sleep will be > replacing > > > Solaris /usr/bin/sleep. > > > > > Solaris /usr/bin/sleep will catch the SIGALRM but do nothing. The sleep > > > continues and effectively ignores the signal, eventually exiting with > > > status 0. > > > > > The AST ksh93 built-in sleep will do the default action for SIGALRM: > > > it terminates and exits with 142 (128 + 14 (the signal # for SIGALRM). > > > > > Although both behaviors are allowed by the standard, the differing > > > behavior will be an incompatibility when ksh93 sleep replaces > > > Solaris /usr/bin/sleep. > > > > isn't this simply the difference between a builtin command and an a.out? > > > > can you show 2 test cases, one with /usr/bin/sleep and one with the ksh93 > builtin sleep > > I'm particularly interested in how SIGALRM is delivered > > i.e., the pid to kill in both cases > > > > -- Glenn Fowler -- AT&T Research, Florham Park NJ -- > > > > _______________________________________________ > > ksh93-integration-discuss mailing list > > ksh93-integration-discuss at opensolaris.org > > http://mail.opensolaris.org/mailman/listinfo/ksh93-integration-discuss > Hi Glenn, > Since the sleep built-in will be called via a ksh93 script, > the SIGALRM is delivered to the ksh93 process. > Example for Solaris /usr/bin/sleep: > In one terminal window: > $ /usr/bin/sleep 15 > In another window: > $ pgrep -l sleep > 1012 sleep > $ kill -ALRM 1012 > Back in the first window, the sleep continues. When it exits: > $ echo $? > 0 > For ksh93 sleep, attached is the ksh93 script which will call the sleep > built-in. If we replace /usr/bin/sleep with this script: > In one terminal window, we execute the ksh93 script which calls the sleep > built-in: > $ /usr/bin/sleep 15 > In a second window: > $ pgrep -l ksh93 > 1062 ksh93 > $ kill -ALRM 1062 > Back in the first window, the sleep script terminates immediately: > Alarm Clock > $ echo $? > 142 > Thanks, > April > --Gang_of_Elks_853_000 > Content-Type: TEXT/plain; name=sleep; charset=us-ascii; x-unix-mode=0555 > Content-Description: sleep > Content-MD5: lq1pHRjY/R0wNR5ecWHTNQ== > #!/usr/bin/ksh93 > # > # 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 "@(#)alias.sh 1.1 08/06/30 SMI" > # > # Get name of builtin > builtin basename > typeset cmd="$(basename "$0")" > # If the requested command is not an alias load it explicitly > # to make sure it is not bound to a path (those built-ins which > # are mapped via shell aliases point to commands which are > # "special shell built-ins" which cannot be bound to a specific > # PATH element) - otherwise we may execute the wrong command > # if an executable with the same name sits in a PATH element > # before /usr/bin (e.g. /usr/xpg4/bin/ls would be executed > # before /usr/bin/ls if would look like > # PATH=/usr/xpg4/bin:/usr/bin). > if ! alias "${cmd}" >/dev/null 2>&1; then > builtin ${cmd} > fi > ${cmd} "$@" > --Gang_of_Elks_853_000 > Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > _______________________________________________ > ksh93-integration-discuss mailing list > ksh93-integration-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/ksh93-integration-discuss > --Gang_of_Elks_853_000--
