priocntl workaround for Solaris 9 pty-close bug
authorTom Yu <tlyu@mit.edu>
Fri, 13 Feb 2004 03:19:30 +0000 (03:19 +0000)
committerTom Yu <tlyu@mit.edu>
Fri, 13 Feb 2004 03:19:30 +0000 (03:19 +0000)
Implement gross hack to use priocntl to work around the Solaris 9
pty-close bug.  Run expect at a higher class "FX" priority than
spawned processes, which run at a lower class "FX" priority.  "make
check" needs to start from a process which has FX priority >= 30 and
FX priority limit >= 30.  Thanks to Bill Sommerfeld for the hints.

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16069 dc483132-0cff-0310-8789-dd5450dbe970

22 files changed:
src/ChangeLog
src/aclocal.m4
src/config/ChangeLog
src/config/shlib.conf
src/configure.in
src/lib/kadm5/ChangeLog
src/lib/kadm5/configure.in
src/lib/kadm5/unit-test/ChangeLog
src/lib/kadm5/unit-test/Makefile.in
src/lib/kadm5/unit-test/config/unix.exp
src/lib/rpc/unit-test/ChangeLog
src/lib/rpc/unit-test/Makefile.in
src/lib/rpc/unit-test/config/unix.exp
src/lib/rpc/unit-test/configure.in
src/tests/ChangeLog
src/tests/configure.in
src/tests/dejagnu/ChangeLog
src/tests/dejagnu/Makefile.in
src/tests/dejagnu/config/ChangeLog
src/tests/dejagnu/config/default.exp
src/util/ChangeLog
src/util/Makefile.in

index 047a8aa2e159ca739055da2085136b20bb6ec5b4..531ba7e65f687400b04219d983e320302818abbd 100644 (file)
@@ -1,3 +1,10 @@
+2004-02-12  Tom Yu  <tlyu@mit.edu>
+
+       * aclocal.m4 (KRB5_AC_PRIOCNTL_HACK): Set PRIOCNTL_HACK=1 on
+       Solaris 9.
+
+       * configure.in: Remove exitsleep.
+
 2003-12-27  Ken Raeburn  <raeburn@mit.edu>
 
        * configure.in: Use AC_HELP_STRING for kdc-replay-cache option
index 646871764b866d6691146ba263f710fe32e56568..05e0fb8b5380a34a4647557c55f422ed16ec38f4 100644 (file)
@@ -1492,3 +1492,16 @@ AC_MSG_RESULT($krb5_cv_need_bind_8_compat)
 test $krb5_cv_need_bind_8_compat = yes && AC_DEFINE(BIND_8_COMPAT,1,[Define if OS has bind 9])
 ])
 dnl
+dnl KRB5_AC_PRIOCNTL_HACK
+dnl
+dnl
+AC_DEFUN([KRB5_AC_PRIOCNTL_HACK],
+[case $krb5_cv_host in
+*-*-solaris2.9*)
+       PRIOCNTL_HACK=1
+       ;;
+*)
+       PRIOCNTL_HACK=0
+       ;;
+esac
+AC_SUBST(PRIOCNTL_HACK)])
index 16c1fa9cbc4ad88f6ea723082bd0434dece05fde..778d89e3da331e96bc3eeb46fc480f5edc9ece5f 100644 (file)
@@ -1,5 +1,7 @@
 2004-02-12  Tom Yu  <tlyu@mit.edu>
 
+       * shlib.conf (*-*-solaris-*): Remove exitsleep.
+
        * pre.in (FAKEDEST, FAKEPREFIX, FAKELIBDIR): Support variables for
        the _RLD_ROOT hack.
 
index 8442ab8346b590157ed23f69062c7c5114046032..ed41bd8fcec028d1134ab4ec6e64bc603a08ff29 100644 (file)
@@ -255,18 +255,6 @@ mips-*-netbsd*)
        CC_LINK_SHARED='$(PURE) $(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(CFLAGS) $(LDFLAGS)'
        CC_LINK_STATIC='$(PURE) $(CC) $(PROG_LIBPATH) $(CFLAGS) $(LDFLAGS)'
        RUN_ENV='LD_LIBRARY_PATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`; export LD_LIBRARY_PATH;'
-       case $krb5_cv_host in
-       *-*-solaris2.9*)
-               case $krb5_cv_prog_cc in
-               # XXX need better test for 64-bit compilation
-               *xarch=v9*)
-                       RUN_ENV="$RUN_ENV"' LD_PRELOAD_64=$(BUILDTOP)/util/exitsleep; export LD_PRELOAD_64;'
-               ;;
-               *)
-                       RUN_ENV="$RUN_ENV"' LD_PRELOAD_32=$(BUILDTOP)/util/exitsleep; export LD_PRELOAD_32;'
-               ;;
-               esac
-       esac
        ;;
 
 *-*-sunos*)
index d683469223002600518b9993a36703ac26af7cb9..0d95002607d02624944d3a758b663fb24f1bb4bb 100644 (file)
@@ -72,21 +72,6 @@ AC_CONFIG_SUBDIRS(lib/kdb lib/gssapi lib/rpc lib/kadm5)
 if test -n "$KRB4_LIB"; then
   AC_CONFIG_SUBDIRS(krb524)
 fi
-case $krb5_cv_host in
-*-*-solaris2.9*)
-       if test "$krb5_cv_prog_gcc" = yes; then
-               DL_COMPILE='$(CC) -fpic -G -nostdlib'
-               DL_COMPILE_TAIL='-lc -ldl'
-       else
-               DL_COMPILE='$(CC) -Kpic -G'
-               DL_COMPILE_TAIL='-ldl'
-       fi
-       EXITSLEEP_TARG=exitsleep
-       ;;
-esac
-AC_SUBST(DL_COMPILE)
-AC_SUBST(DL_COMPILE_TAIL)
-AC_SUBST(EXITSLEEP_TARG)
 
 AC_CONFIG_SUBDIRS(kdc kadmin slave clients appl tests)
 AC_CONFIG_FILES(krb5-config, [chmod +x krb5-config])
index cff723bbad4fa60075b5c46ad400e84afbbfda36..0eb995f0c5fdbb91973138e6819e3e8c6795e880 100644 (file)
@@ -1,3 +1,7 @@
+2004-02-12  Tom Yu  <tlyu@mit.edu>
+
+       * configure.in: Invoke PRIOCNTL_HACK.
+
 2003-06-03  Tom Yu  <tlyu@mit.edu>
 
        * alt_prof.c (krb5_read_realm_params): Don't bother reading in
index 8a00e266b06563d1c309448f4d02153e83e87686..915c9507ff6faba89633438d18fb4d05b8cbf703 100644 (file)
@@ -19,5 +19,6 @@ dnl
 KRB5_BUILD_LIBOBJS
 KRB5_BUILD_LIBRARY_WITH_DEPS
 KRB5_BUILD_PROGRAM
+KRB5_AC_PRIOCNTL_HACK
 dnl
 V5_AC_OUTPUT_MAKEFILE(. clnt srv unit-test)
index d1cd62047b9f1d42a7fbcabe289f1525a9ea3bc5..39aedf631f71fe5678b41dc2a585dcb25eb9fcc5 100644 (file)
@@ -1,3 +1,11 @@
+2004-02-12  Tom Yu  <tlyu@mit.edu>
+
+       * config/unix.exp (PRIOCNTL_HACK): Wrap "spawn" to do priocntl
+       things to work around Solaris 9 pty-close bug.
+
+       * Makefile.in (unit-test-client-body, unit-test-server-body): Add
+       PRIOCNTL_HACK.
+
 2003-10-16  Tom Yu  <tlyu@mit.edu>
 
        * api.1/lock.exp: Work around a race condition in the Solaris 9
index d38362bbad8ae310b2a46d269066623af33701ad..382ac14d1326f8a7afeaff71ebadc58910bdba2f 100644 (file)
@@ -115,14 +115,16 @@ unit-test-client-body: site.exp test-noauth test-destroy test-handle-client
        $(ENV_SETUP) $(RUNTEST) --tool api RPC=1 API=$(CLNTTCL) \
                KINIT=$(BUILDTOP)/clients/kinit/kinit \
                KDESTROY=$(BUILDTOP)/clients/kdestroy/kdestroy \
-               KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local $(RUNTESTFLAGS)
+               KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local \
+               PRIOCNTL_HACK=@PRIOCNTL_HACK@ $(RUNTESTFLAGS)
        -mv api.log capi.log
        -mv api.sum capi.sum
 
 unit-test-server-body: site.exp test-handle-server lock-test 
        $(ENV_SETUP) $(RUNTEST) --tool api RPC=0 API=$(SRVTCL) \
                LOCKTEST=./lock-test \
-               KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local $(RUNTESTFLAGS)
+               KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local \
+               PRIOCNTL_HACK=@PRIOCNTL_HACK@ $(RUNTESTFLAGS)
        -mv api.log sapi.log
        -mv api.sum sapi.sum
 
index 0472789ea153b36704ce0d81a81c77f1aab41b63..efc07693f2fade09e6e1cdf937f6070a7eddc900 100644 (file)
@@ -14,6 +14,44 @@ if {[info exists exp_version_4]} {
        set wait_status_index 3
 }
 
+# Hack around Solaris 9 kernel race condition that causes last output
+# from a pty to get dropped.
+if { $PRIOCNTL_HACK } {
+    catch {exec priocntl -s -c FX -m 30 -p 30 -i pid [getpid]}
+    rename spawn oldspawn
+    proc spawn { args } {
+       upvar 1 spawn_id spawn_id
+       set newargs {}
+       set inflags 1
+       set eatnext 0
+       foreach arg $args {
+           if { $arg eq "-ignore" ||
+                $arg eq "-open" ||
+                $arg eq "-leaveopen" } {
+               lappend newargs $arg
+               set eatnext 1
+               continue
+           }
+           if [string match "-*" $arg] {
+               lappend newargs $arg
+               continue
+           }
+           if { $eatnext } {
+               set eatnext 0
+               lappend newargs $arg
+               continue
+           }
+           if { $inflags } {
+               set inflags 0
+               set newargs [concat $newargs {priocntl -e -c FX -p 0}]
+           }
+           lappend newargs $arg
+       }
+       set pid [eval oldspawn $newargs]
+       return $pid
+    }
+}
+
 # Variables for keeping track of api process state
 set api_pid "0"
 
index 1d6c648b762f371c8ce6fc795643cea4f1ba42c0..c87dade4743126ff3f41d85d68c19ab1d6bbc031 100644 (file)
@@ -1,3 +1,10 @@
+2004-02-12  Tom Yu  <tlyu@mit.edu>
+
+       * configure.in: Invoke KRB5_AC_PRIOCNTL_HACK.
+
+       * config/unix.exp (PRIOCNTL_HACK): Wrap "spawn" to do priocntl
+       things to work around Solaris 9 pty-close bug.
+
 2003-12-02  Ken Raeburn  <raeburn@mit.edu>
 
        * lib/helpers.exp (expect_kadm_ok, eof_client): Accept and ignore
index a9ed5c3d7ccf226ada1f4933a9e8c7261b4391ef..a4c2fc52d4198fcd1c3d11e90d31e99665a6c8f6 100644 (file)
@@ -54,6 +54,7 @@ unit-test-body:
                $(RUNTEST) SERVER=./server CLIENT=./client \
                KINIT=$(BUILDTOP)/clients/kinit/kinit \
                KDESTROY=$(BUILDTOP)/clients/kdestroy/kdestroy \
+               PRIOCNTL_HACK=@PRIOCNTL_HACK@ \
                PASS="$(PASS)" --tool rpc_test $(RUNTESTFLAGS) ; \
        then \
                echo Cleaning up... ; \
index 49ae4d1653e353da518ae4b20e895143153db437..8b7df9f1632675a9a0356b1f1b74ca8844af94cc 100644 (file)
@@ -9,6 +9,44 @@ set kdestroy $KDESTROY
 
 set hostname [exec hostname]
 
+# Hack around Solaris 9 kernel race condition that causes last output
+# from a pty to get dropped.
+if { $PRIOCNTL_HACK } {
+    catch {exec priocntl -s -c FX -m 30 -p 30 -i pid [getpid]}
+    rename spawn oldspawn
+    proc spawn { args } {
+       upvar 1 spawn_id spawn_id
+       set newargs {}
+       set inflags 1
+       set eatnext 0
+       foreach arg $args {
+           if { $arg eq "-ignore" ||
+                $arg eq "-open" ||
+                $arg eq "-leaveopen" } {
+               lappend newargs $arg
+               set eatnext 1
+               continue
+           }
+           if [string match "-*" $arg] {
+               lappend newargs $arg
+               continue
+           }
+           if { $eatnext } {
+               set eatnext 0
+               lappend newargs $arg
+               continue
+           }
+           if { $inflags } {
+               set inflags 0
+               set newargs [concat $newargs {priocntl -e -c FX -p 0}]
+           }
+           lappend newargs $arg
+       }
+       set pid [eval oldspawn $newargs]
+       return $pid
+    }
+}
+
 # this will initialize the database and keytab
 load_lib "helpers.exp"
 
index 68ac8d10865f6a7ab25c6ebc162c7cb9d57bdb8f..d06cb6fb878425f024c60725f798af46d4aae4f7 100644 (file)
@@ -25,4 +25,5 @@ changequote([, ])
 AC_SUBST(PASS)
 dnl
 CHECK_SIGNALS
+KRB5_AC_PRIOCNTL_HACK
 V5_AC_OUTPUT_MAKEFILE
index a4bf487a3681ca5113d25932e99507284e57a00f..91dfb26f92eeeddcb705d10f41aea7d5cf021d5d 100644 (file)
@@ -1,3 +1,7 @@
+2004-02-12  Tom Yu  <tlyu@mit.edu>
+
+       * configure.in: Invoke KRB5_AC_PRIOCNTL_HACK.
+
 2003-06-04  Tom Yu  <tlyu@mit.edu>
 
        * Makefile.in (kdb_check): Remove uses of "dump -old", etc., since
index 205eb1dc41b5865f986ff8d246ed6b7cfa6d7770..cc814503422258e4bed3af0fbaa96d6a209ea0de 100644 (file)
@@ -26,4 +26,5 @@ else
        KRB4_DEJAGNU_TEST="KRBIV=1"
 fi
 AC_SUBST(KRB4_DEJAGNU_TEST)
+KRB5_AC_PRIOCNTL_HACK
 V5_AC_OUTPUT_MAKEFILE(. resolve asn.1 create hammer verify gssapi dejagnu)
index 51affdd6ed0a76b41657a6697037f538fb8bdab3..560919156f2b23a426167e38ab33be8f3057cd55 100644 (file)
@@ -1,3 +1,7 @@
+2004-02-12  Tom Yu  <tlyu@mit.edu>
+
+       * Makefile.in (check-runtest-yes): Add PRIOCNTL_HACK.
+
 2003-01-05  Sam Hartman  <hartmans@mit.edu>
 
        * t_inetd.c: Remove declaration of errno
index e245299334bba45283cecf8c3ef43cb4ebc2a77e..15e82c263334a4ecb0bee9d5bdbe62cd78581f6b 100644 (file)
@@ -22,7 +22,7 @@ check-runtest-no::
        @echo "+++"
 
 check-runtest-yes:: t_inetd site.exp
-       $(RUNTEST) --tool krb --srcdir $(srcdir) $(KRB4_RUNTESTFLAGS) $(RUNTESTFLAGS)
+       $(RUNTEST) --tool krb --srcdir $(srcdir) $(KRB4_RUNTESTFLAGS) PRIOCNTL_HACK=@PRIOCNTL_HACK@ $(RUNTESTFLAGS)
 
 t_inetd:: t_inetd.o $(KRB5_BASE_DEPLIBS)
        $(CC_LINK) -o t_inetd t_inetd.o $(KRB5_BASE_LIBS)
@@ -44,6 +44,7 @@ runenv.vals: runenv.vars
 site.exp: runenv.vals
        echo "set runvarlist [list `cat runenv.vals | tr '\n' ' '`]" | \
                sed -e 's%=\.%='`pwd`'/.%g' > site.exp
+
 # +++ Dependency line eater +++
 # 
 # Makefile dependencies follow.  This must be the last section in
index 9396e5eb9037d8ebbc84160f39f0f2318498b12f..db49f5578716c9d4800af356fe2c2b672371254b 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-12  Tom Yu  <tlyu@mit.edu>
+
+       * default.exp (PRIOCNTL_HACK): Wrap "spawn" to do priocntl things
+       to work around Solaris 9 pty-close bug.
+
 2003-12-13  Ken Raeburn  <raeburn@mit.edu>
 
        * default.exp (passes): Add an AES-only pass.
index 215671d340633e219d3333224e143cd27621cc7d..68b551d69d934bcdf98f8445ea99f3472a8cd56f 100644 (file)
@@ -54,6 +54,44 @@ if 0 {
     }
 }
 
+# Hack around Solaris 9 kernel race condition that causes last output
+# from a pty to get dropped.
+if { $PRIOCNTL_HACK } {
+    catch {exec priocntl -s -c FX -m 30 -p 30 -i pid [getpid]}
+    rename spawn oldspawn
+    proc spawn { args } {
+       upvar 1 spawn_id spawn_id
+       set newargs {}
+       set inflags 1
+       set eatnext 0
+       foreach arg $args {
+           if { $arg eq "-ignore" ||
+                $arg eq "-open" ||
+                $arg eq "-leaveopen" } {
+               lappend newargs $arg
+               set eatnext 1
+               continue
+           }
+           if [string match "-*" $arg] {
+               lappend newargs $arg
+               continue
+           }
+           if { $eatnext } {
+               set eatnext 0
+               lappend newargs $arg
+               continue
+           }
+           if { $inflags } {
+               set inflags 0
+               set newargs [concat $newargs {priocntl -e -c FX -p 0}]
+           }
+           lappend newargs $arg
+       }
+       set pid [eval oldspawn $newargs]
+       return $pid
+    }
+}
+
 # The des.des3-tgt.no-kdc-des3 pass will fail if the KDC doesn't
 # constrain ticket key enctypes to those in permitted_enctypes.  It
 # does this by not putting des3 in the permitted_enctypes, while
index 54b9cdbbd321e4bd472e87729a3a0c7271b95510..0c1e44f211c2153f9583ff9a0e57633d44ccbb8b 100644 (file)
@@ -1,5 +1,7 @@
 2004-02-12  Tom Yu  <tlyu@mit.edu>
 
+       * Makefile.in (all-recurse): Remove exitsleep.
+       
        * Makefile.in (all-unix, clean-unix): Add new rule to build fake
        root directory for _RLD_ROOT hacks.
 
index dd106bbc289c8a4dc690df84e6b442dc0101503a..dc5d9ddce90a0a6dcf010db7d4185db1c00e78f9 100644 (file)
@@ -28,7 +28,7 @@ SLIBSH=sed -e 's|@''CC''@|$(CC)|g' -e 's,@''HOST_TYPE''@,$(HOST_TYPE),g' -e 's,@
 DL_COMPILE=@DL_COMPILE@
 DL_COMPILE_TAIL=@DL_COMPILE_TAIL@
 
-all-recurse: libupdate makeshlib @EXITSLEEP_TARG@
+all-recurse: libupdate makeshlib
 all-unix:: $(FAKEPREFIX)/lib
 all-mac::
 
@@ -71,9 +71,6 @@ makeshlib: $(srcdir)/makeshlib.sh Makefile
         $(RM) $@ $@.tmp
         $(SLIBSH) $(srcdir)/makeshlib.sh >$@.tmp&&chmod a+x $@.tmp&&mv $@.tmp $@
 
-exitsleep: $(srcdir)/exitsleep.c
-       $(DL_COMPILE) -oexitsleep $(srcdir)/exitsleep.c $(DL_COMPILE_TAIL)
-
 clean::
        $(RM) libupdate makeshlib