*Synopsis*: ksh93 hang in mysql build in SFW

CR 6859444 changed on Apr 23 2010 by <User 1-9HOB9N>

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

See Also               6946957                                                
====================== =========================== ===========================

     
*Change Request ID*: 6859444

*Synopsis*: ksh93 hang in mysql build in SFW

  Product: solaris
  Category: shell
  Subcategory: korn93
  Type: Defect
  Subtype: 
  Status: 3-Accepted
  Substatus: 
  Priority: 2-High
  Introduced In Release: 
  Introduced In Build: 
  Responsible Engineer: <User 1-7RPONF>
  Keywords: 

=== *Description* ============================================================
A Makefile in the mysql 5.1 source in the SFW consolidation contains this code:

        for f in `(cd $(srcdir); find suite -type f | egrep -v 
'SCCS|row_lock')`; \
        do \
          d=$(DESTDIR)$(testdir)/`dirname $$f`; \
          mkdir -p $$d ; \
          $(INSTALL_DATA) $(srcdir)/$$f $$d ; \
        done

The build hangs indefinitely at this point.  The process tree contains a shell 
with two children -- the find and the egrep.  I can reproduce this with the 
following shortened construct:

    for f in `(find /var/sadm/pkg -type f)`; do :; done

Run on the commandline of any shell with "sh -c '<command>'", or substitute 
"bash" or "zsh" or "/usr/has/bin/sh" for "sh" to see that it works in other 
shells.

Note that the subshell is required, as is some amount of either IO or time 
inside that subshell.  I've tried saving the output of the command into a file 
and simply catting that file inside the subshell, but then the command 
completes successfully.  I have also found that limiting the amount of output 
from the find may allow the command to complete, too, but it doesn't appear to 
be a strict issue of number of bytes.  If I use head to limit the output, I can 
zero in on a certain number of lines where the hang starts, but that will vary 
from machine to machine, from one time of day to another (perhaps due to 
general machine load), and will even differ between /usr/bin/head and 
/usr/gnu/bin/head (the latter lets more lines through before the hang occurs).

*** (#1 of 1): 2009-07-12 01:03:06 GMT+00:00 <User 1-5Q-2233>


=== *Public Comments* ========================================================
See also the mailing list discussion starting at:
http://mail.opensolaris.org/pipermail/sfwnv-discuss/2009-July/004768.html

*** (#1 of 1): 2009-07-12 03:17:49 GMT+00:00 <User 1-5Q-1267>


=== *Workaround* =============================================================
Set SHELL to /usr/bin/bash for the target which calls this code:

--- usr/src/cmd/mysql-5-1/Makefile.sfw (SCCS v.1.2)
+++ usr/src/cmd/mysql-5-1/Makefile.sfw
@@ -158,6 +158,7 @@
        $(GTAR) xjf $(MYSQL_DIR).tar.bz2
        gpatch $(MYSQL_DIR)/storage/innobase/include/univ.i -i 
patches/inline.patch
        gpatch $(MYSQL_DIR)/scripts/mysql_config.sh -i 
patches/mysql_config.patch
+       gpatch $(MYSQL_DIR)/mysql-test/Makefile.in -i patches/ksh-hang.patch
        touch $(MYSQL_DIR)/configure
        find $(MYSQL_DIR) -type d -exec /usr/bin/chmod 755 "{}" \;
        find $(MYSQL_DIR) -type f -exec /usr/bin/chmod ugo+r "{}" \;
@@ -171,6 +172,7 @@
        mv tmp/$(MYSQL_DIR) $(MYSQL_DIR_64); rm -rf tmp
        gpatch $(MYSQL_DIR_64)/storage/innobase/include/univ.i -i 
patches/inline.patch
        gpatch $(MYSQL_DIR_64)/scripts/mysql_config.sh -i 
patches/mysql_config.patch
+       gpatch $(MYSQL_DIR_64)/mysql-test/Makefile.in -i patches/ksh-hang.patch
        touch $(MYSQL_DIR_64)/configure
        find $(MYSQL_DIR_64) -type d -exec /usr/bin/chmod 755 "{}" \;
        find $(MYSQL_DIR_64) -type f -exec /usr/bin/chmod ugo+r "{}" \;
--- /dev/null   2009-07-11 10:17:10.000000000 -0700
+++ usr/src/cmd/mysql-5-1/patches/ksh-hang.patch        2009-07-11 
10:01:54.245425259 -0700
@@ -0,0 +1,11 @@
+--- Makefile.in.orig   Mon Feb  2 08:37:22 2009
++++ Makefile.in        Sat Jul 11 09:58:53 2009
+@@ -781,6 +781,8 @@
+       $(INSTALL_DATA) $(srcdir)/lib/My/*.pm $(distdir)/lib/My
+       -rm -rf `find $(distdir)/suite -type d -name SCCS` 
$(distdir)/suite/row_lock
+ 
++install-data-local: SHELL=/usr/bin/bash
++
+ install-data-local:
+       $(mkinstalldirs) \
+               $(DESTDIR)$(testdir)/t \

*** (#1 of 2): 2009-07-12 01:03:06 GMT+00:00 <User 1-5Q-2233>

Better workaround: use $(...) instead of `(...)`.

Hangs:

for f in `(find /var/sadm/pkg -type f)`; do :; done

Doesn't hang:

for f in $(find /var/sadm/pkg -type f); do :; done

(This would explain why I've never noticed this bug, as I always use $() in 
preference to ``.)

*** (#2 of 2): 2009-08-31 18:00:17 GMT+00:00 <User 1-5Q-10962>


=== *Additional Details* =====================================================
        Targeted Release: 
        Commit To Fix In Build: 
        Fixed In Build: 
        Integrated In Build: 
        Verified In Build: 
  See Also: 6817601, 6859442, 6874461, 6876768, 6946957, 5070274
  Duplicate of: 
  Hooks:
        Hook1: 
        Hook2: 
        Hook3: 
        Hook4: 
        Hook5: 
        Hook6: 
  Program Management: 
  Root Cause: 
  Fix Affects Documentation: No
  Fix Affects Localization: No

=== *History* ================================================================
        Date Submitted: 2009-07-12 01:03:06 GMT+00:00
        Submitted By: <User 1-5Q-2233>

        Status Changed    Date Updated                  Updated By
        3-Accepted        2009-08-31 09:29:40 GMT+00:00 <User 1-1SURPB>


=== *Service Request* ========================================================
        Impact: Significant
        Functionality: Primary
        Severity: 2
        Product Name: solaris
        Product Release: osol_2009.06
        Product Build: 
        Operating System: solaris
        Hardware: generic
        Submitted Date: 2009-07-12 01:03:06 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