19782029 userland should be able to build from SCM repositories
authorNorm Jacobs <Norm.Jacobs@Oracle.COM>
Mon, 27 Apr 2015 10:19:50 -0500
changeset 4196 d697072a92f5
parent 4195 d88c5d15a4af
child 4197 67d7270f6817
19782029 userland should be able to build from SCM repositories
Makefile
components/Makefile
components/apache2-modules/mod_dtrace/Makefile
components/erlang/Makefile
components/erlang/erlang-doc.p5m
components/erlang/erlang.p5m
components/gpatch/Makefile
components/gpatch/patch.license
components/gpatch/patch.p5m
components/hwdata/Makefile
components/ksh93/Makefile
components/ksh93/patches/005-compiler.patch
components/ksh93/patches/010-path_utmp.patch
components/ksh93/patches/015-solaris_alias.patch
components/ksh93/patches/020-CR6919590.patch
components/ksh93/patches/025-CR7033181.patch
components/ksh93/patches/030-CR7071431.patch
components/ksh93/patches/035-CR7036535.patch
components/ksh93/patches/040-CRXXX_Error_Catalog.patch
components/ksh93/patches/045-CR7025778.patch
components/ksh93/patches/050-CR7065478.patch
components/ksh93/patches/055-CR7026179.patch
components/ksh93/patches/060-CR7065900.patch
components/ksh93/patches/065-CR7110983.patch
components/ksh93/patches/070-CR7105086.patch
components/ksh93/patches/075-multi_lang_arith.patch
components/ksh93/patches/080-CR7057565.patch
components/ksh93/patches/085-CR7046434.patch
components/ksh93/patches/090-CR7032821.patch
components/ksh93/patches/095-CR7009897.patch
components/ksh93/patches/100-CR6964621.patch
components/ksh93/patches/105-CR7032068.patch
components/ksh93/patches/110-CR7061011.patch
components/ksh93/patches/115-CR6934836.patch
components/ksh93/patches/120-CR7089799.patch
components/ksh93/patches/125-CR6917338.patch
components/ksh93/patches/130-CR7019368.patch
components/ksh93/patches/135-CR6729252.patch
components/ksh93/patches/140-MAP_TYPE_64_Bits.patch
components/ksh93/patches/145-CR7167466.patch
components/ksh93/patches/150-CR7168611.patch
components/ksh93/patches/155-CR7178717.patch
components/ksh93/patches/160-CR7175995.patch
components/ksh93/patches/165-CR7186440_ksh93_disable_predictive_editing.patch
components/ksh93/patches/170-CR7128313.patch
components/ksh93/patches/17432413.patch
components/ksh93/patches/17435456.patch
components/ksh93/patches/175-Bug15794787,15819673.patch
components/ksh93/patches/17824699.patch
components/ksh93/patches/17851169.patch
components/ksh93/patches/180-Bug15808407.patch
components/ksh93/patches/185-Bug17714341.patch
components/ksh93/patches/190-17432413.patch
components/ksh93/patches/195-17824699.patch
components/ksh93/patches/200-17435456.patch
components/ksh93/patches/205-17851169.patch
components/ksh93/patches/210-Bug15993811.patch
components/ksh93/patches/Bug15794787,15819673.patch
components/ksh93/patches/Bug15808407.patch
components/ksh93/patches/Bug15993811.patch
components/ksh93/patches/Bug17714341.patch
components/ksh93/patches/CR6729252.patch
components/ksh93/patches/CR6917338.patch
components/ksh93/patches/CR6919590.patch
components/ksh93/patches/CR6934836.patch
components/ksh93/patches/CR6964621.patch
components/ksh93/patches/CR7009897.patch
components/ksh93/patches/CR7019368.patch
components/ksh93/patches/CR7025778.patch
components/ksh93/patches/CR7026179.patch
components/ksh93/patches/CR7032068.patch
components/ksh93/patches/CR7032821.patch
components/ksh93/patches/CR7033181.patch
components/ksh93/patches/CR7036535.patch
components/ksh93/patches/CR7046434.patch
components/ksh93/patches/CR7057565.patch
components/ksh93/patches/CR7061011.patch
components/ksh93/patches/CR7065478.patch
components/ksh93/patches/CR7065900.patch
components/ksh93/patches/CR7071431.patch
components/ksh93/patches/CR7089799.patch
components/ksh93/patches/CR7105086.patch
components/ksh93/patches/CR7110983.patch
components/ksh93/patches/CR7128313.patch
components/ksh93/patches/CR7167466.patch
components/ksh93/patches/CR7168611.patch
components/ksh93/patches/CR7175995.patch
components/ksh93/patches/CR7178717.patch
components/ksh93/patches/CR7186440_ksh93_disable_predictive_editing.patch
components/ksh93/patches/CRXXX_Error_Catalog.patch
components/ksh93/patches/MAP_TYPE_64_Bits.patch
components/ksh93/patches/compiler.patch
components/ksh93/patches/multi_lang_arith.patch
components/ksh93/patches/package-pax-suid.patch
components/ksh93/patches/path_utmp.patch
components/ksh93/patches/solaris_alias.patch
components/librsync/Makefile
components/libtool/Makefile
components/libusb/ugen/Makefile
components/libusb/wrapper/Makefile
components/meta-packages/developer-opensolaris-userland/Makefile
components/meta-packages/history/Makefile
components/mysql-common/Makefile
components/open-fabrics/Makefile
components/openstack/common/Makefile
components/openstack/horizon/Makefile
components/openstack/horizon/patches/99-remove.xstatic.patch
components/openstack/horizon/patches/99-remove.xstatic.patch-proto
components/patch/Makefile
components/patch/patch.license
components/patch/patch.p5m
components/php-5_3/Makefile
components/php-5_3/php-sapi/Makefile
components/php-5_3/php-sapi/php.mk
components/php-common/Makefile
components/ruby/ruby-common/Makefile
components/timezone/Makefile
components/vim/Makefile
components/vim/gvim.p5m
components/vim/vim-core.p5m
components/vim/vim.p5m
doc/makefile-targets.txt
doc/makefile-variables.txt
make-rules/ips.mk
make-rules/prep-download.mk
make-rules/prep-git.mk
make-rules/prep-hg.mk
make-rules/prep-patch.mk
make-rules/prep-svn.mk
make-rules/prep-unpack.mk
make-rules/prep.mk
make-rules/shared-macros.mk
tools/userland-fetch
--- a/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
 include make-rules/shared-macros.mk
@@ -26,6 +26,8 @@
 SUBDIRS += components
 
 download:	TARGET = download
+unpack:		TARGET = unpack
+patch:		TARGET = patch
 prep:		TARGET = prep
 build:		TARGET = build
 install:	TARGET = install
@@ -39,7 +41,7 @@
 
 .DEFAULT:	publish
 
-download setup prep build install publish validate clean clobber \
+download setup unpack patch prep build install publish validate clean clobber \
 test component-hook: $(SUBDIRS)
 
 $(SUBDIRS):	FORCE
--- a/components/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -70,6 +70,8 @@
 	@$(GMAKE) -f $(WS_MAKE_RULES)/environment.mk -f $< component-environment-prep
 
 download:		TARGET = download
+unpack:			TARGET = unpack
+patch:			TARGET = patch
 prep:			TARGET = prep
 build:			TARGET = build
 install:		TARGET = install
@@ -101,7 +103,7 @@
 
 COMPONENT_DIRS.nosetup =	$(COMPONENT_DIRS:%=%.nosetup)
 
-download::	$(COMPONENT_DIRS.nosetup)
+download unpack patch::	$(COMPONENT_DIRS.nosetup)
 prep:		$(COMPONENT_DIRS.nosetup)
 component-environment-check::	$(COMPONENT_DIRS.nosetup)
 component-hook:	$(COMPONENT_DIRS.nosetup)
--- a/components/apache2-modules/mod_dtrace/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/apache2-modules/mod_dtrace/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -30,6 +30,7 @@
 
 TPNO=			8876
 
+include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/justmake.mk
 include $(WS_MAKE_RULES)/ips.mk
 include ../modules.mk
@@ -40,13 +41,6 @@
 
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
-download::
-
-clobber: clean
-
-$(SOURCE_DIR)/.prep:
-	$(TOUCH) [email protected]
-
 clean::
 	$(RM) $(SOURCE_DIR)/.prep
 
--- a/components/erlang/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/erlang/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -48,6 +48,8 @@
 COMPONENT_ARCHIVE_HASH_1=	\
     sha256:85b1b2a1011fc01af550f1fe9e5a599a4c5f2a35d264d2804af1d05590a857c3
 COMPONENT_ARCHIVE_URL_1=	$(COMPONENT_PROJECT_URL)download/$(COMPONENT_ARCHIVE_1)
+UNPACK_ARGS_1=	-r $(COMPONENT_SRC_1)
+PKG_PROTO_DIRS +=	$(COMPONENT_SRC_1)
 
 # HTML documentation
 COMPONENT_NAME_2=	otp_doc_html
@@ -56,6 +58,8 @@
 COMPONENT_ARCHIVE_HASH_2=	\
     sha256:baba1d373c1faacf4a1a6ec1220d57d0cb2b977edb74f32cd58dc786361c6cf5
 COMPONENT_ARCHIVE_URL_2=	$(COMPONENT_PROJECT_URL)download/$(COMPONENT_ARCHIVE_2)
+UNPACK_ARGS_2=	-r $(COMPONENT_SRC_2)
+PKG_PROTO_DIRS +=	$(COMPONENT_SRC_2)
 
 TPNO=			18548
 
@@ -111,25 +115,11 @@
 build:	$(BUILD_64)
 
 install:	$(INSTALL_64)
-	# Undelivered useless files:
-	#    erlang/lib/crypto-*/priv/obj
-	#    erlang/lib/ssl-*/priv/obj
-	#    erlang/Install
-	#    erlang/misc
-	#    erlang/*/*.bat
-	#    manpages: start.1 werl.1
-	$(RM) -r documentation
-	$(MKDIR) documentation && cd documentation && \
-	$(UNPACK) $(UNPACK_ARGS) ../$(COMPONENT_ARCHIVE_1) && \
-	$(UNPACK) $(UNPACK_ARGS) ../$(COMPONENT_ARCHIVE_2)
 	# remove INSTALL_PREFIX from path
 	$(PERL) -pi -e "s|$(PROTO_DIR)||g" \
 		$(PROTO_DIR)/usr/lib/$(MACH64)/erlang/bin/erl \
 		$(PROTO_DIR)/usr/lib/$(MACH64)/erlang/releases/RELEASES
 
-clean::
-	$(RM) -r documentation
-
 test:	$(TEST_64)
 
 REQUIRED_PACKAGES += library/ncurses
--- a/components/erlang/erlang-doc.p5m	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/erlang/erlang-doc.p5m	Mon Apr 27 10:19:50 2015 -0500
@@ -21,7 +21,7 @@
 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 <transform file path=usr/share/doc/erlang/(.+)$ -> \
-    set action.hash documentation/%<\1> >
+    set action.hash %<1> >
 set name=pkg.fmri \
     value=pkg:/runtime/erlang/[email protected]$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
 set name=pkg.summary value="Erlang/OTP Documentation"
--- a/components/erlang/erlang.p5m	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/erlang/erlang.p5m	Mon Apr 27 10:19:50 2015 -0500
@@ -23,15 +23,15 @@
 
 # Put the various erlang man pages in the right directories.
 <transform file path=usr/share/man/man1/(.+)$ -> \
-    set action.hash documentation/man/man1/%<1> >
+    set action.hash man/man1/%<1> >
 <transform file path=usr/share/man/man3erl/(.+)erl$ -> \
-    set action.hash documentation/man/man3/%<1> >
+    set action.hash man/man3/%<1> >
 <transform file path=usr/share/man/man4erl/(.+)erl$ -> \
-    set action.hash documentation/man/man4/%<1> >
+    set action.hash man/man4/%<1> >
 <transform file path=usr/share/man/man6erl/(.+)erl$ -> \
-    set action.hash documentation/man/man6/%<1> >
+    set action.hash man/man6/%<1> >
 <transform file path=usr/share/man/man7erl/(.+)erl$ -> \
-    set action.hash documentation/man/man7/%<1> >
+    set action.hash man/man7/%<1> >
 <transform file path=.*lib/.*app -> default mode 0444>
 <transform file path=.*lib/.*appup -> default mode 0444>
 <transform file path=.*lib/.*beam -> default mode 0444>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gpatch/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,58 @@
+#
+# 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 (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+#
+
+include ../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		patch
+COMPONENT_VERSION=	2.7.1
+COMPONENT_PROJECT_URL=	http://www.gnu.org/software/patch/
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH=	\
+    sha256:c05f28668c3474bc63adcd48abae921d15e71c254fbebdbaeda40456d64039d5
+COMPONENT_ARCHIVE_URL=	http://ftp.gnu.org/gnu/patch/$(COMPONENT_ARCHIVE)
+COMPONENT_BUGDB=	utility/gpatch
+
+TPNO=			18936
+
+include $(WS_MAKE_RULES)/prep.mk
+include $(WS_MAKE_RULES)/configure.mk
+include $(WS_MAKE_RULES)/ips.mk
+
+CONFIGURE_OPTIONS  +=		CFLAGS="$(CFLAGS)"
+
+COMPONENT_INSTALL_ARGS += bindir=$(USRBINDIR)
+
+ASLR_MODE = $(ASLR_ENABLE)
+
+# common targets
+configure:	$(CONFIGURE_64)
+
+build:		$(BUILD_64)
+
+install:	$(INSTALL_64)
+
+test:		$(TEST_64)
+
+
+REQUIRED_PACKAGES += system/library
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gpatch/patch.license	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gpatch/patch.p5m	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,43 @@
+#
+# 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 (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+#
+
+<transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted>
+set name=pkg.fmri \
+    value=pkg:/text/[email protected]$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary value="The GNU Patch utility"
+set name=com.oracle.info.description value="GNU patch"
+set name=com.oracle.info.tpno value=$(TPNO)
+set name=info.classification value=org.opensolaris.category.2008:Development/GNU
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/1999/555 value=PSARC/2014/324
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+link path=usr/bin/gpatch target=../gnu/bin/patch facet.compat.gnulinks=true
+link path=usr/bin/patch target=../gnu/bin/patch
+file usr/bin/patch path=usr/gnu/bin/patch
+file usr/share/man/man1/patch.1 path=usr/gnu/share/man/man1/patch.1
+link path=usr/share/man/man1/gpatch.1 \
+    target=../../../gnu/share/man/man1/patch.1 facet.compat.gnulinks=all
+link path=usr/share/man/man1/patch.1 target=../../../gnu/share/man/man1/patch.1
+legacy pkg=SUNWgpch desc="The GNU Patch utility" name="The GNU Patch utility"
+license patch.license license=GPLv2
--- a/components/hwdata/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/hwdata/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -28,6 +28,7 @@
 TPNO_PCI=	21782
 TPNO_USB=	21783
 
+include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/ips.mk
 
 # Since upstream only offers the latest snapshot for download, without
--- a/components/ksh93/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/ksh93/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -42,7 +42,6 @@
 COMPONENT_ARCHIVE_HASH = \
     sha256:d692d476fe4bb933e7b6459c0cc99a2e9f428bfd81a495ed4201ec197e070f57
 COMPONENT_ARCHIVE_URL = http://www2.research.att.com/~gsf/download/tgz/$(COMPONENT_ARCHIVE) 
-COMPONENT_PATCHES = 
 
 TPNO=		9000
 
@@ -60,29 +59,6 @@
 COMPONENT_ARCHIVE_HASH_1= \
     sha256:44ae3913e6c0c8992c6c3cba16864fd4c4a18c6da8e7d87c85a23060cea7cd1a
 COMPONENT_ARCHIVE_URL_1= http://www2.research.att.com/~gsf/download/tgz/$(COMPONENT_ARCHIVE_1)
-COMPONENT_PATCHES_1= compiler.patch path_utmp.patch\
-					 solaris_alias.patch \
-					 CR6919590.patch CR7033181.patch \
-					 CR7071431.patch CR7036535.patch \
-					 CRXXX_Error_Catalog.patch CR7025778.patch \
-					 CR7065478.patch CR7026179.patch \
-					 CR7065900.patch CR7110983.patch \
-					 CR7105086.patch multi_lang_arith.patch \
-					 CR7057565.patch CR7046434.patch \
-					 CR7032821.patch CR7009897.patch \
-					 CR6964621.patch CR7032068.patch \
-					 CR7061011.patch CR6934836.patch \
-					 CR7089799.patch CR6917338.patch \
-					 CR7019368.patch CR6729252.patch \
-					 MAP_TYPE_64_Bits.patch CR7167466.patch \
-					 CR7168611.patch CR7178717.patch \
-					 CR7175995.patch \
-					 CR7186440_ksh93_disable_predictive_editing.patch \
-					 CR7128313.patch  Bug15794787,15819673.patch \
-					 Bug15808407.patch Bug17714341.patch \
-					 17432413.patch 17824699.patch \
-					 17435456.patch 17851169.patch \
-					 Bug15993811.patch
 
 # Fixup HOSTTYPE to match uname output and bits
 HOSTTYPE32=sol11.$(shell uname -p)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/005-compiler.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,52 @@
+diff -rupN INIT.2011-02-08/src/cmd/INIT/cc.sol11.i386-64 INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.i386-64
+diff -rupN INIT.2011-02-08/src/cmd/INIT/cc.sol11.i386-64 INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.i386-64
+--- INIT.2011-02-08/src/cmd/INIT/cc.sol11.i386-64	1970-01-01 01:00:00.000000000 +0100
++++ INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.i386-64	2012-05-18 10:49:31.008310676 +0100
[email protected]@ -0,0 +1,9 @@
++: solaris.i386-64 cc wrapper for reasonable ansi C defaults and 64 bit : 2012-05-18 :
++
++HOSTTYPE=sol11.i386-64
++
++case " $* " in
++*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
++esac
++
++$CC_EXPLICIT -m64 -xc99 -D_XPG6 "[email protected]"
+--- INIT.2011-02-08/src/cmd/INIT/cc.sol11.i386	1970-01-01 01:00:00.000000000 +0100
++++ INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.i386	2012-05-18 10:49:31.008310676 +0100
[email protected]@ -0,0 +1,9 @@
++: solaris.i386 cc wrapper for reasonable ansi C defaults and 32 bit : 2012-05-18 :
++
++HOSTTYPE=sol11.i386
++
++case " $* " in
++*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
++esac
++
++$CC_EXPLICIT -m32 -xc99 -D_XPG6 "[email protected]"
+diff -rupN INIT.2011-02-08/src/cmd/INIT/cc.sol11.sun4-64 INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.sun4-64
+--- INIT.2011-02-08/src/cmd/INIT/cc.sol11.sun4-64	1970-01-01 01:00:00.000000000 +0100
++++ INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.sun4-64	2012-05-18 10:49:20.339537677 +0100
[email protected]@ -0,0 +1,9 @@
++: solaris.sun4-64 cc wrapper for reasonable ansi C defaults and 64 bit : 2012-05-18 :
++
++HOSTTYPE=sol11.sun4-64
++
++case " $* " in
++*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
++esac
++
++$CC_EXPLICIT -m64 -xc99 -D_XPG6 "[email protected]"
+diff -rupN INIT.2011-02-08/src/cmd/INIT/cc.sol11.sun4 INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.sun4-64
+--- INIT.2011-02-08/src/cmd/INIT/cc.sol11.sun4	1970-01-01 01:00:00.000000000 +0100
++++ INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.sun4	2012-05-18 10:49:20.339537677 +0100
[email protected]@ -0,0 +1,9 @@
++: solaris.sun4 cc wrapper for reasonable ansi C defaults and 32 bit : 2012-05-18 :
++
++HOSTTYPE=sol11.sun4
++
++case " $* " in
++*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
++esac
++
++$CC_EXPLICIT -m32 -xc99 -D_XPG6  "[email protected]"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/010-path_utmp.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,24 @@
+diff -rupN a/src/cmd/ss/ssd.c b/src/cmd/ss/ssd.c
+--- a/src/cmd/ss/ssd.c	2010-06-09 16:06:54.000000000 +0100
++++ b/src/cmd/ss/ssd.c	2011-10-24 15:46:09.321811427 +0100
[email protected]@ -118,9 +118,6 @@ struct whod
+ #if	!defined(UTMP_PATHNAME) && defined(UTMPX_PATHNAME)
+ #define UTMP_PATHNAME	UTMPX_PATHNAME
+ #endif	
+-#if	!defined(_PATH_UTMP) && defined(_PATH_UTMPX)
+-#define _PATH_UTMP	_PATH_UTMPX
+-#endif     
+ 
+ #else
+ 
[email protected]@ -142,8 +139,8 @@ static char*		usrfiles[] =
+ #ifdef	UTMP_PATHNAME
+ 	UTMP_PATHNAME,
+ #endif
+-#ifdef	_PATH_UTMP
+-	_PATH_UTMP,
++#ifdef	_PATH_UTMPX
++	_PATH_UTMPX,
+ #endif
+ #if _hdr_utmpx
+ 	"/etc/utmpx",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/015-solaris_alias.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,363 @@
+diff -rupN b/lib/package/ast-base.pkg a/lib/package/ast-base.pkg
+--- b/lib/package/ast-base.pkg	2009-09-21 20:35:51.000000000 +0000
++++ a/lib/package/ast-base.pkg	2011-11-10 16:24:52.515495613 +0000
[email protected]@ -3,7 +3,7 @@ ast-base :PACKAGE: \
+ 		libdll libexpr libodelta librecsort libsum libuu libvdelta \
+ 		libbz libz tests 3d coshell cpp cs mam msgcc nmake probe ss \
+ 		libcoshell libcs libmam libpp libcodex paxlib codexlib \
+-		libdss libpz dsslib
++		libdss libpz dsslib alias
+ 
+ :COVERS: ast-make ast-ksh ast-ast
+ 
+diff -rupN b/src/cmd/alias/alias.c a/src/cmd/alias/alias.c
+--- b/src/cmd/alias/alias.c	1970-01-01 00:00:00.000000000 +0000
++++ a/src/cmd/alias/alias.c	2011-11-10 16:24:28.356925339 +0000
[email protected]@ -0,0 +1,255 @@
++/*
++ * 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 (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
++ */
++
++/*
++ * alias.c is a C version of the alias.sh wrapper (which links ksh
++ * builtins to commands in /usr/bin/, e.g. calling this wrapper as
++ * /usr/bin/alias will call the ksh "alias" builtin, running it as
++ * /usr/bin/cut will call the ksh "cut" builtin etc.
++ */
++
++#include <shell.h>
++#include <nval.h>
++#include <stdio.h>
++#include <alias.h>
++
++typedef struct {
++	const char *name;
++	int (* func)(int, char **, void *);
++} bfastpathrec;
++
++/*
++ * We've disabled the "fastpath" codepath for some commands below
++ * because it causes a paradoxon for large input files (as used by
++ * ON PerfPIT for testing). For /usr/bin/rev (where the issue was
++ * first discovered) it looks like this:
++ * - for small files like /etc/profile the fastpath is faster in a loop
++ *   with 1000 iterations (8 seconds with fastpath, 14 seconds without
++ *   fastpath)
++ * - for large files (/usr/pub/UTF-8 replicated until the test file
++ *   reaches 24884706 bytes) the benchmark reverses: The fastpath now
++ *   needs 40 seconds and without fastpath it needs 30 seconds (for 100
++ *   iterations).
++ */
++#if 0
++#define	ENABLE_PERFORMANCE_PARADOXON 1
++#endif
++
++/*
++ * List of libcmd builtins which do not require a |Shell_t| context.
++ * This list was automatically generated from <ast/cmdext.h>
++ */
++static const
++bfastpathrec fastpath_builtins[] =
++{
++	/* This list must be alphabetically sorted for |strcmp()| usage */
++	{ "basename",	b_basename	},
++	{ "cat",	b_cat		},
++	{ "chgrp",	b_chgrp		},
++	{ "chmod",	b_chmod		},
++	{ "chown",	b_chown		},
++#ifdef ENABLE_PERFORMANCE_PARADOXON
++	{ "cksum",	b_cksum		},
++#endif /* ENABLE_PERFORMANCE_PARADOXON */
++	{ "cmp",	b_cmp		},
++	{ "comm",	b_comm		},
++	{ "cp",		b_cp		},
++	{ "cut",	b_cut		},
++	{ "date",	b_date		},
++	{ "dirname",	b_dirname	},
++	{ "expr",	b_expr		},
++	{ "fds",	b_fds		},
++	{ "fmt",	b_fmt		},
++	{ "fold",	b_fold		},
++	{ "getconf",	b_getconf	},
++	{ "head",	b_head		},
++	{ "id",		b_id		},
++	{ "join",	b_join		},
++	{ "ln",		b_ln		},
++	{ "logname",	b_logname	},
++	{ "md5sum",	b_md5sum	},
++	{ "mkdir",	b_mkdir		},
++	{ "mkfifo",	b_mkfifo	},
++	{ "mktemp",	b_mktemp	},
++	{ "mv",		b_mv		},
++	{ "paste",	b_paste 	},
++	{ "pathchk",	b_pathchk	},
++	{ "pids",	b_pids		},
++#ifdef ENABLE_PERFORMANCE_PARADOXON
++	{ "rev",	b_rev		},
++#endif /* ENABLE_PERFORMANCE_PARADOXON */
++	{ "rm",		b_rm		},
++	{ "rmdir",	b_rmdir		},
++	{ "stty",	b_stty		},
++#ifdef ENABLE_PERFORMANCE_PARADOXON
++	{ "sum",	b_sum		},
++#endif /* ENABLE_PERFORMANCE_PARADOXON */
++	{ "sync",	b_sync		},
++	{ "tail",	b_tail		},
++	{ "tee",	b_tee		},
++	{ "tty",	b_tty		},
++	{ "uname",	b_uname		},
++	{ "uniq",	b_uniq		},
++	{ "wc",		b_wc		},
++	{ NULL, 	(int (*)(int, char **, void *))NULL }
++};
++
++static inline
++const bfastpathrec *
++find_bfastpathrec(const char *name)
++{
++	unsigned int i;
++	signed int cmpres;
++	for (i = 0; fastpath_builtins[i].name != NULL; i++) {
++		cmpres = strcmp(fastpath_builtins[i].name, name);
++		if (cmpres == 0)
++			return (&fastpath_builtins[i]);
++		else if (cmpres > 0)
++			return (NULL);
++
++	}
++	return (NULL);
++}
++
++static inline
++int
++fastpath_builtin_main(const bfastpathrec *brec, int argc, char *argv[])
++{
++	setlocale(LC_ALL, ""); /* calls |_ast_setlocale()| */
++
++	return ((*brec->func)(argc, argv, NULL));
++}
++
++
++/* Builtin script, original derived from alias.sh */
++static const char *script = "\n"
++/* Get name of builtin */
++"typeset cmd=\"${0##*/}\"\n"
++/*
++ * 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 the path was something like
++ * PATH=/usr/xpg4/bin:/usr/bin).
++ */
++"if [[ \"${cmd}\" != ~(Elr)(alias|unalias|command) ]] && "
++	"! alias \"${cmd}\" >/dev/null 2>&1 ; then\n"
++	"PATH='' builtin \"${cmd}\"\n"
++"fi\n"
++/* command is a keyword and needs to be handled separately */
++"if [[ \"${cmd}\" == \"command\" ]] ; then\n"
++	"command \"[email protected]\"\n"
++"else\n"
++#ifdef WORKAROUND_FOR_ALIAS_CRASH
++/*
++ * Work around a crash in /usr/bin/alias when invalid options are
++ * passed (e.g. $ /usr/bin/alias -c #). The shell code will call
++ * an error handler which does a |longjmp()| but somehow the code
++ * failed to do the |setjmp()| before this point.
++ * Putting the "alias" command in a subshell avoids the crash.
++ * Real cause of the issue is under investigation and a fix be
++ * delivered with the next ast-ksh update.
++ */
++	"( \"${cmd}\" \"[email protected]\" )\n"
++#else
++	"\"${cmd}\" \"[email protected]\"\n"
++#endif /* WORKAROUND_FOR_ALIAS_CRASH */
++"fi\n"
++"exitval=$?";
++
++
++static inline
++int
++script_builtin_main(int argc, char *argv[])
++{
++	int i;
++	Shell_t *shp;
++	Namval_t *np;
++	int exitval;
++
++	/*
++	 * Create copy of |argv| array shifted by one position to
++	 * emulate $ /usr/bin/sh <scriptname> <args1> <arg2> ... #.
++	 * First position is set to "/usr/bin/sh" since other
++	 * values may trigger special shell modes (e.g. *rsh* will
++	 * trigger "restricted" shell mode etc.).
++	 */
++	char *xargv[argc+2];
++	xargv[0] = "/usr/bin/sh";
++	xargv[1] = "scriptname";
++	for (i = 0; i < argc; i++) {
++		xargv[i+1] = argv[i];
++	}
++	xargv[i+1] = NULL;
++
++	shp = sh_init(argc+1, xargv, 0);
++	if (!shp)
++		error(ERROR_exit(1), "shell initialisation failed.");
++	(void) sh_trap(script, 0);
++
++	np = nv_open("exitval", shp->var_tree, 0);
++	if (!np)
++		error(ERROR_exit(1), "variable %s not found.", "exitval");
++	exitval = (int)nv_getnum(np);
++	nv_close(np);
++
++	return (exitval);
++}
++
++int
++main(int argc, char *argv[])
++{
++	const char *progname;
++	const bfastpathrec *brec;
++	char execnamebuff[PATH_MAX+1];
++
++	/* Get program name */
++	if (pathprog(argv[0], execnamebuff, sizeof (execnamebuff)) <= 0)
++		error(ERROR_exit(1), "could not determinate exec name.");
++
++	progname = (const char *)strrchr(execnamebuff, '/');
++	if (progname != NULL) {
++		progname++;
++	}
++	else
++	{
++		progname = execnamebuff;
++	}
++
++	/* Execute command... */
++	if (brec = find_bfastpathrec(progname)) {
++		/* ... either via a fast path (calling the code directly) ... */
++		return (fastpath_builtin_main(brec, argc, argv));
++	}
++	else
++	{
++		/* ... or from within a full shell. */
++		return (script_builtin_main(argc, argv));
++	}
++}
+diff -rupN b/src/cmd/alias/alias.h a/src/cmd/alias/alias.h
+--- b/src/cmd/alias/alias.h	1970-01-01 00:00:00.000000000 +0000
++++ a/src/cmd/alias/alias.h	2011-11-10 16:24:28.357387725 +0000
[email protected]@ -0,0 +1,79 @@
++/***********************************************************************
++*                                                                      *
++*               This software is part of the ast package               *
++*          Copyright (c) 1992-2011 AT&T Intellectual Property          *
++*                      and is licensed under the                       *
++*                  Common Public License, Version 1.0                  *
++*                    by AT&T Intellectual Property                     *
++*                                                                      *
++*                A copy of the License is available at                 *
++*            http://www.opensource.org/licenses/cpl1.0.txt             *
++*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
++*                                                                      *
++*              Information and Software Systems Research               *
++*                            AT&T Research                             *
++*                           Florham Park NJ                            *
++*                                                                      *
++*                 Glenn Fowler <[email protected]>                  *
++*                  David Korn <[email protected]>                   *
++*                                                                      *
++***********************************************************************/
++
++extern int b_asa (int, char**, void *);
++extern int b_basename (int, char**, void *);
++extern int b_cat (int, char**, void *);
++extern int b_chgrp (int, char**, void *);
++extern int b_chmod (int, char**, void *);
++extern int b_chown (int, char**, void *);
++extern int b_cksum (int, char**, void *);
++extern int b_cmp (int, char**, void *);
++extern int b_comm (int, char**, void *);
++extern int b_cp (int, char**, void *);
++extern int b_cut (int, char**, void *);
++extern int b_date (int, char**, void *);
++extern int b_dirname (int, char**, void *);
++extern int b_egrep (int, char**, void *);
++extern int b_expr (int, char**, void *);
++extern int b_fds (int, char**, void *);
++extern int b_fgrep (int, char**, void *);
++extern int b_find (int, char**, void *);
++extern int b_fmt (int, char**, void *);
++extern int b_fold (int, char**, void *);
++extern int b_getconf (int, char**, void *);
++extern int b_grep (int, char**, void *);
++extern int b_head (int, char**, void *);
++extern int b_id (int, char**, void *);
++extern int b_join (int, char**, void *);
++extern int b_line (int, char**, void *);
++extern int b_ln (int, char**, void *);
++extern int b_logname (int, char**, void *);
++extern int b_ls (int, char**, void *);
++extern int b_md5sum (int, char**, void *);
++extern int b_mkdir (int, char**, void *);
++extern int b_mkfifo (int, char**, void *);
++extern int b_mktemp (int, char**, void *);
++extern int b_mv (int, char**, void *);
++extern int b_paste (int, char**, void *);
++extern int b_od (int, char**, void *);
++extern int b_pathchk (int, char**, void *);
++extern int b_pids (int, char**, void *);
++extern int b_pr (int, char**, void *);
++extern int b_rev (int, char**, void *);
++extern int b_readlink (int, char**, void *);
++extern int b_rm (int, char**, void *);
++extern int b_rmdir (int, char**, void *);
++extern int b_stty (int, char**, void *);
++extern int b_sum (int, char**, void *);
++extern int b_sync (int, char**, void *);
++extern int b_strings (int, char**, void *);
++extern int b_tail (int, char**, void *);
++extern int b_tee (int, char**, void *);
++extern int b_tr (int, char**, void *);
++extern int b_tty (int, char**, void *);
++extern int b_uname (int, char**, void *);
++extern int b_uniq (int, char**, void *);
++extern int b_vmstate (int, char**, void *);
++extern int b_wc (int, char**, void *);
++extern int b_who (int, char**, void *);
++extern int b_xgrep (int, char**, void *);
++extern int b_xargs (int, char**, void *);
+diff -rupN b/src/cmd/alias/Makefile a/src/cmd/alias/Makefile
+--- b/src/cmd/alias/Makefile	1970-01-01 00:00:00.000000000 +0000
++++ a/src/cmd/alias/Makefile	2011-11-10 16:24:28.357746164 +0000
[email protected]@ -0,0 +1,5 @@
++:PACKAGE: ast:static
++
++LICENSE = cddl
++libtype = :static
++alias :: RELEASE alias.c +lshell
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/020-CR6919590.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,24 @@
+--- a/src/cmd/ksh93/sh/args.c	Thu Sep  2 22:38:27 2010
++++ b/src/cmd/ksh93/sh/args.c	Tue Sep 27 10:48:45 2011
[email protected]@ -26,6 +26,9 @@
+  * AT&T Labs
+  *
+  */
++/*
++ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
++ */
+ 
+ #include	"defs.h"
+ #include	"path.h"
[email protected]@ -302,6 +305,11 @@
+ 		}
+ 		else
+ 		{
++			if ((o == SH_RESTRICTED) &&
++			    sh_isoption(SH_RESTRICTED)) {
++				errormsg(SH_DICT, ERROR_exit(1),
++				    e_restricted, "r");
++			}
+ 			if(o==SH_XTRACE)
+ 				trace = 0;
+ 			off_option(&newflags,o);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/025-CR7033181.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,11 @@
+--- a/src/cmd/ksh93/bltins/typeset.c	Fri Dec 31 00:15:57 2010
++++ b/src/cmd/ksh93/bltins/typeset.c	Tue Jun 28 13:59:53 2011
[email protected]@ -608,7 +608,7 @@
+ 			}
+ 			if(!nv_isarray(np) && !strchr(name,'=') && !(shp->envlist  && nv_onlist(shp->envlist,name)))
+ 			{
+-				if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&NV_EXPORT) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
++				if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&(NV_EXPORT|NV_RDONLY)) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
+ {
+ 					_nv_unset(np,0);
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/030-CR7071431.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,11 @@
+--- a/src/cmd/ksh93/include/ulimit.h	Tue Oct 26 16:25:26 2010
++++ b/src/cmd/ksh93/include/ulimit.h	Thu Aug 25 10:19:37 2011
[email protected]@ -157,7 +157,7 @@
+ 
+ typedef struct Limit_s
+ {
+-	const char	name[8];
++	const char*	name;
+ 	const char*	description;
+ 	int		index;
+ 	const char*	conf;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/035-CR7036535.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,68 @@
+--- a/src/cmd/ksh93/sh/path.c	Mon Nov 22 20:55:38 2010
++++ b/src/cmd/ksh93/sh/path.c	Tue Sep 27 10:48:45 2011
[email protected]@ -1430,7 +1435,7 @@
+ 		len = strlen(name);
+ 	for(pp=first; pp; pp=pp->next)
+ 	{
+-		if(memcmp(name,pp->name,len)==0 && (pp->name[len]==':' || pp->name[len]==0))
++		if(strncmp(name,pp->name,len)==0 && (pp->name[len]==':' || pp->name[len]==0))
+ 		{
+ 			pp->flags |= flag;
+ 			return(first);
[email protected]@ -1740,7 +1745,7 @@
+ 	register Pathcomp_t *pp=first;
+ 	while(pp)
+ 	{
+-		if(memcmp(name,pp->name,pp->len)==0 && name[pp->len]==c) 
++		if(strncmp(name,pp->name,pp->len)==0 && name[pp->len]==c) 
+ 			return(pp);
+ 		pp = pp->next;
+ 	}
+--- a/src/cmd/ksh93/sh/nvtree.c	Sun Jan  2 17:45:14 2011
++++ b/src/cmd/ksh93/sh/nvtree.c	Fri Jul 22 00:30:31 2011
[email protected]@ -26,6 +26,9 @@
+  *   AT&T Labs
+  *
+  */
++/*
++ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
++ */
+ 
+ #include	"defs.h"
+ #include	"name.h"
[email protected]@ -188,7 +191,7 @@
+ 		{
+ 			char *cp = nv_name(dp->hp);
+ 			c = strlen(cp);
+-			if(memcmp(name,cp,c) || name[c]!='[')
++			if(strncmp(name,cp,c) || name[c]!='[')
+ 				dp->hp = (Namval_t*)dtnext(dp->root,dp->hp);
+ 			else
+ 			{
[email protected]@ -266,7 +269,7 @@
+ {
+ 	if(dp->nextnode)
+ 		return((*dp->nextnode)(dp->hp,dp->root,dp->fun));
+-	if(dp->len && memcmp(dp->data, dp->hp->nvname, dp->len))
++	if(dp->len && strncmp(dp->data, dp->hp->nvname, dp->len))
+ 		return(0);
+ 	return((Namval_t*)dtnext(dp->root,dp->hp));
+ }
[email protected]@ -311,7 +314,7 @@
+ 					dp->hp = (*dp->nextnode)(np,(Dt_t*)0,dp->fun);
+ 			}
+ 			sh.last_table = last_table;
+-			if(!dp->len || memcmp(cp,dp->data,dp->len)==0)
++			if(!dp->len || strncmp(cp,dp->data,dp->len)==0)
+ 			{
+ 				if((nfp=nextdisc(np)) && (nfp->disc->getval||nfp->disc->getnum) && nv_isvtree(np) && strcmp(cp,dp->data))
+ 					nfp = 0;
[email protected]@ -861,7 +864,7 @@
+ 					continue;
+ 				break;
+ 			}
+-			else if(outfile && !wp->nofollow && argv[1] && memcmp(arg,argv[1],l=strlen(arg))==0 && argv[1][l]=='[')
++			else if(outfile && !wp->nofollow && argv[1] && strncmp(arg,argv[1],l=strlen(arg))==0 && argv[1][l]=='[')
+ 			{
+ 				int	k=1;
+ 				Namarr_t *ap=0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/040-CRXXX_Error_Catalog.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,11 @@
+--- a/src/cmd/builtin/asa.c	Wed Nov  1 16:47:27 2006
++++ b/src/cmd/builtin/asa.c	Tue Jun 28 13:59:47 2011
[email protected]@ -110,7 +110,7 @@
+ 	register Sfio_t	*fp;
+ 	register int	n, reclen=0;
+ 
+-	cmdinit(argc, argv,(void*)0,(const char*)0,0);
++	cmdinit(argc, argv, context, ERROR_CATALOG, 0);
+ 	while (n = optget(argv, usage)) switch (n)
+ 	{
+ 	    case 'r':
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/045-CR7025778.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,44 @@
+--- a/src/lib/libcmd/cmp.c	Mon Apr 12 15:39:53 2010
++++ b/src/lib/libcmd/cmp.c	Tue Jun 28 13:59:47 2011
[email protected]@ -1,3 +1,7 @@
++/*
++ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
++ */
++
+ /***********************************************************************
+ *                                                                      *
+ *               This software is part of the ast package               *
[email protected]@ -164,6 +168,10 @@
+ 				return ret;
+ 			if (!(p1 = (unsigned char*)sfreserve(f1, SF_UNBOUND, 0)) || (c1 = sfvalue(f1)) <= 0)
+ 			{
++				if (sferror(f1)) {
++					error(ERROR_exit(2),
++					    "read error on %s", file1);
++				}
+ 				if ((e2 - p2) > 0 || sfreserve(f2, SF_UNBOUND, 0) && sfvalue(f2) > 0)
+ 				{
+ 					ret = 1;
[email protected]@ -170,6 +178,10 @@
+ 					if (!(flags & CMP_SILENT))
+ 						error(ERROR_exit(1), "EOF on %s", file1);
+ 				}
++				if (sferror(f2)) {
++					error(ERROR_exit(2),
++					    "read error on %s", file2);
++				}
+ 				return ret;
+ 			}
+ 			if (count > 0 && c1 > count)
[email protected]@ -181,6 +193,10 @@
+ 		{
+ 			if (!(p2 = (unsigned char*)sfreserve(f2, SF_UNBOUND, 0)) || (c2 = sfvalue(f2)) <= 0)
+ 			{
++				if (sferror(f2)) {
++					error(ERROR_exit(2),
++					    "read error on %s", file2);
++				}
+ 				if (!(flags & CMP_SILENT))
+ 					error(ERROR_exit(1), "EOF on %s", file2);
+ 				return 1;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/050-CR7065478.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,46 @@
+--- a/src/lib/libast/comp/setlocale.c	Mon Dec 27 04:23:49 2010
++++ b/src/lib/libast/comp/setlocale.c	Fri Jul 22 00:30:31 2011
[email protected]@ -19,6 +19,9 @@
+ *                   Phong Vo <[email protected]>                    *
+ *                                                                      *
+ ***********************************************************************/
++/*
++ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
++ */
+ #pragma prototyped
+ 
+ /*
[email protected]@ -2236,6 +2239,24 @@
+ 
+ typedef int (*Isw_f)(wchar_t);
+ 
++static int
++wide_wctomb(char* u, wchar_t w) 
++{
++	int size = 0;
++
++	if (u)
++	{
++		size = wctomb(u, w);
++		if (size < 0)
++		{
++			*u = (char)(w & 0xff);
++			size = 1;
++		}
++	}
++
++	return size;
++}
++
+ /*
+  * called when LC_CTYPE initialized or changes
+  */
[email protected]@ -2280,7 +2301,7 @@
+ 	{
+ 		if (!(ast.mb_width = wcwidth))
+ 			ast.mb_width = default_wcwidth;
+-		ast.mb_conv = wctomb;
++		ast.mb_conv = wide_wctomb;
+ #ifdef mb_state
+ 		{
+ 			/*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/055-CR7026179.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,49 @@
+--- a/src/lib/libcmd/wclib.c	Tue Dec  1 17:10:57 2009
++++ b/src/lib/libcmd/wclib.c	Wed Jun 29 15:22:42 2011
[email protected]@ -18,6 +18,9 @@
+ *                  David Korn <[email protected]>                   *
+ *                                                                      *
+ ***********************************************************************/
++/*
++ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
++ */
+ #pragma prototyped
+ /*
+  * David Korn
[email protected]@ -341,7 +344,9 @@
+ 		int		xspace;
+ 		int		wasspace = 1;
+ 		unsigned char*	start;
++		int             flagm = 0;
+ 
++
+ 		lastchar = 0;
+ 		start = (endbuff = side) + 1;
+ 		xspace = iswspace(0xa0) || iswspace(0x85);
[email protected]@ -367,6 +372,7 @@
+ 			if(mbc(lasttype))
+ 			{
+ 				c = lasttype;
++				flagm = 1;
+ 				goto mbyte;
+ 			}
+ 			if(!lasttype && spc(type[*cp]))
[email protected]@ -415,6 +421,18 @@
+ 							skip = (c&7);
+ 							adjust += skip;
+ 							state = 0;
++							if (flagm == 1) {
++								flagm = 0;
++								oldc = *cp;
++								if (xspace && (
++								    iswspace
++								    (*cp)
++								    == 1)) {
++									state
++									    = 8;
++								}
++								continue;
++							}
+ 							if(skip==2 && (cp[-1]&0xc)==0 && (state=(cp[-1]&0x3)))
+ 								oldc = *cp;
+ 							else if(xspace && cp[-1]==0xc2)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/060-CR7065900.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,11 @@
+--- a/src/cmd/ksh93/data/builtins.c	Tue Dec  7 19:23:04 2010
++++ b/src/cmd/ksh93/data/builtins.c	Mon Jul 18 12:08:50 2011
[email protected]@ -108,7 +108,6 @@
+ 	"printf",	NV_BLTIN|BLT_ENV,		bltin(printf),
+ 	"pwd",		NV_BLTIN,			bltin(pwd),
+ 	"read",		NV_BLTIN|BLT_ENV,		bltin(read),
+-	"sleep",	NV_BLTIN,			bltin(sleep),
+ 	"alarm",	NV_BLTIN,			bltin(alarm),
+ 	"ulimit",	NV_BLTIN|BLT_ENV,		bltin(ulimit),
+ 	"umask",	NV_BLTIN|BLT_ENV,		bltin(umask),
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/065-CR7110983.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,24 @@
+diff -r bb8978c251cb -r 6fbea5c30b60 usr/src/cmd/ast/lib/libshell/common/sh/name.c
+--- a/src/cmd/ksh93/sh/name.c	Sun Mar 25 23:19:46 2012 -0700
++++ b/src/cmd/ksh93/sh/name.c	Mon Mar 26 05:09:19 2012 -0700
[email protected]@ -22,6 +22,9 @@
+  * AT&T Labs
+  *
+  */
++/*
++ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
++ */
+ 
+ #define putenv	___putenv
+ 
[email protected]@ -1832,7 +1835,10 @@
+ 			else
+ #endif
+ 			if(size==0 && nv_isattr(np,NV_HOST)!=NV_HOST &&nv_isattr(np,NV_LJUST|NV_RJUST|NV_ZFILL))
++			{
+ 				nv_setsize(np,size=dot);
++				tofree = up->cp;
++			}
+ 			else if(size > dot)
+ 				dot = size;
+ 			else if(nv_isattr(np,NV_LJUST|NV_RJUST)==NV_LJUST && dot>size)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/070-CR7105086.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,46 @@
+diff -r bb8978c251cb -r 6fbea5c30b60 usr/src/cmd/ast/lib/libshell/common/sh/jobs.c
+--- a/src/cmd/ksh93/sh/jobs.c	Sun Mar 25 23:19:46 2012 -0700
++++ b/src/cmd/ksh93/sh/jobs.c	Mon Mar 26 05:09:19 2012 -0700
[email protected]@ -28,6 +28,9 @@
+  *  Rewritten April, 1988
+  *  Revised January, 1992
+  */
++/*
++ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
++ */
+ 
+ #include	"defs.h"
+ #include	<wait.h>
[email protected]@ -57,6 +60,7 @@
+ {
+ 	struct jobsave	*next;
+ 	pid_t		pid;
++	short		curenv;
+ 	unsigned short	exitval;
+ };
+ 
[email protected]@ -232,6 +236,7 @@
+ 		jp->pid = pid;
+ 		jp->next = bck.list;
+ 		bck.list = jp;
++		jp->curenv = 0;
+ 		jp->exitval = 0;
+ 	}
+ 	return(jp);
[email protected]@ -1790,6 +1795,7 @@
+ 			/* save status for future wait */
+ 			if(jp = jobsave_create(pw->p_pid))
+ 			{
++				jp->curenv = pw->p_env;
+ 				jp->exitval = pw->p_exit;
+ 				if(pw->p_flag&P_SIGNALLED)
+ 					jp->exitval |= SH_EXITSIG;
[email protected]@ -1967,7 +1973,7 @@
+ 	for(jp=bck.list; jp; jp=jpnext)
+ 	{
+ 		jpnext = jp->next;
+-		if(jp->pid==sh.spid)
++		if(jp->curenv != sh.curenv || jp->pid==sh.spid)
+ 		{
+ 			jp->next = bp->list;
+ 			bp->list = jp;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/075-multi_lang_arith.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,12 @@
+diff -rupN a/src/lib/libast/sfio/sfstrtof.h b/src/lib/libast/sfio/sfstrtof.h
+--- a/src/lib/libast/sfio/sfstrtof.h	2010-12-24 14:32:27.000000000 +0000
++++ b/src/lib/libast/sfio/sfstrtof.h	2011-10-25 12:21:57.749942750 +0100
[email protected]@ -414,7 +414,7 @@ S2F_function(str, end) char* str; char**
+ 			m = 0;
+ 			fraction = digits;
+ 		}
+-		else if (c != thousand)
++		else if (c != thousand || (c == thousand && decimal == -1))
+ 			break;
+ 		else if (!(m = digits))
+ 		{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/080-CR7057565.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,12 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/Makefile INIT.2011-02-08/src/cmd/ksh93/Makefile
+--- INIT.2011-02-08.clean/src/cmd/ksh93/Makefile	2012-04-11 17:48:34.919720887 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/Makefile	2012-04-11 17:51:33.474974484 +0100
[email protected]@ -40,7 +40,7 @@ SHOPT_NAMESPACE == 1		/* allow namespace
+ SHOPT_OLDTERMIO ==		/* support both TCGETA and TCGETS */
+ SHOPT_OPTIMIZE == 1		/* optimize loop invariants */
+ SHOPT_PFSH == 1			/* solaris exec_attr(4) profile execution */
+-SHOPT_P_SUID ==			/* real uid's that require -p for set[ug]id */
++SHOPT_P_SUID == 1		/* real uid's that require -p for set[ug]id */
+ SHOPT_RAWONLY == 1		/* make viraw the only vi mode */
+ SHOPT_REGRESS ==		/* enable __regress__ builtin and instrumented intercepts for testing */
+ SHOPT_REMOTE ==			/* enable --rc if running as a remote shell */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/085-CR7046434.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,13 @@
+diff -rupN INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c
+--- INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c	2012-05-01 10:06:04.621554775 -0700
++++ INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c	2012-05-01 10:05:25.139965959 -0700
[email protected]@ -241,9 +241,6 @@ Namval_t *sh_assignok(register Namval_t 
+ 	/* don't bother with this */
+ 	if(!sp->shpwd || np==SH_LEVELNOD || np==L_ARGNOD || np==SH_SUBSCRNOD || np==SH_NAMENOD)
+ 		return(np);
+-	/* don't bother to save if in newer scope */
+-	if(sp->var!=shp->var_tree && shp->last_root==shp->var_tree)
+-		return(np);
+ 	if((ap=nv_arrayptr(np)) && (mp=nv_opensub(np)))
+ 	{
+ 		shp->last_root = ap->table;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/090-CR7032821.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,11 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/jobs.c INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/jobs.c	2012-05-08 12:44:12.309610229 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c	2012-05-08 12:48:34.559797683 +0100
[email protected]@ -950,6 +950,7 @@ int job_walk(Sfio_t *file,int (*fun)(str
+ 			if(!(pw = job_bypid(pid)))
+ 			{
+ 				pw = &dummy;
++				pw->p_shp = sh_getinterp();
+ 				pw->p_pid = pid;
+ 				pw->p_pgrp = pid;
+ 			}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/095-CR7009897.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,33 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c	2012-05-02 01:59:48.571110152 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c	2012-05-02 02:05:56.082206972 -0700
[email protected]@ -1262,7 +1262,7 @@ retry1:
+ 				stkseek(stkp,stktell(stkp)-2);
+ 				nv_local = 1;
+ 			}
+-			else
++			else if (type != M_VNAME)
+ 			{
+ 				stkseek(stkp,stktell(stkp)-1);
+ 				type = M_TREE;
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvtree.c INIT.2011-02-08/src/cmd/ksh93/sh/nvtree.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvtree.c	2012-05-02 01:59:52.497548227 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/nvtree.c	2012-05-02 02:07:16.084944399 -0700
[email protected]@ -1069,7 +1069,7 @@ Namfun_t *nv_isvtree(Namval_t *np)
+  */
+ char *nv_getvtree(register Namval_t *np, Namfun_t *fp)
+ {
+-	int flags=0, dsize=fp->dsize;
++	int flags=0;
+ 	for(; fp && fp->next; fp=fp->next)
+ 	{
+ 		if(fp->next->disc && (fp->next->disc->getnum || fp->next->disc->getval))
[email protected]@ -1083,7 +1083,7 @@ char *nv_getvtree(register Namval_t *np,
+ 		nv_offattr(np,NV_EXPORT);
+ 	if(flags |= nv_isattr(np,NV_TABLE))
+ 		nv_offattr(np,NV_TABLE);
+-	if(dsize && (flags&NV_EXPORT))
++	if( (fp) && (fp->dsize) && (flags&NV_EXPORT))
+ 		return("()");
+ 	return(walk_tree(np,(Namval_t*)0,flags));
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/100-CR6964621.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,551 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/include/io.h INIT.2011-02-08/src/cmd/ksh93/include/io.h
+--- INIT.2011-02-08.clean/src/cmd/ksh93/include/io.h	2012-05-02 03:16:17.383778774 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/include/io.h	2012-05-02 03:17:53.562408338 -0700
[email protected]@ -23,6 +23,9 @@
+  *	David Korn
+  *
+  */
++/*
++ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
++ */
+ 
+ #include	<ast.h>
+ #include	<sfio.h>
[email protected]@ -84,6 +87,12 @@ extern int	sh_devtofd(const char*);
+ extern int	sh_isdevfd(const char*);
+ extern int	sh_source(Shell_t*, Sfio_t*, const char*);
+ 
++extern int	VALIDATE_FD(Shell_t *, int);
++
++#define	VALIDATE_FD(shp, fd) \
++	(((fd) >= (shp)->gd->lim.open_max) ? sh_iovalidfd(shp, fd) : 1)
++
++
+ /* the following are readonly */
+ extern const char	e_pexists[];
+ extern const char	e_query[];
[email protected]@ -123,4 +132,5 @@ extern const char	e_bash_profile[];
+ extern const char	e_stdprompt[];
+ extern const char	e_supprompt[];
+ extern const char	e_ambiguous[];
++
+ #endif /* KSHELL */
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c INIT.2011-02-08/src/cmd/ksh93/sh/io.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c	2012-05-02 03:16:17.389917698 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/io.c	2012-05-02 03:19:12.669621809 -0700
[email protected]@ -596,8 +596,10 @@ static void io_preserve(Shell_t* shp, re
+ 		((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT;
+ 		errormsg(SH_DICT,ERROR_system(1),e_toomany);
+ 	}
+-	if(f2 >= shp->gd->lim.open_max)
+-		sh_iovalidfd(shp,f2);
++
++	VALIDATE_FD(shp, fd);
++	VALIDATE_FD(shp, f2);
++
+ 	if(shp->fdptrs[fd]=shp->fdptrs[f2])
+ 	{
+ 		if(f2==job.fd)
[email protected]@ -623,7 +625,12 @@ static void io_preserve(Shell_t* shp, re
+  */
+ int sh_iorenumber(Shell_t *shp, register int f1,register int f2)
+ {
+-	register Sfio_t *sp = shp->sftable[f2];
++	register Sfio_t *sp;
++
++	VALIDATE_FD(shp, f1);
++	VALIDATE_FD(shp, f2);
++
++	sp = shp->sftable[f2];
+ 	if(f1!=f2)
+ 	{
+ 		/* see whether file descriptor is in use */
[email protected]@ -663,8 +670,7 @@ int sh_iorenumber(Shell_t *shp, register
+ 		if(f2<=2)
+ 			sfset(sp,SF_SHARE|SF_PUBLIC,1);
+ 	}
+-	if(f2>=shp->gd->lim.open_max)
+-		sh_iovalidfd(shp,f2);
++	VALIDATE_FD(shp, f2);
+ 	return(f2);
+ }
+ 
[email protected]@ -678,8 +684,9 @@ int sh_close(register int fd)
+ 	register int r = 0;
+ 	if(fd<0)
+ 		return(-1);
+-	if(fd >= shp->gd->lim.open_max)
+-		sh_iovalidfd(shp,fd);
++
++	VALIDATE_FD(shp, fd);
++
+ 	if(!(sp=shp->sftable[fd]) || sfclose(sp) < 0)
+ 	{
+ 		if(fdnotify)
[email protected]@ -835,6 +842,9 @@ int sh_open(register const char *path, i
+ 		mode = (IOREAD|IOWRITE);
+ 	else
+ 		mode = IOREAD;
++
++	VALIDATE_FD(shp, fd);
++
+ 	shp->fdstatus[fd] = mode;
+ 	return(fd);
+ }
[email protected]@ -861,6 +871,8 @@ int sh_iomovefd(register int fdold)
+ 	if(fdold<0 || fdold>2)
+ 		return(fdold);
+ 	fdnew = sh_iomovefd(dup(fdold));
++	VALIDATE_FD(shp, fdold);
++	VALIDATE_FD(shp, fdnew);
+ 	shp->fdstatus[fdnew] = (shp->fdstatus[fdold]&~IOCLEX);
+ 	close(fdold);
+ 	shp->fdstatus[fdold] = IOCLOSE;
[email protected]@ -897,6 +909,9 @@ int	sh_pipe(register int pv[])
+ 		sh_close(fd);
+ 	else
+ 		pv[out] = sh_iomovefd(fd);
++
++	VALIDATE_FD(shp, pv[out]);
++
+ 	if(fcntl(pv[out],F_SETFD,FD_CLOEXEC) >=0)
+ 		shp->fdstatus[pv[out]] |= IOCLEX;
+ 	shp->fdstatus[pv[out]] = (out?IOWRITE:IOREAD);
[email protected]@ -929,6 +944,9 @@ int	sh_pipe(register int pv[])
+ 		errormsg(SH_DICT,ERROR_system(1),e_pipe);
+ 	}
+ 	fcntl(pv[out],F_SETFD,FD_CLOEXEC);
++
++	VALIDATE_FD(shp, pv[out]);
++
+ 	shp->fdstatus[pv[out]] |= IOCLEX;
+ 	pv[1-out] = -1;
+ 	pv[2] = port;
[email protected]@ -958,9 +976,13 @@ static int pat_line(const regex_t* rp, c
+ static int io_patseek(Shell_t *shp, regex_t *rp, Sfio_t* sp, int flags)
+ {
+ 	char	*cp, *match;
+-	int	r, fd=sffileno(sp), close_exec = shp->fdstatus[fd]&IOCLEX;
++	int	r, fd, close_exec;
+ 	int	was_share,s=(PIPE_BUF>SF_BUFSIZE?SF_BUFSIZE:PIPE_BUF);
+ 	size_t	n,m;
++
++	fd = sffileno(sp);
++	VALIDATE_FD(shp, fd);
++	close_exec = shp->fdstatus[fd]&IOCLEX;
+ 	shp->fdstatus[sffileno(sp)] |= IOCLEX;
+ 	if(fd==0)
+ 		was_share = sfset(sp,SF_SHARE,1);
[email protected]@ -994,12 +1016,17 @@ static int io_patseek(Shell_t *shp, rege
+ 
+ static Sfoff_t	file_offset(Shell_t *shp, int fn, char *fname)
+ {
+-	Sfio_t		*sp = shp->sftable[fn];
++	Sfio_t		*sp;
+ 	char		*cp;
+ 	Sfoff_t		off;
+ 	struct Eof	endf;
+ 	Namval_t	*mp = nv_open("EOF",shp->var_tree,0);
+ 	Namval_t	*pp = nv_open("CUR",shp->var_tree,0);
++
++	VALIDATE_FD(shp, fn);
++
++	sp = shp->sftable[fn];
++
+ 	memset(&endf,0,sizeof(struct Eof));
+ 	endf.fd = fn;
+ 	endf.hdr.disc = &EOF_disc;
[email protected]@ -1169,7 +1196,7 @@ int	sh_redirect(Shell_t *shp,struct iono
+ 			if((iof&IOLSEEK) || ((iof&IOMOV) && *fname=='-'))
+ 				fn = nv_getnum(np);
+ 		}
+-		if(fn>=shp->gd->lim.open_max && !sh_iovalidfd(shp,fn))
++		if (!VALIDATE_FD(shp, fn))
+ 			errormsg(SH_DICT,ERROR_system(1),e_file+4);
+ 		if(iof&IOLSEEK)
+ 		{
[email protected]@ -1212,6 +1239,7 @@ int	sh_redirect(Shell_t *shp,struct iono
+ 						message = e_file;
+ 						goto fail;
+ 					}
++					VALIDATE_FD(shp, dupfd);
+ 					if(shp->subshell && dupfd==1)
+ 					{
+ 						if(sfset(sfstdout,0,0)&SF_STRING)
[email protected]@ -1248,8 +1276,7 @@ int	sh_redirect(Shell_t *shp,struct iono
+ 					goto traceit;
+ 				if((fd=sh_fcntl(dupfd,F_DUPFD,3))<0)
+ 					goto fail;
+-				if(fd>= shp->gd->lim.open_max)
+-					sh_iovalidfd(shp,fd);
++				VALIDATE_FD(shp, fd);
+ 				sh_iocheckfd(shp,dupfd);
+ 				shp->fdstatus[fd] = (shp->fdstatus[dupfd]&~IOCLEX);
+ 				if(toclose<0 && shp->fdstatus[fd]&IOREAD)
[email protected]@ -1362,7 +1389,11 @@ int	sh_redirect(Shell_t *shp,struct iono
+ 			}
+ 			if(iof&IOLSEEK)
+ 			{
+-				Sfio_t *sp = shp->sftable[fn];
++				Sfio_t *sp;
++
++				VALIDATE_FD(shp, fn);
++
++				sp = shp->sftable[fn];
+ 				r = shp->fdstatus[fn];
+ 				if(!(r&(IOSEEK|IONOSEEK)))
+ 					r = sh_iocheckfd(shp,fn);
[email protected]@ -1443,6 +1474,7 @@ int	sh_redirect(Shell_t *shp,struct iono
+ 			}
+ 			if(fd<0)
+ 			{
++				VALIDATE_FD(shp, fn);
+ 				if(sh_inuse(shp,fn) || (fn && fn==shp->infd))
+ 				{
+ 					if(fn>9 || !(shp->inuse_bits&(1<<fn)))
[email protected]@ -1462,7 +1494,7 @@ int	sh_redirect(Shell_t *shp,struct iono
+ 					{
+ 						if((fn=fcntl(fd,F_DUPFD,10)) < 0)
+ 							goto fail;
+-						if(fn>=shp->gd->lim.open_max && !sh_iovalidfd(shp,fn))
++						if (!VALIDATE_FD(shp, fn))
+ 							goto fail;
+ 						shp->fdstatus[fn] = shp->fdstatus[fd];
+ 						sh_close(fd);
[email protected]@ -1622,7 +1654,12 @@ void sh_iosave(Shell_t *shp, register in
+ 	filemap[shp->topfd++].save_fd = savefd;
+ 	if(savefd >=0)
+ 	{
+-		register Sfio_t* sp = shp->sftable[origfd];
++		register Sfio_t* sp;
++
++		VALIDATE_FD(shp, origfd);
++		VALIDATE_FD(shp, savefd);
++
++		sp = shp->sftable[origfd];
+ 		/* make saved file close-on-exec */
+ 		sh_fcntl(savefd,F_SETFD,FD_CLOEXEC);
+ 		if(origfd==job.fd)
[email protected]@ -1655,6 +1692,7 @@ void	sh_iounsave(Shell_t* shp)
+ 			filemap[newfd++] = filemap[fd];
+ 		else
+ 		{
++			VALIDATE_FD(shp, savefd);
+ 			shp->sftable[savefd] = 0;
+ 			sh_close(savefd);
+ 		}
[email protected]@ -1678,16 +1716,19 @@ void	sh_iorestore(Shell_t *shp, int last
+ 		{
+ 			if ((savefd = filemap[fd].save_fd) >= 0)
+ 			{
++				VALIDATE_FD(shp, savefd);
+ 				shp->sftable[savefd] = 0;
+ 				sh_close(savefd);
+ 			}
+ 			continue;
+ 		}
+ 		origfd = filemap[fd].orig_fd;
++		VALIDATE_FD(shp, origfd);
+ 		if(origfd<0)
+ 		{
+ 			/* this should never happen */
+ 			savefd = filemap[fd].save_fd;
++			VALIDATE_FD(shp, savefd);
+ 			shp->sftable[savefd] = 0;
+ 			sh_close(savefd);
+ 			return;
[email protected]@ -1699,6 +1740,7 @@ void	sh_iorestore(Shell_t *shp, int last
+ 		sh_close(origfd);
+ 		if ((savefd = filemap[fd].save_fd) >= 0)
+ 		{
++			VALIDATE_FD(shp, savefd);
+ 			sh_fcntl(savefd, F_DUPFD, origfd);
+ 			if(savefd==job.fd)
+ 				job.fd=origfd;
[email protected]@ -1954,6 +1996,9 @@ static ssize_t slowread(Sfio_t *iop,void
+ int sh_iocheckfd(Shell_t *shp, register int fd)
+ {
+ 	register int flags, n;
++
++	VALIDATE_FD(shp, fd);
++
+ 	if((n=shp->fdstatus[fd])&IOCLOSE)
+ 		return(n);
+ 	if(!(n&(IOREAD|IOWRITE)))
[email protected]@ -2145,7 +2190,7 @@ static void	sftrack(Sfio_t* sp, int flag
+ 		return;
+ 	}
+ #endif
+-	if(fd<0 || (fd>=shp->gd->lim.open_max && !sh_iovalidfd(shp,fd)))
++	if (fd < 0 || !VALIDATE_FD(shp, fd))
+ 		return;
+ 	if(sh_isstate(SH_NOTRACK))
+ 		return;
[email protected]@ -2413,6 +2458,8 @@ ssize_t sh_read(register int fd, void* b
+ {
+ 	Shell_t *shp = sh_getinterp();
+ 	register Sfio_t *sp;
++
++	VALIDATE_FD(shp, fd);
+ 	if(sp=shp->sftable[fd])
+ 		return(sfread(sp,buff,n));
+ 	else
[email protected]@ -2427,6 +2474,8 @@ ssize_t sh_write(register int fd, const 
+ {
+ 	Shell_t *shp = sh_getinterp();
+ 	register Sfio_t *sp;
++
++	VALIDATE_FD(shp, fd);
+ 	if(sp=shp->sftable[fd])
+ 		return(sfwrite(sp,buff,n));
+ 	else
[email protected]@ -2441,6 +2490,8 @@ off_t sh_seek(register int fd, off_t off
+ {
+ 	Shell_t *shp = sh_getinterp();
+ 	register Sfio_t *sp;
++
++	VALIDATE_FD(shp, fd);
+ 	if((sp=shp->sftable[fd]) && (sfset(sp,0,0)&(SF_READ|SF_WRITE)))
+ 		return(sfseek(sp,offset,whence));
+ 	else
[email protected]@ -2452,6 +2503,9 @@ int sh_dup(register int old)
+ {
+ 	Shell_t *shp = sh_getinterp();
+ 	register int fd = dup(old);
++
++	VALIDATE_FD(shp, old);
++	VALIDATE_FD(shp, fd);
+ 	if(fd>=0)
+ 	{
+ 		if(shp->fdstatus[old] == IOCLOSE)
[email protected]@ -2473,13 +2527,15 @@ int sh_fcntl(register int fd, int op, ..
+ 	arg =  va_arg(ap, int) ;
+ 	va_end(ap);
+ 	newfd = fcntl(fd,op,arg);
++
++	VALIDATE_FD(shp, fd);
++	VALIDATE_FD(shp, newfd);
++
+ 	if(newfd>=0) switch(op)
+ 	{
+ 	    case F_DUPFD:
+ 		if(shp->fdstatus[fd] == IOCLOSE)
+ 			shp->fdstatus[fd] = 0;
+-		if(newfd>=shp->gd->lim.open_max)
+-			sh_iovalidfd(shp,newfd);
+ 		shp->fdstatus[newfd] = (shp->fdstatus[fd]&~IOCLEX);
+ 		if(fdnotify)
+ 			(*fdnotify)(fd,newfd);
[email protected]@ -2548,6 +2604,7 @@ Sfio_t *sh_iogetiop(int fd, int mode)
+ 		return(iop);
+ 	if(mode==SF_READ && !(n&IOREAD))
+ 		return(iop);
++	VALIDATE_FD(shp, fd);
+ 	if(!(iop = shp->sftable[fd]))
+ 		iop=sh_iostream(shp,fd);
+ 	return(iop);
[email protected]@ -2567,7 +2624,10 @@ Sfio_t	*sh_fd2sfio(int fd)
+ {
+ 	Shell_t	*shp = sh_getinterp();
+ 	register int status;
+-	Sfio_t *sp = shp->sftable[fd];
++	Sfio_t *sp;
++
++	VALIDATE_FD(shp, fd);
++	sp = shp->sftable[fd];
+ 	if(!sp  && (status = sh_iocheckfd(shp,fd))!=IOCLOSE)
+ 	{
+ 		register int flags=0;
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/lex.c INIT.2011-02-08/src/cmd/ksh93/sh/lex.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/lex.c	2012-05-02 03:16:17.388010187 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/lex.c	2012-05-02 03:17:53.567785551 -0700
[email protected]@ -25,6 +25,9 @@
+  * AT&T Labs
+  *
+  */
++/*
++ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
++ */
+ 
+ #include	<ast.h>
+ #include	<stak.h>
[email protected]@ -2053,6 +2056,7 @@ void	sh_syntax(Lex_t *lp)
+ 	else
+ 		lp->lastline = shp->inlineno;
+ 	tokstr = fmttoken(lp,tok,tokbuf);
++	VALIDATE_FD(shp, shp->infd);
+ 	if((sp=fcfile()) || (shp->infd>=0 && (sp=shp->sftable[shp->infd])))
+ 	{
+ 		/* clear out any pending input */
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c	2012-05-02 03:16:26.100861446 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c	2012-05-02 03:17:53.569195199 -0700
[email protected]@ -2086,6 +2086,7 @@ static void comsubst(Mac_t *mp,register 
+ 			sh_popcontext(mp->shp,&buff);
+ 			if(r==0 && ip && (ip->iofile&IOLSEEK))
+ 			{
++				VALIDATE_FD(mp->shp, fd);
+ 				if(sp=mp->shp->sftable[fd])
+ 					num = sftell(sp);
+ 				else
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c INIT.2011-02-08/src/cmd/ksh93/sh/main.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c	2012-05-02 03:16:17.389138504 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/main.c	2012-05-02 03:17:53.570027033 -0700
[email protected]@ -26,6 +26,9 @@
+  * AT&T Labs
+  *
+  */
++/*
++ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
++ */
+ 
+ #include	<ast.h>
+ #include	<sfio.h>
[email protected]@ -396,8 +399,10 @@ static void	exfile(register Shell_t *shp
+ 		if(fno > 0)
+ 		{
+ 			int r;
++			VALIDATE_FD(shp, fno);
+ 			if(fno < 10 && ((r=sh_fcntl(fno,F_DUPFD,10))>=10))
+ 			{
++				VALIDATE_FD(shp, r);
+ 				shp->fdstatus[r] = shp->fdstatus[fno];
+ 				sh_close(fno);
+ 				fno = r;
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c INIT.2011-02-08/src/cmd/ksh93/sh/path.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c	2012-05-02 03:16:20.752378905 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/path.c	2012-05-02 03:17:53.571078341 -0700
[email protected]@ -23,6 +23,9 @@
+  * AT&T Labs
+  *
+  */
++/*
++ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
++ */
+ 
+ #include	"defs.h"
+ #include	<fcin.h>
[email protected]@ -1239,6 +1242,7 @@ static void exscript(Shell_t *shp,regist
+ 	if(sp=fcfile())
+ 		while(sfstack(sp,SF_POPSTACK));
+ 	job_clear();
++	VALIDATE_FD(shp, shp->infd);
+ 	if(shp->infd>0 && (shp->fdstatus[shp->infd]&IOCLEX))
+ 		sh_close(shp->infd);
+ 	sh_setstate(sh_state(SH_FORKED));
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c	2012-05-02 03:16:25.241021529 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c	2012-05-02 03:17:53.571942019 -0700
[email protected]@ -115,6 +115,7 @@ void	sh_subtmpfile(Shell_t *shp)
+ 		if((sp->tmpfd = fd = fcntl(1,F_DUPFD,10)) >= 0)
+ 		{
+ 			fcntl(fd,F_SETFD,FD_CLOEXEC);
++			VALIDATE_FD(shp, fd);
+ 			shp->fdstatus[fd] = shp->fdstatus[1]|IOCLEX;
+ 			close(1);
+ 		}
[email protected]@ -141,6 +142,7 @@ void	sh_subtmpfile(Shell_t *shp)
+ 		}
+ 		else
+ 		{
++			VALIDATE_FD(shp, fd);
+ 			shp->fdstatus[fd] = IOREAD|IOWRITE;
+ 			sfsync(sfstdout);
+ 			if(fd==1)
[email protected]@ -627,6 +629,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
+ 					((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT;
+ 					errormsg(SH_DICT,ERROR_system(1),e_toomany);
+ 				}
++				VALIDATE_FD(shp, fd);
+ 				shp->sftable[fd] = iop;
+ 				fcntl(fd,F_SETFD,FD_CLOEXEC);
+ 				shp->fdstatus[fd] = (shp->fdstatus[1]|IOCLEX);
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c INIT.2011-02-08/src/cmd/ksh93/sh/xec.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c	2012-05-02 03:16:17.393286735 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/xec.c	2012-05-02 03:17:53.574535124 -0700
[email protected]@ -94,6 +94,8 @@ static void iousepipe(Shell_t *shp)
+ 	usepipe++;
+ 	fcntl(subpipe[0],F_SETFD,FD_CLOEXEC);
+ 	subpipe[2] = fcntl(1,F_DUPFD,10);
++	VALIDATE_FD(shp, subpipe[1]);
++	VALIDATE_FD(shp, subpipe[2]);
+ 	shp->fdstatus[subpipe[2]] = shp->fdstatus[1];
+ 	close(1);
+ 	fcntl(subpipe[1],F_DUPFD,1);
[email protected]@ -117,6 +119,7 @@ static void iounpipe(Shell_t *shp)
+ 	usepipe = 0;
+ 	close(1);
+ 	fcntl(subpipe[2], F_DUPFD, 1);
++	VALIDATE_FD(shp, subpipe[2]);
+ 	shp->fdstatus[1] = shp->fdstatus[subpipe[2]];
+ 	if(subdup) for(n=0; n < 10; n++)
+ 	{
[email protected]@ -844,6 +847,7 @@ static int sh_coexec(Shell_t *shp,const 
+ 			if(filt > 2)
+ 			{
+ 				shp->coutpipe = shp->inpipe[1];
++				VALIDATE_FD(shp, shp->coutpipe);
+ 				shp->fdptrs[shp->coutpipe] = &shp->coutpipe;
+ 			}
+ 		}
[email protected]@ -1487,6 +1491,7 @@ int sh_exec(register const Shnode_t *t, 
+ 						if(shp->cpipe[0]<0 || shp->cpipe[1] < 0)
+ 						{
+ 							sh_copipe(shp,shp->outpipe=shp->cpipe,0);
++							VALIDATE_FD(shp, shp->cpipe[0]);
+ 							shp->fdptrs[shp->cpipe[0]] = shp->cpipe;
+ 						}
+ 						sh_copipe(shp,shp->inpipe=pipes,0);
[email protected]@ -3419,6 +3424,8 @@ static void coproc_init(Shell_t *shp, in
+ 		if((outfd=shp->cpipe[1]) < 10) 
+ 		{
+ 		        int fd=fcntl(shp->cpipe[1],F_DUPFD,10);
++			VALIDATE_FD(shp, outfd);
++			VALIDATE_FD(shp, fd);
+ 			if(fd>=10)
+ 			{
+ 			        shp->fdstatus[fd] = (shp->fdstatus[outfd]&~IOCLEX);
[email protected]@ -3427,6 +3434,9 @@ static void coproc_init(Shell_t *shp, in
+ 				shp->cpipe[1] = fd;
+ 			}
+ 		}
++		VALIDATE_FD(shp, shp->cpipe[0]);
++		VALIDATE_FD(shp, shp->cpipe[1]);
++
+ 		if(fcntl(*shp->cpipe,F_SETFD,FD_CLOEXEC)>=0)
+ 			shp->fdstatus[shp->cpipe[0]] |= IOCLEX;
+ 		shp->fdptrs[shp->cpipe[0]] = shp->cpipe;
[email protected]@ -3437,7 +3447,9 @@ static void coproc_init(Shell_t *shp, in
+ 	shp->outpipe = shp->cpipe;
+ 	sh_pipe(shp->inpipe=pipes);
+ 	shp->coutpipe = shp->inpipe[1];
++	VALIDATE_FD(shp, shp->coutpipe);
+ 	shp->fdptrs[shp->coutpipe] = &shp->coutpipe;
++	VALIDATE_FD(shp, shp->outpipe[0]);
+ 	if(fcntl(shp->outpipe[0],F_SETFD,FD_CLOEXEC)>=0)
+ 		shp->fdstatus[shp->outpipe[0]] |= IOCLEX;
+ }
[email protected]@ -3608,6 +3620,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
+ 				int fd = shp->inpipe[1];
+ 				sh_iosave(shp,0,buff.topfd,(char*)0);
+ 				sh_iorenumber(shp,shp->inpipe[0],0);
++				VALIDATE_FD(shp, fd);
+ 				if(fd>=0 && (!(otype&FPOU) || (otype&FCOOP)) && fcntl(fd,F_SETFD,FD_CLOEXEC)>=0)
+ 					shp->fdstatus[fd] |= IOCLEX;
+ 			}
[email protected]@ -3619,6 +3632,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
+ #endif /* SHOPT_COSHELL */
+ 				sh_iosave(shp,1,buff.topfd,(char*)0);
+ 				sh_iorenumber(shp,sh_dup(shp->outpipe[1]),1);
++				VALIDATE_FD(shp, shp->outpipe[0]);
+ 				if(fcntl(shp->outpipe[0],F_SETFD,FD_CLOEXEC)>=0)
+ 					shp->fdstatus[shp->outpipe[0]] |= IOCLEX;
+ 			}
[email protected]@ -3658,6 +3672,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
+ 			signal(SIGQUIT,sh_fault);
+ 			signal(SIGINT,sh_fault);
+ 		}
++		VALIDATE_FD(shp, shp->inpipe[1]);
+ 		if((otype&FPIN) && (!(otype&FPOU) || (otype&FCOOP)) && fcntl(shp->inpipe[1],F_SETFD,FD_CLOEXEC)>=0)
+ 			shp->fdstatus[shp->inpipe[1]] &= ~IOCLEX;
+ 		if(t->fork.forkio || otype)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/105-CR7032068.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,33 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c	2012-05-02 03:34:48.830258020 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c	2012-05-02 03:42:51.584924888 -0700
[email protected]@ -1084,7 +1084,7 @@ static int varsub(Mac_t *mp)
+ {
+ 	register int	c;
+ 	register int	type=0; /* M_xxx */
+-	register char	*v,*argp=0;
++	register char	*v, *new_v = NULL, *argp=0;
+ 	register Namval_t	*np = NIL(Namval_t*);
+ 	register int 	dolg=0, mode=0;
+ 	Lex_t		*lp = (Lex_t*)mp->shp->lex_context;
[email protected]@ -1436,6 +1436,7 @@ retry1:
+ 				if( (mp->arith||mp->let) && (np->nvfun || nv_isattr(np,(NV_LJUST|NV_RJUST|NV_ZFILL))) && !nv_isattr(np,NV_INTEGER) && (offset==0 || !isalnum(c)))
+ 					mp->zeros = 1;
+ 			}
++			new_v = v = strdup(v);
+ 			if(savptr==stakptr(0))
+ 				stkseek(stkp,offset);
+ 			else
[email protected]@ -1963,8 +1964,12 @@ retry2:
+ 	}
+ 	if(np)
+ 		nv_close(np);
++ 	if (new_v)
++		free(new_v);
+ 	return(1);
+ nosub:
++	if (new_v)
++		free(new_v);
+ 	if(type==M_BRACE && sh_lexstates[ST_NORM][c]==S_BREAK)
+ 	{
+ 		fcseek(-1);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/110-CR7061011.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,12 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvdisc.c INIT.2011-02-08/src/cmd/ksh93/sh/nvdisc.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvdisc.c	2012-05-02 03:46:22.725281017 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/nvdisc.c	2012-05-02 03:54:19.300127633 -0700
[email protected]@ -593,7 +593,7 @@ static char *setdisc(register Namval_t* 
+ 		action = vp->bltins[type];
+ 		vp->bltins[type] = 0;
+ 	}
+-	return(action?(char*)action:"");
++	return((char*)action);
+ }
+ 
+ static void putdisc(Namval_t* np, const char* val, int flag, Namfun_t* fp)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/115-CR6934836.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,47 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/init.c INIT.2011-02-08/src/cmd/ksh93/sh/init.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/init.c	2012-05-07 14:21:24.948093271 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/init.c	2012-05-07 14:30:52.907885321 +0100
[email protected]@ -1352,6 +1352,7 @@ Shell_t *sh_init(register int argc,regis
+ 	job_clear();
+ 	if(argc>0)
+ 	{
++		int dolv_index = -1;
+ 		/* check for restricted shell */
+ 		if(type&SH_TYPE_RESTRICTED)
+ 			sh_onoption(SH_RESTRICTED);
[email protected]@ -1379,7 +1380,10 @@ Shell_t *sh_init(register int argc,regis
+ 			sh_done(shp,0);
+ 		}
+ 		opt_info.disc = 0;
+-		shp->st.dolv=argv+(argc-1)-shp->st.dolc;
++		dolv_index = (argc-1)-shp->st.dolc;
++		shp->st.dolv=argv+dolv_index;
++		shp->st.repl_index = dolv_index;
++		shp->st.repl_arg = argv[dolv_index];	
+ 		shp->st.dolv[0] = argv[0];
+ 		if(shp->st.dolc < 1)
+ 			sh_onoption(SH_SFLAG);
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c INIT.2011-02-08/src/cmd/ksh93/sh/main.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c	2012-05-07 14:43:03.840822719 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/main.c	2012-05-07 14:59:12.341447529 +0100
[email protected]@ -296,6 +296,8 @@ int sh_main(int ac, char *av[], Shinit_f
+ 					 * try to undo effect of solaris 2.5+
+ 					 * change for argv for setuid scripts
+ 					 */
++					if (shp->st.repl_index > 0)
++						av[shp->st.repl_index] = shp->st.repl_arg;
+ 					if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (!(name = nv_getval(L_ARGNOD)) || !((type = sh_type(cp = name)) & SH_TYPE_SH)))
+ 					{
+ 						av[0] = (type & SH_TYPE_LOGIN) ? cp : path_basename(cp);
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/include/defs.h INIT.2011-02-08/src/cmd/ksh93/include/defs.h
+--- INIT.2011-02-08.clean/src/cmd/ksh93/include/defs.h	2012-05-08 12:33:38.805834763 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/include/defs.h	2012-05-08 12:36:40.987228722 +0100
[email protected]@ -97,6 +97,8 @@ struct sh_scoped
+ 	char		**otrapcom;
+ 	void		*timetrap;
+ 	struct Ufunction *real_fun;	/* current 'function name' function */
++	int             repl_index;
++	char            *repl_arg;
+ };
+ 
+ struct limits
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/120-CR7089799.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,35 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c INIT.2011-02-08/src/cmd/ksh93/sh/io.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c	2012-05-07 14:33:37.179788579 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/io.c	2012-05-07 14:39:11.089877123 +0100
[email protected]@ -868,10 +868,10 @@ int sh_iomovefd(register int fdold)
+ {
+ 	Shell_t *shp = sh_getinterp();
+ 	register int fdnew;
++	VALIDATE_FD(shp, fdold);
+ 	if(fdold<0 || fdold>2)
+ 		return(fdold);
+ 	fdnew = sh_iomovefd(dup(fdold));
+-	VALIDATE_FD(shp, fdold);
+ 	VALIDATE_FD(shp, fdnew);
+ 	shp->fdstatus[fdnew] = (shp->fdstatus[fdold]&~IOCLEX);
+ 	close(fdold);
[email protected]@ -890,6 +890,8 @@ int	sh_pipe(register int pv[])
+ 		errormsg(SH_DICT,ERROR_system(1),e_pipe);
+ 	pv[0] = sh_iomovefd(pv[0]);
+ 	pv[1] = sh_iomovefd(pv[1]);
++	VALIDATE_FD(shp, pv[0]);
++	VALIDATE_FD(shp, pv[1]);
+ 	shp->fdstatus[pv[0]] = IONOSEEK|IOREAD;
+ 	shp->fdstatus[pv[1]] = IONOSEEK|IOWRITE;
+ 	sh_subsavefd(pv[0]);
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c INIT.2011-02-08/src/cmd/ksh93/sh/path.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c	2012-05-07 14:33:37.182443770 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/path.c	2012-05-07 14:40:06.256096054 +0100
[email protected]@ -565,6 +565,7 @@ static int	path_opentype(Shell_t *shp,co
+ 	if(fd>=0 && (fd = sh_iomovefd(fd)) > 0)
+ 	{
+ 		fcntl(fd,F_SETFD,FD_CLOEXEC);
++		VALIDATE_FD(shp, fd);
+ 		shp->fdstatus[fd] |= IOCLEX;
+ 	}
+ 	return(fd);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/125-CR6917338.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,14 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c INIT.2011-02-08/src/cmd/ksh93/sh/xec.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c	2012-05-07 15:03:41.210885978 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/sh/xec.c	2012-05-07 15:07:57.474149421 +0100
[email protected]@ -586,7 +586,10 @@ int sh_eval(register Sfio_t *iop, int mo
+ 	if(lineno)
+ 		shp->inlineno = lineno;
+ 	if(io_save)
++	{
+ 		sfclose(io_save);
++		io_save = 0;
++	}
+ 	sh_freeup(shp);
+ 	shp->st.staklist = saveslp;
+ 	shp->fn_reset = 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/130-CR7019368.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,48 @@
+diff -rupN INIT.2011-02-08/src/cmd/INIT/regress.sh INIT.2011-02-08.clean/src/cmd/INIT/regress.sh
+--- INIT.2011-02-08/src/cmd/INIT/regress.sh	2010-06-13 16:38:43.000000000 +0100
++++ INIT.2011-02-08.clean/src/cmd/INIT/regress.sh	2012-05-07 15:27:52.975530153 +0100
[email protected]@ -1351,7 +1351,7 @@ esac
+ export COLUMNS=80
+ SOURCE=$PWD
+ PATH=$SOURCE:${PATH#?(.):}
+-PATH=${PATH%%:?(.)}:/usr/5bin:/bin:/usr/bin
++PATH=${PATH%%:?(.)}:/bin:/usr/bin
+ UNIT=$1
+ shift
+ if	[[ -f $UNIT && ! -x $UNIT ]]
+diff -rupN INIT.2011-02-08/src/lib/libast/comp/mkdir.c INIT.2011-02-08.clean/src/lib/libast/comp/mkdir.c
+--- INIT.2011-02-08/src/lib/libast/comp/mkdir.c	2012-05-07 15:23:37.437905060 +0100
++++ INIT.2011-02-08.clean/src/lib/libast/comp/mkdir.c	2012-05-07 15:25:03.856907633 +0100
[email protected]@ -39,7 +39,7 @@ mkdir(const char* path, mode_t mode)
+ 	register int	n;
+ 	char*		av[3];
+ 
+-	static char*	cmd[] = { "/bin/mkdir", "/usr/5bin/mkdir", 0 };
++	static char*	cmd[] = { "/bin/mkdir", 0 };
+ 
+ 
+ 	n = errno;
+diff -rupN INIT.2011-02-08/src/lib/libast/comp/rmdir.c INIT.2011-02-08.clean/src/lib/libast/comp/rmdir.c
+--- INIT.2011-02-08/src/lib/libast/comp/rmdir.c	2012-05-07 15:23:37.439623862 +0100
++++ INIT.2011-02-08.clean/src/lib/libast/comp/rmdir.c	2012-05-07 15:25:25.119862860 +0100
[email protected]@ -39,7 +39,7 @@ rmdir(const char* path)
+ 	struct stat	st;
+ 	char*		av[3];
+ 
+-	static char*	cmd[] = { "/bin/rmdir", "/usr/5bin/rmdir", 0 };
++	static char*	cmd[] = { "/bin/rmdir", 0 };
+ 
+ 	if (stat(path, &st) < 0) return(-1);
+ 	if (!S_ISDIR(st.st_mode))
+diff -rupN INIT.2011-02-08/src/lib/libast/port/astconf.c INIT.2011-02-08.clean/src/lib/libast/port/astconf.c
+--- INIT.2011-02-08/src/lib/libast/port/astconf.c	2012-05-07 15:23:37.452538787 +0100
++++ INIT.2011-02-08.clean/src/lib/libast/port/astconf.c	2012-05-07 15:27:12.365726756 +0100
[email protected]@ -565,7 +565,7 @@ initialize(register Feature_t* fp, const
+ 						}
+ 						if (fp->op == OP_universe)
+ 						{
+-							if (strneq(p, "xpg", 3) || strneq(p, "5bin", 4))
++							if (strneq(p, "xpg", 3))
+ 							{
+ 								ok = 1;
+ 								break;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/135-CR6729252.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,15 @@
+diff -rupN INIT.2011-02-08.clean/src/lib/libast/port/mnt.c INIT.2011-02-08/src/lib/libast/port/mnt.c
+--- INIT.2011-02-08.clean/src/lib/libast/port/mnt.c	2012-05-07 15:33:03.490042977 +0100
++++ INIT.2011-02-08/src/lib/libast/port/mnt.c	2012-05-07 15:40:58.347078946 +0100
[email protected]@ -416,11 +416,6 @@ mntread(void* handle)
+ 			t = "sfs";
+ 			break;
+ #endif
+-#ifdef MNT_CACHEFS
+-		case MNT_CACHEFS:
+-			t = "cachefs";
+-			break;
+-#endif
+ #ifdef MNT_NFS3
+ 		case MNT_NFS3:
+ 			t = "nfs3";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/140-MAP_TYPE_64_Bits.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,12 @@
+diff -rupN INIT.2011-02-08.clean/src/lib/libast/sfio/sfmode.c INIT.2011-02-08/src/lib/libast/sfio/sfmode.c
+--- INIT.2011-02-08.clean/src/lib/libast/sfio/sfmode.c	2012-05-07 15:45:04.418751281 +0100
++++ INIT.2011-02-08/src/lib/libast/sfio/sfmode.c	2012-05-07 15:49:09.326244280 +0100
[email protected]@ -400,7 +400,7 @@ reg int		local;	/* a local call */
+ 
+ 	if(f->mode&SF_GETR)
+ 	{	f->mode &= ~SF_GETR;
+-#ifdef MAP_TYPE
++#if defined(MAP_TYPE) && (_ptr_bits < 64)
+ 		if((f->bits&SF_MMAP) && (f->tiny[0] += 1) >= (4*SF_NMAP) )
+ 		{	/* turn off mmap to avoid page faulting */
+ 			sfsetbuf(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/145-CR7167466.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,21 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/edit/edit.c INIT.2011-02-08/src/cmd/ksh93/edit/edit.c
+--- INIT.2011-02-08.clean/src/cmd/ksh93/edit/edit.c	2012-05-10 12:44:32.651317787 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/edit/edit.c	2012-05-10 12:49:00.804744460 +0100
[email protected]@ -1652,7 +1652,7 @@ int ed_histgen(Edit_t *ep,const char *pa
+ 	History_t	*hp;
+ 	off_t		offset;
+ 	int 		ac=0,l,m,n,index1,index2;
+-	char		*cp, **argv, **av, **ar;
++	char		*cp, **argv=NULL, **av, **ar;
+ 	if(!(hp=ep->sh->gd->hist_ptr))
+ 		return(0);
+ 	if(*pattern=='#')
[email protected]@ -1731,7 +1731,7 @@ int ed_histgen(Edit_t *ep,const char *pa
+ 		mplast->next = 0;
+ 	}
+ 	ep->hlist = (Histmatch_t**)argv;
+-	ep->hfirst = ep->hlist[0];
++	ep->hfirst = ep->hlist ? ep->hlist[0] : NULL;
+ 	return(ep->hmax=ac);
+ }
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/150-CR7168611.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,12 @@
+diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/Makefile INIT.2011-02-08/src/cmd/ksh93/Makefile
+--- INIT.2011-02-08.clean/src/cmd/ksh93/Makefile	2012-05-14 16:26:08.957879865 +0100
++++ INIT.2011-02-08/src/cmd/ksh93/Makefile	2012-05-14 16:30:00.712605686 +0100
[email protected]@ -39,7 +39,7 @@ SHOPT_MULTIBYTE == 1		/* multibyte chara
+ SHOPT_NAMESPACE == 1		/* allow namespaces */
+ SHOPT_OLDTERMIO ==		/* support both TCGETA and TCGETS */
+ SHOPT_OPTIMIZE == 1		/* optimize loop invariants */
+-SHOPT_PFSH == 1			/* solaris exec_attr(4) profile execution */
++SHOPT_PFSH == 0			/* solaris exec_attr(4) profile execution */
+ SHOPT_P_SUID == 1		/* real uid's that require -p for set[ug]id */
+ SHOPT_RAWONLY == 1		/* make viraw the only vi mode */
+ SHOPT_REGRESS ==		/* enable __regress__ builtin and instrumented intercepts for testing */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/155-CR7178717.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,54 @@
+*** INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c	Tue Jul 10 17:37:30 2012
+--- ./jobs.c	Tue Jul 10 18:59:39 2012
+***************
+*** 1969,1985 ****
+  	register struct back_save *bp = (struct back_save*)ptr;
+  	register struct process *pw, *px, *pwnext;
+  	struct jobsave *jpnext;
+  	job_lock();
+! 	for(jp=bck.list; jp; jp=jpnext)
+! 	{
+  		jpnext = jp->next;
+! 		if(jp->curenv != sh.curenv || jp->pid==sh.spid)
+! 		{
+! 			jp->next = bp->list;
+! 			bp->list = jp;
+! 			bp->count++;
+! 		}
+! 		else
+  			job_chksave(jp->pid);
+  	}
+  	for(pw=job.pwlist; pw; pw=pwnext)
+--- 1969,2000 ----
+  	register struct back_save *bp = (struct back_save*)ptr;
+  	register struct process *pw, *px, *pwnext;
+  	struct jobsave *jpnext;
++ 
+  	job_lock();
+! 	for(jp = bck.list; jp != NULL; jp = jpnext) {
+  		jpnext = jp->next;
+! 		if (jp->curenv != sh.curenv || jp->pid == sh.spid) {
+! 			struct jobsave *jp2, *jp2next;
+! 			/*
+! 			 * We may have same pid in both saved list and current
+! 			 * list. We discard the old jobsave by copying the new
+! 			 * one.
+! 			 */
+! 			for (jp2 = bp->list; jp2 != NULL; jp2 = jp2->next) {
+! 				if (jp->pid == jp2->pid)
+! 					break;
+! 			}
+! 			if (jp2 != NULL) {
+! 				jp2next = jp2->next;
+! 				*jp2 = *jp;
+! 				jp2->next = jp2next;
+! 				job_chksave(jp2->pid);
+! 			} else {
+! 				jp->next = bp->list;
+! 				bp->list = jp;
+! 				bp->count++;
+! 			}
+! 		} else
+  			job_chksave(jp->pid);
+  	}
+  	for(pw=job.pwlist; pw; pw=pwnext)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/160-CR7175995.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,20 @@
+diff -Naur INIT.2011-02-08.orig/src/cmd/ksh93/sh/init.c INIT.2011-02-08/src/cmd/ksh93/sh/init.c
+--- INIT.2011-02-08.orig/src/cmd/ksh93/sh/init.c	2012-06-25 01:05:32.997978071 -0700
++++ INIT.2011-02-08/src/cmd/ksh93/sh/init.c	2012-06-25 01:19:10.000000000 -0700
[email protected]@ -1181,7 +1181,7 @@
+ 	Shell_t	*shp;
+ 	register int n;
+ 	int type;
+-	static char *login_files[3];
++	static char *login_files[2];
+ 	memfatal();
+ 	n = strlen(e_version);
+ 	if(e_version[n-1]=='$' && e_version[n-2]==' ')
[email protected]@ -1468,7 +1468,6 @@
+         shp->topscope = (Shscope_t*)shp->st.self;
+ 	sh_offstate(SH_INIT);
+ 	login_files[0] = (char*)e_profile;
+-	login_files[1] = ".profile";
+ 	shp->gd->login_files = login_files;
+ 	shp->bltindata.version = SH_VERSION;
+ 	shp->bltindata.shp = shp;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/165-CR7186440_ksh93_disable_predictive_editing.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,12 @@
+--- a/src/cmd/ksh93/Makefile
++++ b/src/cmd/ksh93/Makefile
[email protected]@ -28,7 +28,7 @@ SHOPT_COSHELL == 1		/* build with connection to coshell */
+ SHOPT_CRNL ==			/* accept <cr><nl> for <nl> */
+ SHOPT_DYNAMIC == 1		/* dynamic loading for builtins */
+ SHOPT_ECHOPRINT ==		/* make echo equivalent to print */
+-SHOPT_EDPREDICT == 1		/* predictive editing  */
++SHOPT_EDPREDICT == 0		/* predictive editing  */
+ SHOPT_ESH == 1			/* emacs/gmacs edit mode */
+ SHOPT_FILESCAN == 1		/* fast file scan */
+ SHOPT_FIXEDARRAY == 1		/* fixed dimension indexed array */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/170-CR7128313.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,10 @@
+--- a/src/cmd/ksh93/sh/path.c
++++ b/src/cmd/ksh93/sh/path.c
[email protected]@ -1761,6 +1761,7 @@
+ 	char *ptr;
+ 	if(!pp)
+ 		return(NULL);
++	pp->shp->last_table = 0;
+ 	path_nextcomp(pp->shp,pp,nv_name(np),pp);
+ 	ptr = stakfreeze(0);
+ 	return(ptr+PATH_OFFSET);
--- a/components/ksh93/patches/17432413.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
---- a/src/cmd/ksh93/sh/init.c
-+++ b/src/cmd/ksh93/sh/init.c
[email protected]@ -720,7 +720,7 @@ static char* get_lastarg(Namval_t* np, Namfun_t *fp)
- 	char	*cp;
- 	int	pid;
-         if(sh_isstate(SH_INIT) && (cp=shp->lastarg) && *cp=='*' && (pid=strtol(cp+1,&cp,10)) && *cp=='*')
--		nv_putval(np,(pid==shp->gd->ppid?cp+1:0),0);
-+		nv_putval(np,cp+1,0);
- 	return(shp->lastarg);
- }
- 
---- a/src/cmd/ksh93/sh/main.c
-+++ b/src/cmd/ksh93/sh/main.c
[email protected]@ -298,7 +298,7 @@ int sh_main(int ac, char *av[], Shinit_f userinit)
- 					 */
- 					if (shp->st.repl_index > 0)
- 						av[shp->st.repl_index] = shp->st.repl_arg;
--					if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (!(name = nv_getval(L_ARGNOD)) || !((type = sh_type(cp = name)) & SH_TYPE_SH)))
-+					if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (name = nv_getval(L_ARGNOD)) && (!((type = sh_type(cp = name)) & SH_TYPE_SH)))
- 					{
- 						av[0] = (type & SH_TYPE_LOGIN) ? cp : path_basename(cp);
- 						/*  exec to change $0 for ps */
-
--- a/components/ksh93/patches/17435456.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-http://lists.research.att.com/pipermail/ast-developers/2014q1/003806.html
-
---- a/src/cmd/ksh93/sh/init.c
-+++ b/src/cmd/ksh93/sh/init.c
[email protected]@ -1933,6 +1933,11 @@ static void env_init(Shell_t *shp)
- 		*dp++ = 0;
- 		if(mp = dtmatch(shp->var_base,cp))
- 		{
-+                        if(strcmp(cp,VERSIONNOD->nvname)==0)
-+                        {
-+                                dp[-1] = '=';
-+                                continue;
-+                        }
- 			mp->nvenv = (char*)cp;
- 			dp[-1] = '=';
- 		}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/175-Bug15794787,15819673.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,39 @@
+--- a/src/cmd/ksh93/sh/xec.c	Thu Nov 29 22:06:17 2012
++++ b/src/cmd/ksh93/sh/xec.c	Fri Nov 30 00:45:30 2012
[email protected]@ -540,8 +540,10 @@
+ 	static Sfio_t *io_save;
+ 	volatile int traceon=0, lineno=0;
+ 	int binscript=shp->binscript;
++	char comsub = shp->comsub;
+ 	io_save = iop; /* preserve correct value across longjmp */
+ 	shp->binscript = 0;
++	shp->comsub = 0;
+ #define SH_TOPFUN	0x8000	/* this is a temporary tksh hack */
+ 	if (mode & SH_TOPFUN)
+ 	{
[email protected]@ -581,6 +583,7 @@
+ 	}
+ 	sh_popcontext(shp,&buff);
+ 	shp->binscript = binscript;
++	shp->comsub = comsub;
+ 	if(traceon)
+ 		sh_onoption(SH_XTRACE);
+ 	if(lineno)
[email protected]@ -3281,7 +3284,8 @@
+ 	struct funenv fun;
+ 	char *fname = nv_getval(SH_FUNNAMENOD);
+ 	struct Level	*lp =(struct Level*)(SH_LEVELNOD->nvfun);
+-	int		level, pipepid=shp->pipepid;
++	int		level, pipepid=shp->pipepid, comsub=shp->comsub;
++	shp->comsub = 0;
+ 	shp->pipepid = 0;
+ 	sh_stats(STAT_FUNCT);
+ 	if(!lp->hdr.disc)
[email protected]@ -3323,6 +3327,7 @@
+ 	lp->maxlevel = level;
+ 	SH_LEVELNOD->nvalue.s = lp->maxlevel;
+ 	shp->last_root = nv_dict(DOTSHNOD);
++	shp->comsub = comsub;
+ #if 0
+ 	nv_putval(SH_FUNNAMENOD,shp->st.funname,NV_NOFREE);
+ #else
--- a/components/ksh93/patches/17824699.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-http://lists.research.att.com/pipermail/ast-developers/2014q1/003807.html
----
-diff --git a/src/cmd/ksh93/edit/edit.c b/src/cmd/ksh93/edit/edit.c
-index 769ba2e..4f6330e 100644
---- a/src/cmd/ksh93/edit/edit.c
-+++ b/src/cmd/ksh93/edit/edit.c
[email protected]@ -651,7 +651,8 @@ void	ed_setup(register Edit_t *ep, int fd, int reedit)
- 			{
- 				int skip=0;
- 				ep->e_crlf = 0;
--				*pp++ = c;
-+				if (pp < ppmax)
-+					*pp++ = c;
- 				for(n=1; c = *last++; n++)
- 				{
- 					if(pp < ppmax)
-diff --git a/src/cmd/ksh93/include/edit.h b/src/cmd/ksh93/include/edit.h
-index 795777d..145066d 100644
---- a/src/cmd/ksh93/include/edit.h
-+++ b/src/cmd/ksh93/include/edit.h
[email protected]@ -59,7 +59,7 @@
- #endif /* SHOPT_MULTIBYTE */
- 
- #define TABSIZE	8
--#define PRSIZE	160
-+#define PRSIZE	256
- #define MAXLINE	1024		/* longest edit line permitted */
- 
- typedef struct _edit_pos
-
--- a/components/ksh93/patches/17851169.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-http://lists.research.att.com/pipermail/ast-developers/2014q1/003809.html
----
---- a/src/cmd/ksh93/sh/subshell.c
-+++ b/src/cmd/ksh93/sh/subshell.c
[email protected]@ -234,15 +234,22 @@ Namval_t *sh_assignok(register Namval_t *np,int add)
- {
- 	register Namval_t	*mp;
- 	register struct Link	*lp;
--	register struct subshell *sp = (struct subshell*)subshell_data;
--	Shell_t			*shp = sp->shp;
--	Dt_t			*dp= shp->var_tree;
-+	register struct subshell *sp;
-+	Shell_t			*shp;
-+	Dt_t			*dp;
- 	Namval_t		*mpnext;
- 	Namarr_t		*ap;
- 	int			save;
-+
-+        sp = (struct subshell*)subshell_data;
-+
- 	/* don't bother with this */
--	if(!sp->shpwd || np==SH_LEVELNOD || np==L_ARGNOD || np==SH_SUBSCRNOD || np==SH_NAMENOD)
-+	if(!sp || !sp->shpwd || np==SH_LEVELNOD || np==L_ARGNOD || np==SH_SUBSCRNOD || np==SH_NAMENOD)
- 		return(np);
-+
-+	shp = sp->shp;
-+	dp = shp->var_tree;
-+
- 	if((ap=nv_arrayptr(np)) && (mp=nv_opensub(np)))
- 	{
- 		shp->last_root = ap->table;
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/180-Bug15808407.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,15 @@
+--- a/src/cmd/ksh93/sh/init.c	2013-01-28 01:37:27.339300867 -0800
++++ b/src/cmd/ksh93/sh/init.c	2013-01-28 01:39:31.614342117 -0800
[email protected]@ -278,8 +278,11 @@
+ static void put_history(register Namval_t* np,const char *val,int flags,Namfun_t *fp)
+ {
+ 	Shell_t *shp = nv_shell(np);
+-	void 	*histopen = shp->gd->hist_ptr;
++	void 	*histopen = NULL;
+ 	char	*cp;
++	if( shp ) { 
++	    histopen = shp->gd->hist_ptr; 
++	}
+ 	if(val && histopen)
+ 	{
+ 		if(np==HISTFILE && (cp=nv_getval(np)) && strcmp(val,cp)==0) 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/185-Bug17714341.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,11 @@
+--- a/src/cmd/ksh93/bltins/cd_pwd.c	2013-10-31 16:18:43.904039613 +0100
++++ b/src/cmd/ksh93/bltins/cd_pwd.c	2013-10-31 16:18:14.980499662 +0100
[email protected]@ -81,7 +81,7 @@
+ 	dir =  argv[0];
+ 	if(error_info.errors>0 || argc >2)
+ 		errormsg(SH_DICT,ERROR_usage(2),"%s",optusage((char*)0));
+-	oldpwd = (char*)shp->pwd;
++	oldpwd = path_pwd(shp,0);
+ 	opwdnod = (shp->subshell?sh_assignok(OLDPWDNOD,1):OLDPWDNOD); 
+ 	pwdnod = (shp->subshell?sh_assignok(PWDNOD,1):PWDNOD); 
+ 	if(argc==2)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/190-17432413.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,23 @@
+--- a/src/cmd/ksh93/sh/init.c
++++ b/src/cmd/ksh93/sh/init.c
[email protected]@ -720,7 +720,7 @@ static char* get_lastarg(Namval_t* np, Namfun_t *fp)
+ 	char	*cp;
+ 	int	pid;
+         if(sh_isstate(SH_INIT) && (cp=shp->lastarg) && *cp=='*' && (pid=strtol(cp+1,&cp,10)) && *cp=='*')
+-		nv_putval(np,(pid==shp->gd->ppid?cp+1:0),0);
++		nv_putval(np,cp+1,0);
+ 	return(shp->lastarg);
+ }
+ 
+--- a/src/cmd/ksh93/sh/main.c
++++ b/src/cmd/ksh93/sh/main.c
[email protected]@ -298,7 +298,7 @@ int sh_main(int ac, char *av[], Shinit_f userinit)
+ 					 */
+ 					if (shp->st.repl_index > 0)
+ 						av[shp->st.repl_index] = shp->st.repl_arg;
+-					if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (!(name = nv_getval(L_ARGNOD)) || !((type = sh_type(cp = name)) & SH_TYPE_SH)))
++					if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (name = nv_getval(L_ARGNOD)) && (!((type = sh_type(cp = name)) & SH_TYPE_SH)))
+ 					{
+ 						av[0] = (type & SH_TYPE_LOGIN) ? cp : path_basename(cp);
+ 						/*  exec to change $0 for ps */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/195-17824699.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,30 @@
+http://lists.research.att.com/pipermail/ast-developers/2014q1/003807.html
+---
+diff --git a/src/cmd/ksh93/edit/edit.c b/src/cmd/ksh93/edit/edit.c
+index 769ba2e..4f6330e 100644
+--- a/src/cmd/ksh93/edit/edit.c
++++ b/src/cmd/ksh93/edit/edit.c
[email protected]@ -651,7 +651,8 @@ void	ed_setup(register Edit_t *ep, int fd, int reedit)
+ 			{
+ 				int skip=0;
+ 				ep->e_crlf = 0;
+-				*pp++ = c;
++				if (pp < ppmax)
++					*pp++ = c;
+ 				for(n=1; c = *last++; n++)
+ 				{
+ 					if(pp < ppmax)
+diff --git a/src/cmd/ksh93/include/edit.h b/src/cmd/ksh93/include/edit.h
+index 795777d..145066d 100644
+--- a/src/cmd/ksh93/include/edit.h
++++ b/src/cmd/ksh93/include/edit.h
[email protected]@ -59,7 +59,7 @@
+ #endif /* SHOPT_MULTIBYTE */
+ 
+ #define TABSIZE	8
+-#define PRSIZE	160
++#define PRSIZE	256
+ #define MAXLINE	1024		/* longest edit line permitted */
+ 
+ typedef struct _edit_pos
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/200-17435456.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,17 @@
+http://lists.research.att.com/pipermail/ast-developers/2014q1/003806.html
+
+--- a/src/cmd/ksh93/sh/init.c
++++ b/src/cmd/ksh93/sh/init.c
[email protected]@ -1933,6 +1933,11 @@ static void env_init(Shell_t *shp)
+ 		*dp++ = 0;
+ 		if(mp = dtmatch(shp->var_base,cp))
+ 		{
++                        if(strcmp(cp,VERSIONNOD->nvname)==0)
++                        {
++                                dp[-1] = '=';
++                                continue;
++                        }
+ 			mp->nvenv = (char*)cp;
+ 			dp[-1] = '=';
+ 		}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/205-17851169.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,32 @@
+http://lists.research.att.com/pipermail/ast-developers/2014q1/003809.html
+---
+--- a/src/cmd/ksh93/sh/subshell.c
++++ b/src/cmd/ksh93/sh/subshell.c
[email protected]@ -234,15 +234,22 @@ Namval_t *sh_assignok(register Namval_t *np,int add)
+ {
+ 	register Namval_t	*mp;
+ 	register struct Link	*lp;
+-	register struct subshell *sp = (struct subshell*)subshell_data;
+-	Shell_t			*shp = sp->shp;
+-	Dt_t			*dp= shp->var_tree;
++	register struct subshell *sp;
++	Shell_t			*shp;
++	Dt_t			*dp;
+ 	Namval_t		*mpnext;
+ 	Namarr_t		*ap;
+ 	int			save;
++
++        sp = (struct subshell*)subshell_data;
++
+ 	/* don't bother with this */
+-	if(!sp->shpwd || np==SH_LEVELNOD || np==L_ARGNOD || np==SH_SUBSCRNOD || np==SH_NAMENOD)
++	if(!sp || !sp->shpwd || np==SH_LEVELNOD || np==L_ARGNOD || np==SH_SUBSCRNOD || np==SH_NAMENOD)
+ 		return(np);
++
++	shp = sp->shp;
++	dp = shp->var_tree;
++
+ 	if((ap=nv_arrayptr(np)) && (mp=nv_opensub(np)))
+ 	{
+ 		shp->last_root = ap->table;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/210-Bug15993811.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,11 @@
+--- a/src/cmd/ksh93/sh/nvtype.c	Mon Jun 24 07:10:02 2013
++++ b/src/cmd/ksh93/sh/nvtype.c	Mon Jun 24 08:33:32 2013
[email protected]@ -925,8 +925,6 @@
+ 	}
+ 	offset = roundof(offset,sizeof(char*));
+ 	nv_setsize(mp,offset);
+-	if(nd)
+-		nd++;
+ 	k = roundof(sizeof(Namtype_t),sizeof(Sfdouble_t)) - sizeof(Namtype_t);
+ 	pp = newof(NiL, Namtype_t, 1, nnodes*NV_MINSZ + offset + size + (nnodes+nd)*sizeof(char*) + iref*sizeof(struct Namref)+k);
+ 	pp->fun.dsize = sizeof(Namtype_t)+nnodes*NV_MINSZ +offset+k;
--- a/components/ksh93/patches/Bug15794787,15819673.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
---- a/src/cmd/ksh93/sh/xec.c	Thu Nov 29 22:06:17 2012
-+++ b/src/cmd/ksh93/sh/xec.c	Fri Nov 30 00:45:30 2012
[email protected]@ -540,8 +540,10 @@
- 	static Sfio_t *io_save;
- 	volatile int traceon=0, lineno=0;
- 	int binscript=shp->binscript;
-+	char comsub = shp->comsub;
- 	io_save = iop; /* preserve correct value across longjmp */
- 	shp->binscript = 0;
-+	shp->comsub = 0;
- #define SH_TOPFUN	0x8000	/* this is a temporary tksh hack */
- 	if (mode & SH_TOPFUN)
- 	{
[email protected]@ -581,6 +583,7 @@
- 	}
- 	sh_popcontext(shp,&buff);
- 	shp->binscript = binscript;
-+	shp->comsub = comsub;
- 	if(traceon)
- 		sh_onoption(SH_XTRACE);
- 	if(lineno)
[email protected]@ -3281,7 +3284,8 @@
- 	struct funenv fun;
- 	char *fname = nv_getval(SH_FUNNAMENOD);
- 	struct Level	*lp =(struct Level*)(SH_LEVELNOD->nvfun);
--	int		level, pipepid=shp->pipepid;
-+	int		level, pipepid=shp->pipepid, comsub=shp->comsub;
-+	shp->comsub = 0;
- 	shp->pipepid = 0;
- 	sh_stats(STAT_FUNCT);
- 	if(!lp->hdr.disc)
[email protected]@ -3323,6 +3327,7 @@
- 	lp->maxlevel = level;
- 	SH_LEVELNOD->nvalue.s = lp->maxlevel;
- 	shp->last_root = nv_dict(DOTSHNOD);
-+	shp->comsub = comsub;
- #if 0
- 	nv_putval(SH_FUNNAMENOD,shp->st.funname,NV_NOFREE);
- #else
--- a/components/ksh93/patches/Bug15808407.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
---- a/src/cmd/ksh93/sh/init.c	2013-01-28 01:37:27.339300867 -0800
-+++ b/src/cmd/ksh93/sh/init.c	2013-01-28 01:39:31.614342117 -0800
[email protected]@ -278,8 +278,11 @@
- static void put_history(register Namval_t* np,const char *val,int flags,Namfun_t *fp)
- {
- 	Shell_t *shp = nv_shell(np);
--	void 	*histopen = shp->gd->hist_ptr;
-+	void 	*histopen = NULL;
- 	char	*cp;
-+	if( shp ) { 
-+	    histopen = shp->gd->hist_ptr; 
-+	}
- 	if(val && histopen)
- 	{
- 		if(np==HISTFILE && (cp=nv_getval(np)) && strcmp(val,cp)==0) 
--- a/components/ksh93/patches/Bug15993811.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- a/src/cmd/ksh93/sh/nvtype.c	Mon Jun 24 07:10:02 2013
-+++ b/src/cmd/ksh93/sh/nvtype.c	Mon Jun 24 08:33:32 2013
[email protected]@ -925,8 +925,6 @@
- 	}
- 	offset = roundof(offset,sizeof(char*));
- 	nv_setsize(mp,offset);
--	if(nd)
--		nd++;
- 	k = roundof(sizeof(Namtype_t),sizeof(Sfdouble_t)) - sizeof(Namtype_t);
- 	pp = newof(NiL, Namtype_t, 1, nnodes*NV_MINSZ + offset + size + (nnodes+nd)*sizeof(char*) + iref*sizeof(struct Namref)+k);
- 	pp->fun.dsize = sizeof(Namtype_t)+nnodes*NV_MINSZ +offset+k;
--- a/components/ksh93/patches/Bug17714341.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- a/src/cmd/ksh93/bltins/cd_pwd.c	2013-10-31 16:18:43.904039613 +0100
-+++ b/src/cmd/ksh93/bltins/cd_pwd.c	2013-10-31 16:18:14.980499662 +0100
[email protected]@ -81,7 +81,7 @@
- 	dir =  argv[0];
- 	if(error_info.errors>0 || argc >2)
- 		errormsg(SH_DICT,ERROR_usage(2),"%s",optusage((char*)0));
--	oldpwd = (char*)shp->pwd;
-+	oldpwd = path_pwd(shp,0);
- 	opwdnod = (shp->subshell?sh_assignok(OLDPWDNOD,1):OLDPWDNOD); 
- 	pwdnod = (shp->subshell?sh_assignok(PWDNOD,1):PWDNOD); 
- 	if(argc==2)
--- a/components/ksh93/patches/CR6729252.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/lib/libast/port/mnt.c INIT.2011-02-08/src/lib/libast/port/mnt.c
---- INIT.2011-02-08.clean/src/lib/libast/port/mnt.c	2012-05-07 15:33:03.490042977 +0100
-+++ INIT.2011-02-08/src/lib/libast/port/mnt.c	2012-05-07 15:40:58.347078946 +0100
[email protected]@ -416,11 +416,6 @@ mntread(void* handle)
- 			t = "sfs";
- 			break;
- #endif
--#ifdef MNT_CACHEFS
--		case MNT_CACHEFS:
--			t = "cachefs";
--			break;
--#endif
- #ifdef MNT_NFS3
- 		case MNT_NFS3:
- 			t = "nfs3";
--- a/components/ksh93/patches/CR6917338.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c INIT.2011-02-08/src/cmd/ksh93/sh/xec.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c	2012-05-07 15:03:41.210885978 +0100
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/xec.c	2012-05-07 15:07:57.474149421 +0100
[email protected]@ -586,7 +586,10 @@ int sh_eval(register Sfio_t *iop, int mo
- 	if(lineno)
- 		shp->inlineno = lineno;
- 	if(io_save)
-+	{
- 		sfclose(io_save);
-+		io_save = 0;
-+	}
- 	sh_freeup(shp);
- 	shp->st.staklist = saveslp;
- 	shp->fn_reset = 0;
--- a/components/ksh93/patches/CR6919590.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
---- a/src/cmd/ksh93/sh/args.c	Thu Sep  2 22:38:27 2010
-+++ b/src/cmd/ksh93/sh/args.c	Tue Sep 27 10:48:45 2011
[email protected]@ -26,6 +26,9 @@
-  * AT&T Labs
-  *
-  */
-+/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
- 
- #include	"defs.h"
- #include	"path.h"
[email protected]@ -302,6 +305,11 @@
- 		}
- 		else
- 		{
-+			if ((o == SH_RESTRICTED) &&
-+			    sh_isoption(SH_RESTRICTED)) {
-+				errormsg(SH_DICT, ERROR_exit(1),
-+				    e_restricted, "r");
-+			}
- 			if(o==SH_XTRACE)
- 				trace = 0;
- 			off_option(&newflags,o);
--- a/components/ksh93/patches/CR6934836.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/init.c INIT.2011-02-08/src/cmd/ksh93/sh/init.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/init.c	2012-05-07 14:21:24.948093271 +0100
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/init.c	2012-05-07 14:30:52.907885321 +0100
[email protected]@ -1352,6 +1352,7 @@ Shell_t *sh_init(register int argc,regis
- 	job_clear();
- 	if(argc>0)
- 	{
-+		int dolv_index = -1;
- 		/* check for restricted shell */
- 		if(type&SH_TYPE_RESTRICTED)
- 			sh_onoption(SH_RESTRICTED);
[email protected]@ -1379,7 +1380,10 @@ Shell_t *sh_init(register int argc,regis
- 			sh_done(shp,0);
- 		}
- 		opt_info.disc = 0;
--		shp->st.dolv=argv+(argc-1)-shp->st.dolc;
-+		dolv_index = (argc-1)-shp->st.dolc;
-+		shp->st.dolv=argv+dolv_index;
-+		shp->st.repl_index = dolv_index;
-+		shp->st.repl_arg = argv[dolv_index];	
- 		shp->st.dolv[0] = argv[0];
- 		if(shp->st.dolc < 1)
- 			sh_onoption(SH_SFLAG);
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c INIT.2011-02-08/src/cmd/ksh93/sh/main.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c	2012-05-07 14:43:03.840822719 +0100
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/main.c	2012-05-07 14:59:12.341447529 +0100
[email protected]@ -296,6 +296,8 @@ int sh_main(int ac, char *av[], Shinit_f
- 					 * try to undo effect of solaris 2.5+
- 					 * change for argv for setuid scripts
- 					 */
-+					if (shp->st.repl_index > 0)
-+						av[shp->st.repl_index] = shp->st.repl_arg;
- 					if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (!(name = nv_getval(L_ARGNOD)) || !((type = sh_type(cp = name)) & SH_TYPE_SH)))
- 					{
- 						av[0] = (type & SH_TYPE_LOGIN) ? cp : path_basename(cp);
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/include/defs.h INIT.2011-02-08/src/cmd/ksh93/include/defs.h
---- INIT.2011-02-08.clean/src/cmd/ksh93/include/defs.h	2012-05-08 12:33:38.805834763 +0100
-+++ INIT.2011-02-08/src/cmd/ksh93/include/defs.h	2012-05-08 12:36:40.987228722 +0100
[email protected]@ -97,6 +97,8 @@ struct sh_scoped
- 	char		**otrapcom;
- 	void		*timetrap;
- 	struct Ufunction *real_fun;	/* current 'function name' function */
-+	int             repl_index;
-+	char            *repl_arg;
- };
- 
- struct limits
--- a/components/ksh93/patches/CR6964621.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,551 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/include/io.h INIT.2011-02-08/src/cmd/ksh93/include/io.h
---- INIT.2011-02-08.clean/src/cmd/ksh93/include/io.h	2012-05-02 03:16:17.383778774 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/include/io.h	2012-05-02 03:17:53.562408338 -0700
[email protected]@ -23,6 +23,9 @@
-  *	David Korn
-  *
-  */
-+/*
-+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
-+ */
- 
- #include	<ast.h>
- #include	<sfio.h>
[email protected]@ -84,6 +87,12 @@ extern int	sh_devtofd(const char*);
- extern int	sh_isdevfd(const char*);
- extern int	sh_source(Shell_t*, Sfio_t*, const char*);
- 
-+extern int	VALIDATE_FD(Shell_t *, int);
-+
-+#define	VALIDATE_FD(shp, fd) \
-+	(((fd) >= (shp)->gd->lim.open_max) ? sh_iovalidfd(shp, fd) : 1)
-+
-+
- /* the following are readonly */
- extern const char	e_pexists[];
- extern const char	e_query[];
[email protected]@ -123,4 +132,5 @@ extern const char	e_bash_profile[];
- extern const char	e_stdprompt[];
- extern const char	e_supprompt[];
- extern const char	e_ambiguous[];
-+
- #endif /* KSHELL */
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c INIT.2011-02-08/src/cmd/ksh93/sh/io.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c	2012-05-02 03:16:17.389917698 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/io.c	2012-05-02 03:19:12.669621809 -0700
[email protected]@ -596,8 +596,10 @@ static void io_preserve(Shell_t* shp, re
- 		((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT;
- 		errormsg(SH_DICT,ERROR_system(1),e_toomany);
- 	}
--	if(f2 >= shp->gd->lim.open_max)
--		sh_iovalidfd(shp,f2);
-+
-+	VALIDATE_FD(shp, fd);
-+	VALIDATE_FD(shp, f2);
-+
- 	if(shp->fdptrs[fd]=shp->fdptrs[f2])
- 	{
- 		if(f2==job.fd)
[email protected]@ -623,7 +625,12 @@ static void io_preserve(Shell_t* shp, re
-  */
- int sh_iorenumber(Shell_t *shp, register int f1,register int f2)
- {
--	register Sfio_t *sp = shp->sftable[f2];
-+	register Sfio_t *sp;
-+
-+	VALIDATE_FD(shp, f1);
-+	VALIDATE_FD(shp, f2);
-+
-+	sp = shp->sftable[f2];
- 	if(f1!=f2)
- 	{
- 		/* see whether file descriptor is in use */
[email protected]@ -663,8 +670,7 @@ int sh_iorenumber(Shell_t *shp, register
- 		if(f2<=2)
- 			sfset(sp,SF_SHARE|SF_PUBLIC,1);
- 	}
--	if(f2>=shp->gd->lim.open_max)
--		sh_iovalidfd(shp,f2);
-+	VALIDATE_FD(shp, f2);
- 	return(f2);
- }
- 
[email protected]@ -678,8 +684,9 @@ int sh_close(register int fd)
- 	register int r = 0;
- 	if(fd<0)
- 		return(-1);
--	if(fd >= shp->gd->lim.open_max)
--		sh_iovalidfd(shp,fd);
-+
-+	VALIDATE_FD(shp, fd);
-+
- 	if(!(sp=shp->sftable[fd]) || sfclose(sp) < 0)
- 	{
- 		if(fdnotify)
[email protected]@ -835,6 +842,9 @@ int sh_open(register const char *path, i
- 		mode = (IOREAD|IOWRITE);
- 	else
- 		mode = IOREAD;
-+
-+	VALIDATE_FD(shp, fd);
-+
- 	shp->fdstatus[fd] = mode;
- 	return(fd);
- }
[email protected]@ -861,6 +871,8 @@ int sh_iomovefd(register int fdold)
- 	if(fdold<0 || fdold>2)
- 		return(fdold);
- 	fdnew = sh_iomovefd(dup(fdold));
-+	VALIDATE_FD(shp, fdold);
-+	VALIDATE_FD(shp, fdnew);
- 	shp->fdstatus[fdnew] = (shp->fdstatus[fdold]&~IOCLEX);
- 	close(fdold);
- 	shp->fdstatus[fdold] = IOCLOSE;
[email protected]@ -897,6 +909,9 @@ int	sh_pipe(register int pv[])
- 		sh_close(fd);
- 	else
- 		pv[out] = sh_iomovefd(fd);
-+
-+	VALIDATE_FD(shp, pv[out]);
-+
- 	if(fcntl(pv[out],F_SETFD,FD_CLOEXEC) >=0)
- 		shp->fdstatus[pv[out]] |= IOCLEX;
- 	shp->fdstatus[pv[out]] = (out?IOWRITE:IOREAD);
[email protected]@ -929,6 +944,9 @@ int	sh_pipe(register int pv[])
- 		errormsg(SH_DICT,ERROR_system(1),e_pipe);
- 	}
- 	fcntl(pv[out],F_SETFD,FD_CLOEXEC);
-+
-+	VALIDATE_FD(shp, pv[out]);
-+
- 	shp->fdstatus[pv[out]] |= IOCLEX;
- 	pv[1-out] = -1;
- 	pv[2] = port;
[email protected]@ -958,9 +976,13 @@ static int pat_line(const regex_t* rp, c
- static int io_patseek(Shell_t *shp, regex_t *rp, Sfio_t* sp, int flags)
- {
- 	char	*cp, *match;
--	int	r, fd=sffileno(sp), close_exec = shp->fdstatus[fd]&IOCLEX;
-+	int	r, fd, close_exec;
- 	int	was_share,s=(PIPE_BUF>SF_BUFSIZE?SF_BUFSIZE:PIPE_BUF);
- 	size_t	n,m;
-+
-+	fd = sffileno(sp);
-+	VALIDATE_FD(shp, fd);
-+	close_exec = shp->fdstatus[fd]&IOCLEX;
- 	shp->fdstatus[sffileno(sp)] |= IOCLEX;
- 	if(fd==0)
- 		was_share = sfset(sp,SF_SHARE,1);
[email protected]@ -994,12 +1016,17 @@ static int io_patseek(Shell_t *shp, rege
- 
- static Sfoff_t	file_offset(Shell_t *shp, int fn, char *fname)
- {
--	Sfio_t		*sp = shp->sftable[fn];
-+	Sfio_t		*sp;
- 	char		*cp;
- 	Sfoff_t		off;
- 	struct Eof	endf;
- 	Namval_t	*mp = nv_open("EOF",shp->var_tree,0);
- 	Namval_t	*pp = nv_open("CUR",shp->var_tree,0);
-+
-+	VALIDATE_FD(shp, fn);
-+
-+	sp = shp->sftable[fn];
-+
- 	memset(&endf,0,sizeof(struct Eof));
- 	endf.fd = fn;
- 	endf.hdr.disc = &EOF_disc;
[email protected]@ -1169,7 +1196,7 @@ int	sh_redirect(Shell_t *shp,struct iono
- 			if((iof&IOLSEEK) || ((iof&IOMOV) && *fname=='-'))
- 				fn = nv_getnum(np);
- 		}
--		if(fn>=shp->gd->lim.open_max && !sh_iovalidfd(shp,fn))
-+		if (!VALIDATE_FD(shp, fn))
- 			errormsg(SH_DICT,ERROR_system(1),e_file+4);
- 		if(iof&IOLSEEK)
- 		{
[email protected]@ -1212,6 +1239,7 @@ int	sh_redirect(Shell_t *shp,struct iono
- 						message = e_file;
- 						goto fail;
- 					}
-+					VALIDATE_FD(shp, dupfd);
- 					if(shp->subshell && dupfd==1)
- 					{
- 						if(sfset(sfstdout,0,0)&SF_STRING)
[email protected]@ -1248,8 +1276,7 @@ int	sh_redirect(Shell_t *shp,struct iono
- 					goto traceit;
- 				if((fd=sh_fcntl(dupfd,F_DUPFD,3))<0)
- 					goto fail;
--				if(fd>= shp->gd->lim.open_max)
--					sh_iovalidfd(shp,fd);
-+				VALIDATE_FD(shp, fd);
- 				sh_iocheckfd(shp,dupfd);
- 				shp->fdstatus[fd] = (shp->fdstatus[dupfd]&~IOCLEX);
- 				if(toclose<0 && shp->fdstatus[fd]&IOREAD)
[email protected]@ -1362,7 +1389,11 @@ int	sh_redirect(Shell_t *shp,struct iono
- 			}
- 			if(iof&IOLSEEK)
- 			{
--				Sfio_t *sp = shp->sftable[fn];
-+				Sfio_t *sp;
-+
-+				VALIDATE_FD(shp, fn);
-+
-+				sp = shp->sftable[fn];
- 				r = shp->fdstatus[fn];
- 				if(!(r&(IOSEEK|IONOSEEK)))
- 					r = sh_iocheckfd(shp,fn);
[email protected]@ -1443,6 +1474,7 @@ int	sh_redirect(Shell_t *shp,struct iono
- 			}
- 			if(fd<0)
- 			{
-+				VALIDATE_FD(shp, fn);
- 				if(sh_inuse(shp,fn) || (fn && fn==shp->infd))
- 				{
- 					if(fn>9 || !(shp->inuse_bits&(1<<fn)))
[email protected]@ -1462,7 +1494,7 @@ int	sh_redirect(Shell_t *shp,struct iono
- 					{
- 						if((fn=fcntl(fd,F_DUPFD,10)) < 0)
- 							goto fail;
--						if(fn>=shp->gd->lim.open_max && !sh_iovalidfd(shp,fn))
-+						if (!VALIDATE_FD(shp, fn))
- 							goto fail;
- 						shp->fdstatus[fn] = shp->fdstatus[fd];
- 						sh_close(fd);
[email protected]@ -1622,7 +1654,12 @@ void sh_iosave(Shell_t *shp, register in
- 	filemap[shp->topfd++].save_fd = savefd;
- 	if(savefd >=0)
- 	{
--		register Sfio_t* sp = shp->sftable[origfd];
-+		register Sfio_t* sp;
-+
-+		VALIDATE_FD(shp, origfd);
-+		VALIDATE_FD(shp, savefd);
-+
-+		sp = shp->sftable[origfd];
- 		/* make saved file close-on-exec */
- 		sh_fcntl(savefd,F_SETFD,FD_CLOEXEC);
- 		if(origfd==job.fd)
[email protected]@ -1655,6 +1692,7 @@ void	sh_iounsave(Shell_t* shp)
- 			filemap[newfd++] = filemap[fd];
- 		else
- 		{
-+			VALIDATE_FD(shp, savefd);
- 			shp->sftable[savefd] = 0;
- 			sh_close(savefd);
- 		}
[email protected]@ -1678,16 +1716,19 @@ void	sh_iorestore(Shell_t *shp, int last
- 		{
- 			if ((savefd = filemap[fd].save_fd) >= 0)
- 			{
-+				VALIDATE_FD(shp, savefd);
- 				shp->sftable[savefd] = 0;
- 				sh_close(savefd);
- 			}
- 			continue;
- 		}
- 		origfd = filemap[fd].orig_fd;
-+		VALIDATE_FD(shp, origfd);
- 		if(origfd<0)
- 		{
- 			/* this should never happen */
- 			savefd = filemap[fd].save_fd;
-+			VALIDATE_FD(shp, savefd);
- 			shp->sftable[savefd] = 0;
- 			sh_close(savefd);
- 			return;
[email protected]@ -1699,6 +1740,7 @@ void	sh_iorestore(Shell_t *shp, int last
- 		sh_close(origfd);
- 		if ((savefd = filemap[fd].save_fd) >= 0)
- 		{
-+			VALIDATE_FD(shp, savefd);
- 			sh_fcntl(savefd, F_DUPFD, origfd);
- 			if(savefd==job.fd)
- 				job.fd=origfd;
[email protected]@ -1954,6 +1996,9 @@ static ssize_t slowread(Sfio_t *iop,void
- int sh_iocheckfd(Shell_t *shp, register int fd)
- {
- 	register int flags, n;
-+
-+	VALIDATE_FD(shp, fd);
-+
- 	if((n=shp->fdstatus[fd])&IOCLOSE)
- 		return(n);
- 	if(!(n&(IOREAD|IOWRITE)))
[email protected]@ -2145,7 +2190,7 @@ static void	sftrack(Sfio_t* sp, int flag
- 		return;
- 	}
- #endif
--	if(fd<0 || (fd>=shp->gd->lim.open_max && !sh_iovalidfd(shp,fd)))
-+	if (fd < 0 || !VALIDATE_FD(shp, fd))
- 		return;
- 	if(sh_isstate(SH_NOTRACK))
- 		return;
[email protected]@ -2413,6 +2458,8 @@ ssize_t sh_read(register int fd, void* b
- {
- 	Shell_t *shp = sh_getinterp();
- 	register Sfio_t *sp;
-+
-+	VALIDATE_FD(shp, fd);
- 	if(sp=shp->sftable[fd])
- 		return(sfread(sp,buff,n));
- 	else
[email protected]@ -2427,6 +2474,8 @@ ssize_t sh_write(register int fd, const 
- {
- 	Shell_t *shp = sh_getinterp();
- 	register Sfio_t *sp;
-+
-+	VALIDATE_FD(shp, fd);
- 	if(sp=shp->sftable[fd])
- 		return(sfwrite(sp,buff,n));
- 	else
[email protected]@ -2441,6 +2490,8 @@ off_t sh_seek(register int fd, off_t off
- {
- 	Shell_t *shp = sh_getinterp();
- 	register Sfio_t *sp;
-+
-+	VALIDATE_FD(shp, fd);
- 	if((sp=shp->sftable[fd]) && (sfset(sp,0,0)&(SF_READ|SF_WRITE)))
- 		return(sfseek(sp,offset,whence));
- 	else
[email protected]@ -2452,6 +2503,9 @@ int sh_dup(register int old)
- {
- 	Shell_t *shp = sh_getinterp();
- 	register int fd = dup(old);
-+
-+	VALIDATE_FD(shp, old);
-+	VALIDATE_FD(shp, fd);
- 	if(fd>=0)
- 	{
- 		if(shp->fdstatus[old] == IOCLOSE)
[email protected]@ -2473,13 +2527,15 @@ int sh_fcntl(register int fd, int op, ..
- 	arg =  va_arg(ap, int) ;
- 	va_end(ap);
- 	newfd = fcntl(fd,op,arg);
-+
-+	VALIDATE_FD(shp, fd);
-+	VALIDATE_FD(shp, newfd);
-+
- 	if(newfd>=0) switch(op)
- 	{
- 	    case F_DUPFD:
- 		if(shp->fdstatus[fd] == IOCLOSE)
- 			shp->fdstatus[fd] = 0;
--		if(newfd>=shp->gd->lim.open_max)
--			sh_iovalidfd(shp,newfd);
- 		shp->fdstatus[newfd] = (shp->fdstatus[fd]&~IOCLEX);
- 		if(fdnotify)
- 			(*fdnotify)(fd,newfd);
[email protected]@ -2548,6 +2604,7 @@ Sfio_t *sh_iogetiop(int fd, int mode)
- 		return(iop);
- 	if(mode==SF_READ && !(n&IOREAD))
- 		return(iop);
-+	VALIDATE_FD(shp, fd);
- 	if(!(iop = shp->sftable[fd]))
- 		iop=sh_iostream(shp,fd);
- 	return(iop);
[email protected]@ -2567,7 +2624,10 @@ Sfio_t	*sh_fd2sfio(int fd)
- {
- 	Shell_t	*shp = sh_getinterp();
- 	register int status;
--	Sfio_t *sp = shp->sftable[fd];
-+	Sfio_t *sp;
-+
-+	VALIDATE_FD(shp, fd);
-+	sp = shp->sftable[fd];
- 	if(!sp  && (status = sh_iocheckfd(shp,fd))!=IOCLOSE)
- 	{
- 		register int flags=0;
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/lex.c INIT.2011-02-08/src/cmd/ksh93/sh/lex.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/lex.c	2012-05-02 03:16:17.388010187 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/lex.c	2012-05-02 03:17:53.567785551 -0700
[email protected]@ -25,6 +25,9 @@
-  * AT&T Labs
-  *
-  */
-+/*
-+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
-+ */
- 
- #include	<ast.h>
- #include	<stak.h>
[email protected]@ -2053,6 +2056,7 @@ void	sh_syntax(Lex_t *lp)
- 	else
- 		lp->lastline = shp->inlineno;
- 	tokstr = fmttoken(lp,tok,tokbuf);
-+	VALIDATE_FD(shp, shp->infd);
- 	if((sp=fcfile()) || (shp->infd>=0 && (sp=shp->sftable[shp->infd])))
- 	{
- 		/* clear out any pending input */
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c	2012-05-02 03:16:26.100861446 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c	2012-05-02 03:17:53.569195199 -0700
[email protected]@ -2086,6 +2086,7 @@ static void comsubst(Mac_t *mp,register 
- 			sh_popcontext(mp->shp,&buff);
- 			if(r==0 && ip && (ip->iofile&IOLSEEK))
- 			{
-+				VALIDATE_FD(mp->shp, fd);
- 				if(sp=mp->shp->sftable[fd])
- 					num = sftell(sp);
- 				else
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c INIT.2011-02-08/src/cmd/ksh93/sh/main.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/main.c	2012-05-02 03:16:17.389138504 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/main.c	2012-05-02 03:17:53.570027033 -0700
[email protected]@ -26,6 +26,9 @@
-  * AT&T Labs
-  *
-  */
-+/*
-+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
-+ */
- 
- #include	<ast.h>
- #include	<sfio.h>
[email protected]@ -396,8 +399,10 @@ static void	exfile(register Shell_t *shp
- 		if(fno > 0)
- 		{
- 			int r;
-+			VALIDATE_FD(shp, fno);
- 			if(fno < 10 && ((r=sh_fcntl(fno,F_DUPFD,10))>=10))
- 			{
-+				VALIDATE_FD(shp, r);
- 				shp->fdstatus[r] = shp->fdstatus[fno];
- 				sh_close(fno);
- 				fno = r;
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c INIT.2011-02-08/src/cmd/ksh93/sh/path.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c	2012-05-02 03:16:20.752378905 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/path.c	2012-05-02 03:17:53.571078341 -0700
[email protected]@ -23,6 +23,9 @@
-  * AT&T Labs
-  *
-  */
-+/*
-+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
-+ */
- 
- #include	"defs.h"
- #include	<fcin.h>
[email protected]@ -1239,6 +1242,7 @@ static void exscript(Shell_t *shp,regist
- 	if(sp=fcfile())
- 		while(sfstack(sp,SF_POPSTACK));
- 	job_clear();
-+	VALIDATE_FD(shp, shp->infd);
- 	if(shp->infd>0 && (shp->fdstatus[shp->infd]&IOCLEX))
- 		sh_close(shp->infd);
- 	sh_setstate(sh_state(SH_FORKED));
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c	2012-05-02 03:16:25.241021529 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c	2012-05-02 03:17:53.571942019 -0700
[email protected]@ -115,6 +115,7 @@ void	sh_subtmpfile(Shell_t *shp)
- 		if((sp->tmpfd = fd = fcntl(1,F_DUPFD,10)) >= 0)
- 		{
- 			fcntl(fd,F_SETFD,FD_CLOEXEC);
-+			VALIDATE_FD(shp, fd);
- 			shp->fdstatus[fd] = shp->fdstatus[1]|IOCLEX;
- 			close(1);
- 		}
[email protected]@ -141,6 +142,7 @@ void	sh_subtmpfile(Shell_t *shp)
- 		}
- 		else
- 		{
-+			VALIDATE_FD(shp, fd);
- 			shp->fdstatus[fd] = IOREAD|IOWRITE;
- 			sfsync(sfstdout);
- 			if(fd==1)
[email protected]@ -627,6 +629,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
- 					((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT;
- 					errormsg(SH_DICT,ERROR_system(1),e_toomany);
- 				}
-+				VALIDATE_FD(shp, fd);
- 				shp->sftable[fd] = iop;
- 				fcntl(fd,F_SETFD,FD_CLOEXEC);
- 				shp->fdstatus[fd] = (shp->fdstatus[1]|IOCLEX);
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c INIT.2011-02-08/src/cmd/ksh93/sh/xec.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/xec.c	2012-05-02 03:16:17.393286735 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/xec.c	2012-05-02 03:17:53.574535124 -0700
[email protected]@ -94,6 +94,8 @@ static void iousepipe(Shell_t *shp)
- 	usepipe++;
- 	fcntl(subpipe[0],F_SETFD,FD_CLOEXEC);
- 	subpipe[2] = fcntl(1,F_DUPFD,10);
-+	VALIDATE_FD(shp, subpipe[1]);
-+	VALIDATE_FD(shp, subpipe[2]);
- 	shp->fdstatus[subpipe[2]] = shp->fdstatus[1];
- 	close(1);
- 	fcntl(subpipe[1],F_DUPFD,1);
[email protected]@ -117,6 +119,7 @@ static void iounpipe(Shell_t *shp)
- 	usepipe = 0;
- 	close(1);
- 	fcntl(subpipe[2], F_DUPFD, 1);
-+	VALIDATE_FD(shp, subpipe[2]);
- 	shp->fdstatus[1] = shp->fdstatus[subpipe[2]];
- 	if(subdup) for(n=0; n < 10; n++)
- 	{
[email protected]@ -844,6 +847,7 @@ static int sh_coexec(Shell_t *shp,const 
- 			if(filt > 2)
- 			{
- 				shp->coutpipe = shp->inpipe[1];
-+				VALIDATE_FD(shp, shp->coutpipe);
- 				shp->fdptrs[shp->coutpipe] = &shp->coutpipe;
- 			}
- 		}
[email protected]@ -1487,6 +1491,7 @@ int sh_exec(register const Shnode_t *t, 
- 						if(shp->cpipe[0]<0 || shp->cpipe[1] < 0)
- 						{
- 							sh_copipe(shp,shp->outpipe=shp->cpipe,0);
-+							VALIDATE_FD(shp, shp->cpipe[0]);
- 							shp->fdptrs[shp->cpipe[0]] = shp->cpipe;
- 						}
- 						sh_copipe(shp,shp->inpipe=pipes,0);
[email protected]@ -3419,6 +3424,8 @@ static void coproc_init(Shell_t *shp, in
- 		if((outfd=shp->cpipe[1]) < 10) 
- 		{
- 		        int fd=fcntl(shp->cpipe[1],F_DUPFD,10);
-+			VALIDATE_FD(shp, outfd);
-+			VALIDATE_FD(shp, fd);
- 			if(fd>=10)
- 			{
- 			        shp->fdstatus[fd] = (shp->fdstatus[outfd]&~IOCLEX);
[email protected]@ -3427,6 +3434,9 @@ static void coproc_init(Shell_t *shp, in
- 				shp->cpipe[1] = fd;
- 			}
- 		}
-+		VALIDATE_FD(shp, shp->cpipe[0]);
-+		VALIDATE_FD(shp, shp->cpipe[1]);
-+
- 		if(fcntl(*shp->cpipe,F_SETFD,FD_CLOEXEC)>=0)
- 			shp->fdstatus[shp->cpipe[0]] |= IOCLEX;
- 		shp->fdptrs[shp->cpipe[0]] = shp->cpipe;
[email protected]@ -3437,7 +3447,9 @@ static void coproc_init(Shell_t *shp, in
- 	shp->outpipe = shp->cpipe;
- 	sh_pipe(shp->inpipe=pipes);
- 	shp->coutpipe = shp->inpipe[1];
-+	VALIDATE_FD(shp, shp->coutpipe);
- 	shp->fdptrs[shp->coutpipe] = &shp->coutpipe;
-+	VALIDATE_FD(shp, shp->outpipe[0]);
- 	if(fcntl(shp->outpipe[0],F_SETFD,FD_CLOEXEC)>=0)
- 		shp->fdstatus[shp->outpipe[0]] |= IOCLEX;
- }
[email protected]@ -3608,6 +3620,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
- 				int fd = shp->inpipe[1];
- 				sh_iosave(shp,0,buff.topfd,(char*)0);
- 				sh_iorenumber(shp,shp->inpipe[0],0);
-+				VALIDATE_FD(shp, fd);
- 				if(fd>=0 && (!(otype&FPOU) || (otype&FCOOP)) && fcntl(fd,F_SETFD,FD_CLOEXEC)>=0)
- 					shp->fdstatus[fd] |= IOCLEX;
- 			}
[email protected]@ -3619,6 +3632,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
- #endif /* SHOPT_COSHELL */
- 				sh_iosave(shp,1,buff.topfd,(char*)0);
- 				sh_iorenumber(shp,sh_dup(shp->outpipe[1]),1);
-+				VALIDATE_FD(shp, shp->outpipe[0]);
- 				if(fcntl(shp->outpipe[0],F_SETFD,FD_CLOEXEC)>=0)
- 					shp->fdstatus[shp->outpipe[0]] |= IOCLEX;
- 			}
[email protected]@ -3658,6 +3672,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
- 			signal(SIGQUIT,sh_fault);
- 			signal(SIGINT,sh_fault);
- 		}
-+		VALIDATE_FD(shp, shp->inpipe[1]);
- 		if((otype&FPIN) && (!(otype&FPOU) || (otype&FCOOP)) && fcntl(shp->inpipe[1],F_SETFD,FD_CLOEXEC)>=0)
- 			shp->fdstatus[shp->inpipe[1]] &= ~IOCLEX;
- 		if(t->fork.forkio || otype)
--- a/components/ksh93/patches/CR7009897.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c	2012-05-02 01:59:48.571110152 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c	2012-05-02 02:05:56.082206972 -0700
[email protected]@ -1262,7 +1262,7 @@ retry1:
- 				stkseek(stkp,stktell(stkp)-2);
- 				nv_local = 1;
- 			}
--			else
-+			else if (type != M_VNAME)
- 			{
- 				stkseek(stkp,stktell(stkp)-1);
- 				type = M_TREE;
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvtree.c INIT.2011-02-08/src/cmd/ksh93/sh/nvtree.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvtree.c	2012-05-02 01:59:52.497548227 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/nvtree.c	2012-05-02 02:07:16.084944399 -0700
[email protected]@ -1069,7 +1069,7 @@ Namfun_t *nv_isvtree(Namval_t *np)
-  */
- char *nv_getvtree(register Namval_t *np, Namfun_t *fp)
- {
--	int flags=0, dsize=fp->dsize;
-+	int flags=0;
- 	for(; fp && fp->next; fp=fp->next)
- 	{
- 		if(fp->next->disc && (fp->next->disc->getnum || fp->next->disc->getval))
[email protected]@ -1083,7 +1083,7 @@ char *nv_getvtree(register Namval_t *np,
- 		nv_offattr(np,NV_EXPORT);
- 	if(flags |= nv_isattr(np,NV_TABLE))
- 		nv_offattr(np,NV_TABLE);
--	if(dsize && (flags&NV_EXPORT))
-+	if( (fp) && (fp->dsize) && (flags&NV_EXPORT))
- 		return("()");
- 	return(walk_tree(np,(Namval_t*)0,flags));
- }
--- a/components/ksh93/patches/CR7019368.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-diff -rupN INIT.2011-02-08/src/cmd/INIT/regress.sh INIT.2011-02-08.clean/src/cmd/INIT/regress.sh
---- INIT.2011-02-08/src/cmd/INIT/regress.sh	2010-06-13 16:38:43.000000000 +0100
-+++ INIT.2011-02-08.clean/src/cmd/INIT/regress.sh	2012-05-07 15:27:52.975530153 +0100
[email protected]@ -1351,7 +1351,7 @@ esac
- export COLUMNS=80
- SOURCE=$PWD
- PATH=$SOURCE:${PATH#?(.):}
--PATH=${PATH%%:?(.)}:/usr/5bin:/bin:/usr/bin
-+PATH=${PATH%%:?(.)}:/bin:/usr/bin
- UNIT=$1
- shift
- if	[[ -f $UNIT && ! -x $UNIT ]]
-diff -rupN INIT.2011-02-08/src/lib/libast/comp/mkdir.c INIT.2011-02-08.clean/src/lib/libast/comp/mkdir.c
---- INIT.2011-02-08/src/lib/libast/comp/mkdir.c	2012-05-07 15:23:37.437905060 +0100
-+++ INIT.2011-02-08.clean/src/lib/libast/comp/mkdir.c	2012-05-07 15:25:03.856907633 +0100
[email protected]@ -39,7 +39,7 @@ mkdir(const char* path, mode_t mode)
- 	register int	n;
- 	char*		av[3];
- 
--	static char*	cmd[] = { "/bin/mkdir", "/usr/5bin/mkdir", 0 };
-+	static char*	cmd[] = { "/bin/mkdir", 0 };
- 
- 
- 	n = errno;
-diff -rupN INIT.2011-02-08/src/lib/libast/comp/rmdir.c INIT.2011-02-08.clean/src/lib/libast/comp/rmdir.c
---- INIT.2011-02-08/src/lib/libast/comp/rmdir.c	2012-05-07 15:23:37.439623862 +0100
-+++ INIT.2011-02-08.clean/src/lib/libast/comp/rmdir.c	2012-05-07 15:25:25.119862860 +0100
[email protected]@ -39,7 +39,7 @@ rmdir(const char* path)
- 	struct stat	st;
- 	char*		av[3];
- 
--	static char*	cmd[] = { "/bin/rmdir", "/usr/5bin/rmdir", 0 };
-+	static char*	cmd[] = { "/bin/rmdir", 0 };
- 
- 	if (stat(path, &st) < 0) return(-1);
- 	if (!S_ISDIR(st.st_mode))
-diff -rupN INIT.2011-02-08/src/lib/libast/port/astconf.c INIT.2011-02-08.clean/src/lib/libast/port/astconf.c
---- INIT.2011-02-08/src/lib/libast/port/astconf.c	2012-05-07 15:23:37.452538787 +0100
-+++ INIT.2011-02-08.clean/src/lib/libast/port/astconf.c	2012-05-07 15:27:12.365726756 +0100
[email protected]@ -565,7 +565,7 @@ initialize(register Feature_t* fp, const
- 						}
- 						if (fp->op == OP_universe)
- 						{
--							if (strneq(p, "xpg", 3) || strneq(p, "5bin", 4))
-+							if (strneq(p, "xpg", 3))
- 							{
- 								ok = 1;
- 								break;
--- a/components/ksh93/patches/CR7025778.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
---- a/src/lib/libcmd/cmp.c	Mon Apr 12 15:39:53 2010
-+++ b/src/lib/libcmd/cmp.c	Tue Jun 28 13:59:47 2011
[email protected]@ -1,3 +1,7 @@
-+/*
-+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
-+
- /***********************************************************************
- *                                                                      *
- *               This software is part of the ast package               *
[email protected]@ -164,6 +168,10 @@
- 				return ret;
- 			if (!(p1 = (unsigned char*)sfreserve(f1, SF_UNBOUND, 0)) || (c1 = sfvalue(f1)) <= 0)
- 			{
-+				if (sferror(f1)) {
-+					error(ERROR_exit(2),
-+					    "read error on %s", file1);
-+				}
- 				if ((e2 - p2) > 0 || sfreserve(f2, SF_UNBOUND, 0) && sfvalue(f2) > 0)
- 				{
- 					ret = 1;
[email protected]@ -170,6 +178,10 @@
- 					if (!(flags & CMP_SILENT))
- 						error(ERROR_exit(1), "EOF on %s", file1);
- 				}
-+				if (sferror(f2)) {
-+					error(ERROR_exit(2),
-+					    "read error on %s", file2);
-+				}
- 				return ret;
- 			}
- 			if (count > 0 && c1 > count)
[email protected]@ -181,6 +193,10 @@
- 		{
- 			if (!(p2 = (unsigned char*)sfreserve(f2, SF_UNBOUND, 0)) || (c2 = sfvalue(f2)) <= 0)
- 			{
-+				if (sferror(f2)) {
-+					error(ERROR_exit(2),
-+					    "read error on %s", file2);
-+				}
- 				if (!(flags & CMP_SILENT))
- 					error(ERROR_exit(1), "EOF on %s", file2);
- 				return 1;
-
--- a/components/ksh93/patches/CR7026179.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
---- a/src/lib/libcmd/wclib.c	Tue Dec  1 17:10:57 2009
-+++ b/src/lib/libcmd/wclib.c	Wed Jun 29 15:22:42 2011
[email protected]@ -18,6 +18,9 @@
- *                  David Korn <[email protected]>                   *
- *                                                                      *
- ***********************************************************************/
-+/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
- #pragma prototyped
- /*
-  * David Korn
[email protected]@ -341,7 +344,9 @@
- 		int		xspace;
- 		int		wasspace = 1;
- 		unsigned char*	start;
-+		int             flagm = 0;
- 
-+
- 		lastchar = 0;
- 		start = (endbuff = side) + 1;
- 		xspace = iswspace(0xa0) || iswspace(0x85);
[email protected]@ -367,6 +372,7 @@
- 			if(mbc(lasttype))
- 			{
- 				c = lasttype;
-+				flagm = 1;
- 				goto mbyte;
- 			}
- 			if(!lasttype && spc(type[*cp]))
[email protected]@ -415,6 +421,18 @@
- 							skip = (c&7);
- 							adjust += skip;
- 							state = 0;
-+							if (flagm == 1) {
-+								flagm = 0;
-+								oldc = *cp;
-+								if (xspace && (
-+								    iswspace
-+								    (*cp)
-+								    == 1)) {
-+									state
-+									    = 8;
-+								}
-+								continue;
-+							}
- 							if(skip==2 && (cp[-1]&0xc)==0 && (state=(cp[-1]&0x3)))
- 								oldc = *cp;
- 							else if(xspace && cp[-1]==0xc2)
--- a/components/ksh93/patches/CR7032068.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c	2012-05-02 03:34:48.830258020 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c	2012-05-02 03:42:51.584924888 -0700
[email protected]@ -1084,7 +1084,7 @@ static int varsub(Mac_t *mp)
- {
- 	register int	c;
- 	register int	type=0; /* M_xxx */
--	register char	*v,*argp=0;
-+	register char	*v, *new_v = NULL, *argp=0;
- 	register Namval_t	*np = NIL(Namval_t*);
- 	register int 	dolg=0, mode=0;
- 	Lex_t		*lp = (Lex_t*)mp->shp->lex_context;
[email protected]@ -1436,6 +1436,7 @@ retry1:
- 				if( (mp->arith||mp->let) && (np->nvfun || nv_isattr(np,(NV_LJUST|NV_RJUST|NV_ZFILL))) && !nv_isattr(np,NV_INTEGER) && (offset==0 || !isalnum(c)))
- 					mp->zeros = 1;
- 			}
-+			new_v = v = strdup(v);
- 			if(savptr==stakptr(0))
- 				stkseek(stkp,offset);
- 			else
[email protected]@ -1963,8 +1964,12 @@ retry2:
- 	}
- 	if(np)
- 		nv_close(np);
-+ 	if (new_v)
-+		free(new_v);
- 	return(1);
- nosub:
-+	if (new_v)
-+		free(new_v);
- 	if(type==M_BRACE && sh_lexstates[ST_NORM][c]==S_BREAK)
- 	{
- 		fcseek(-1);
--- a/components/ksh93/patches/CR7032821.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/jobs.c INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/jobs.c	2012-05-08 12:44:12.309610229 +0100
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c	2012-05-08 12:48:34.559797683 +0100
[email protected]@ -950,6 +950,7 @@ int job_walk(Sfio_t *file,int (*fun)(str
- 			if(!(pw = job_bypid(pid)))
- 			{
- 				pw = &dummy;
-+				pw->p_shp = sh_getinterp();
- 				pw->p_pid = pid;
- 				pw->p_pgrp = pid;
- 			}
--- a/components/ksh93/patches/CR7033181.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- a/src/cmd/ksh93/bltins/typeset.c	Fri Dec 31 00:15:57 2010
-+++ b/src/cmd/ksh93/bltins/typeset.c	Tue Jun 28 13:59:53 2011
[email protected]@ -608,7 +608,7 @@
- 			}
- 			if(!nv_isarray(np) && !strchr(name,'=') && !(shp->envlist  && nv_onlist(shp->envlist,name)))
- 			{
--				if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&NV_EXPORT) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
-+				if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&(NV_EXPORT|NV_RDONLY)) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
- {
- 					_nv_unset(np,0);
- }
--- a/components/ksh93/patches/CR7036535.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
---- a/src/cmd/ksh93/sh/path.c	Mon Nov 22 20:55:38 2010
-+++ b/src/cmd/ksh93/sh/path.c	Tue Sep 27 10:48:45 2011
[email protected]@ -1430,7 +1435,7 @@
- 		len = strlen(name);
- 	for(pp=first; pp; pp=pp->next)
- 	{
--		if(memcmp(name,pp->name,len)==0 && (pp->name[len]==':' || pp->name[len]==0))
-+		if(strncmp(name,pp->name,len)==0 && (pp->name[len]==':' || pp->name[len]==0))
- 		{
- 			pp->flags |= flag;
- 			return(first);
[email protected]@ -1740,7 +1745,7 @@
- 	register Pathcomp_t *pp=first;
- 	while(pp)
- 	{
--		if(memcmp(name,pp->name,pp->len)==0 && name[pp->len]==c) 
-+		if(strncmp(name,pp->name,pp->len)==0 && name[pp->len]==c) 
- 			return(pp);
- 		pp = pp->next;
- 	}
---- a/src/cmd/ksh93/sh/nvtree.c	Sun Jan  2 17:45:14 2011
-+++ b/src/cmd/ksh93/sh/nvtree.c	Fri Jul 22 00:30:31 2011
[email protected]@ -26,6 +26,9 @@
-  *   AT&T Labs
-  *
-  */
-+/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
- 
- #include	"defs.h"
- #include	"name.h"
[email protected]@ -188,7 +191,7 @@
- 		{
- 			char *cp = nv_name(dp->hp);
- 			c = strlen(cp);
--			if(memcmp(name,cp,c) || name[c]!='[')
-+			if(strncmp(name,cp,c) || name[c]!='[')
- 				dp->hp = (Namval_t*)dtnext(dp->root,dp->hp);
- 			else
- 			{
[email protected]@ -266,7 +269,7 @@
- {
- 	if(dp->nextnode)
- 		return((*dp->nextnode)(dp->hp,dp->root,dp->fun));
--	if(dp->len && memcmp(dp->data, dp->hp->nvname, dp->len))
-+	if(dp->len && strncmp(dp->data, dp->hp->nvname, dp->len))
- 		return(0);
- 	return((Namval_t*)dtnext(dp->root,dp->hp));
- }
[email protected]@ -311,7 +314,7 @@
- 					dp->hp = (*dp->nextnode)(np,(Dt_t*)0,dp->fun);
- 			}
- 			sh.last_table = last_table;
--			if(!dp->len || memcmp(cp,dp->data,dp->len)==0)
-+			if(!dp->len || strncmp(cp,dp->data,dp->len)==0)
- 			{
- 				if((nfp=nextdisc(np)) && (nfp->disc->getval||nfp->disc->getnum) && nv_isvtree(np) && strcmp(cp,dp->data))
- 					nfp = 0;
[email protected]@ -861,7 +864,7 @@
- 					continue;
- 				break;
- 			}
--			else if(outfile && !wp->nofollow && argv[1] && memcmp(arg,argv[1],l=strlen(arg))==0 && argv[1][l]=='[')
-+			else if(outfile && !wp->nofollow && argv[1] && strncmp(arg,argv[1],l=strlen(arg))==0 && argv[1][l]=='[')
- 			{
- 				int	k=1;
- 				Namarr_t *ap=0;
--- a/components/ksh93/patches/CR7046434.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-diff -rupN INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c
---- INIT.2011-02-08/src/cmd/ksh93/sh/subshell.c	2012-05-01 10:06:04.621554775 -0700
-+++ INIT.2011-02-08.clean/src/cmd/ksh93/sh/subshell.c	2012-05-01 10:05:25.139965959 -0700
[email protected]@ -241,9 +241,6 @@ Namval_t *sh_assignok(register Namval_t 
- 	/* don't bother with this */
- 	if(!sp->shpwd || np==SH_LEVELNOD || np==L_ARGNOD || np==SH_SUBSCRNOD || np==SH_NAMENOD)
- 		return(np);
--	/* don't bother to save if in newer scope */
--	if(sp->var!=shp->var_tree && shp->last_root==shp->var_tree)
--		return(np);
- 	if((ap=nv_arrayptr(np)) && (mp=nv_opensub(np)))
- 	{
- 		shp->last_root = ap->table;
--- a/components/ksh93/patches/CR7057565.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/Makefile INIT.2011-02-08/src/cmd/ksh93/Makefile
---- INIT.2011-02-08.clean/src/cmd/ksh93/Makefile	2012-04-11 17:48:34.919720887 +0100
-+++ INIT.2011-02-08/src/cmd/ksh93/Makefile	2012-04-11 17:51:33.474974484 +0100
[email protected]@ -40,7 +40,7 @@ SHOPT_NAMESPACE == 1		/* allow namespace
- SHOPT_OLDTERMIO ==		/* support both TCGETA and TCGETS */
- SHOPT_OPTIMIZE == 1		/* optimize loop invariants */
- SHOPT_PFSH == 1			/* solaris exec_attr(4) profile execution */
--SHOPT_P_SUID ==			/* real uid's that require -p for set[ug]id */
-+SHOPT_P_SUID == 1		/* real uid's that require -p for set[ug]id */
- SHOPT_RAWONLY == 1		/* make viraw the only vi mode */
- SHOPT_REGRESS ==		/* enable __regress__ builtin and instrumented intercepts for testing */
- SHOPT_REMOTE ==			/* enable --rc if running as a remote shell */
--- a/components/ksh93/patches/CR7061011.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvdisc.c INIT.2011-02-08/src/cmd/ksh93/sh/nvdisc.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/nvdisc.c	2012-05-02 03:46:22.725281017 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/nvdisc.c	2012-05-02 03:54:19.300127633 -0700
[email protected]@ -593,7 +593,7 @@ static char *setdisc(register Namval_t* 
- 		action = vp->bltins[type];
- 		vp->bltins[type] = 0;
- 	}
--	return(action?(char*)action:"");
-+	return((char*)action);
- }
- 
- static void putdisc(Namval_t* np, const char* val, int flag, Namfun_t* fp)
--- a/components/ksh93/patches/CR7065478.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
---- a/src/lib/libast/comp/setlocale.c	Mon Dec 27 04:23:49 2010
-+++ b/src/lib/libast/comp/setlocale.c	Fri Jul 22 00:30:31 2011
[email protected]@ -19,6 +19,9 @@
- *                   Phong Vo <[email protected]>                    *
- *                                                                      *
- ***********************************************************************/
-+/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
- #pragma prototyped
- 
- /*
[email protected]@ -2236,6 +2239,24 @@
- 
- typedef int (*Isw_f)(wchar_t);
- 
-+static int
-+wide_wctomb(char* u, wchar_t w) 
-+{
-+	int size = 0;
-+
-+	if (u)
-+	{
-+		size = wctomb(u, w);
-+		if (size < 0)
-+		{
-+			*u = (char)(w & 0xff);
-+			size = 1;
-+		}
-+	}
-+
-+	return size;
-+}
-+
- /*
-  * called when LC_CTYPE initialized or changes
-  */
[email protected]@ -2280,7 +2301,7 @@
- 	{
- 		if (!(ast.mb_width = wcwidth))
- 			ast.mb_width = default_wcwidth;
--		ast.mb_conv = wctomb;
-+		ast.mb_conv = wide_wctomb;
- #ifdef mb_state
- 		{
- 			/*
--- a/components/ksh93/patches/CR7065900.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- a/src/cmd/ksh93/data/builtins.c	Tue Dec  7 19:23:04 2010
-+++ b/src/cmd/ksh93/data/builtins.c	Mon Jul 18 12:08:50 2011
[email protected]@ -108,7 +108,6 @@
- 	"printf",	NV_BLTIN|BLT_ENV,		bltin(printf),
- 	"pwd",		NV_BLTIN,			bltin(pwd),
- 	"read",		NV_BLTIN|BLT_ENV,		bltin(read),
--	"sleep",	NV_BLTIN,			bltin(sleep),
- 	"alarm",	NV_BLTIN,			bltin(alarm),
- 	"ulimit",	NV_BLTIN|BLT_ENV,		bltin(ulimit),
- 	"umask",	NV_BLTIN|BLT_ENV,		bltin(umask),
-
--- a/components/ksh93/patches/CR7071431.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- a/src/cmd/ksh93/include/ulimit.h	Tue Oct 26 16:25:26 2010
-+++ b/src/cmd/ksh93/include/ulimit.h	Thu Aug 25 10:19:37 2011
[email protected]@ -157,7 +157,7 @@
- 
- typedef struct Limit_s
- {
--	const char	name[8];
-+	const char*	name;
- 	const char*	description;
- 	int		index;
- 	const char*	conf;
--- a/components/ksh93/patches/CR7089799.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c INIT.2011-02-08/src/cmd/ksh93/sh/io.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c	2012-05-07 14:33:37.179788579 +0100
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/io.c	2012-05-07 14:39:11.089877123 +0100
[email protected]@ -868,10 +868,10 @@ int sh_iomovefd(register int fdold)
- {
- 	Shell_t *shp = sh_getinterp();
- 	register int fdnew;
-+	VALIDATE_FD(shp, fdold);
- 	if(fdold<0 || fdold>2)
- 		return(fdold);
- 	fdnew = sh_iomovefd(dup(fdold));
--	VALIDATE_FD(shp, fdold);
- 	VALIDATE_FD(shp, fdnew);
- 	shp->fdstatus[fdnew] = (shp->fdstatus[fdold]&~IOCLEX);
- 	close(fdold);
[email protected]@ -890,6 +890,8 @@ int	sh_pipe(register int pv[])
- 		errormsg(SH_DICT,ERROR_system(1),e_pipe);
- 	pv[0] = sh_iomovefd(pv[0]);
- 	pv[1] = sh_iomovefd(pv[1]);
-+	VALIDATE_FD(shp, pv[0]);
-+	VALIDATE_FD(shp, pv[1]);
- 	shp->fdstatus[pv[0]] = IONOSEEK|IOREAD;
- 	shp->fdstatus[pv[1]] = IONOSEEK|IOWRITE;
- 	sh_subsavefd(pv[0]);
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c INIT.2011-02-08/src/cmd/ksh93/sh/path.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c	2012-05-07 14:33:37.182443770 +0100
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/path.c	2012-05-07 14:40:06.256096054 +0100
[email protected]@ -565,6 +565,7 @@ static int	path_opentype(Shell_t *shp,co
- 	if(fd>=0 && (fd = sh_iomovefd(fd)) > 0)
- 	{
- 		fcntl(fd,F_SETFD,FD_CLOEXEC);
-+		VALIDATE_FD(shp, fd);
- 		shp->fdstatus[fd] |= IOCLEX;
- 	}
- 	return(fd);
--- a/components/ksh93/patches/CR7105086.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-diff -r bb8978c251cb -r 6fbea5c30b60 usr/src/cmd/ast/lib/libshell/common/sh/jobs.c
---- a/src/cmd/ksh93/sh/jobs.c	Sun Mar 25 23:19:46 2012 -0700
-+++ b/src/cmd/ksh93/sh/jobs.c	Mon Mar 26 05:09:19 2012 -0700
[email protected]@ -28,6 +28,9 @@
-  *  Rewritten April, 1988
-  *  Revised January, 1992
-  */
-+/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
- 
- #include	"defs.h"
- #include	<wait.h>
[email protected]@ -57,6 +60,7 @@
- {
- 	struct jobsave	*next;
- 	pid_t		pid;
-+	short		curenv;
- 	unsigned short	exitval;
- };
- 
[email protected]@ -232,6 +236,7 @@
- 		jp->pid = pid;
- 		jp->next = bck.list;
- 		bck.list = jp;
-+		jp->curenv = 0;
- 		jp->exitval = 0;
- 	}
- 	return(jp);
[email protected]@ -1790,6 +1795,7 @@
- 			/* save status for future wait */
- 			if(jp = jobsave_create(pw->p_pid))
- 			{
-+				jp->curenv = pw->p_env;
- 				jp->exitval = pw->p_exit;
- 				if(pw->p_flag&P_SIGNALLED)
- 					jp->exitval |= SH_EXITSIG;
[email protected]@ -1967,7 +1973,7 @@
- 	for(jp=bck.list; jp; jp=jpnext)
- 	{
- 		jpnext = jp->next;
--		if(jp->pid==sh.spid)
-+		if(jp->curenv != sh.curenv || jp->pid==sh.spid)
- 		{
- 			jp->next = bp->list;
- 			bp->list = jp;
--- a/components/ksh93/patches/CR7110983.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-diff -r bb8978c251cb -r 6fbea5c30b60 usr/src/cmd/ast/lib/libshell/common/sh/name.c
---- a/src/cmd/ksh93/sh/name.c	Sun Mar 25 23:19:46 2012 -0700
-+++ b/src/cmd/ksh93/sh/name.c	Mon Mar 26 05:09:19 2012 -0700
[email protected]@ -22,6 +22,9 @@
-  * AT&T Labs
-  *
-  */
-+/*
-+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
- 
- #define putenv	___putenv
- 
[email protected]@ -1832,7 +1835,10 @@
- 			else
- #endif
- 			if(size==0 && nv_isattr(np,NV_HOST)!=NV_HOST &&nv_isattr(np,NV_LJUST|NV_RJUST|NV_ZFILL))
-+			{
- 				nv_setsize(np,size=dot);
-+				tofree = up->cp;
-+			}
- 			else if(size > dot)
- 				dot = size;
- 			else if(nv_isattr(np,NV_LJUST|NV_RJUST)==NV_LJUST && dot>size)
--- a/components/ksh93/patches/CR7128313.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
---- a/src/cmd/ksh93/sh/path.c
-+++ b/src/cmd/ksh93/sh/path.c
[email protected]@ -1761,6 +1761,7 @@
- 	char *ptr;
- 	if(!pp)
- 		return(NULL);
-+	pp->shp->last_table = 0;
- 	path_nextcomp(pp->shp,pp,nv_name(np),pp);
- 	ptr = stakfreeze(0);
- 	return(ptr+PATH_OFFSET);
--- a/components/ksh93/patches/CR7167466.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/edit/edit.c INIT.2011-02-08/src/cmd/ksh93/edit/edit.c
---- INIT.2011-02-08.clean/src/cmd/ksh93/edit/edit.c	2012-05-10 12:44:32.651317787 +0100
-+++ INIT.2011-02-08/src/cmd/ksh93/edit/edit.c	2012-05-10 12:49:00.804744460 +0100
[email protected]@ -1652,7 +1652,7 @@ int ed_histgen(Edit_t *ep,const char *pa
- 	History_t	*hp;
- 	off_t		offset;
- 	int 		ac=0,l,m,n,index1,index2;
--	char		*cp, **argv, **av, **ar;
-+	char		*cp, **argv=NULL, **av, **ar;
- 	if(!(hp=ep->sh->gd->hist_ptr))
- 		return(0);
- 	if(*pattern=='#')
[email protected]@ -1731,7 +1731,7 @@ int ed_histgen(Edit_t *ep,const char *pa
- 		mplast->next = 0;
- 	}
- 	ep->hlist = (Histmatch_t**)argv;
--	ep->hfirst = ep->hlist[0];
-+	ep->hfirst = ep->hlist ? ep->hlist[0] : NULL;
- 	return(ep->hmax=ac);
- }
- 
--- a/components/ksh93/patches/CR7168611.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/Makefile INIT.2011-02-08/src/cmd/ksh93/Makefile
---- INIT.2011-02-08.clean/src/cmd/ksh93/Makefile	2012-05-14 16:26:08.957879865 +0100
-+++ INIT.2011-02-08/src/cmd/ksh93/Makefile	2012-05-14 16:30:00.712605686 +0100
[email protected]@ -39,7 +39,7 @@ SHOPT_MULTIBYTE == 1		/* multibyte chara
- SHOPT_NAMESPACE == 1		/* allow namespaces */
- SHOPT_OLDTERMIO ==		/* support both TCGETA and TCGETS */
- SHOPT_OPTIMIZE == 1		/* optimize loop invariants */
--SHOPT_PFSH == 1			/* solaris exec_attr(4) profile execution */
-+SHOPT_PFSH == 0			/* solaris exec_attr(4) profile execution */
- SHOPT_P_SUID == 1		/* real uid's that require -p for set[ug]id */
- SHOPT_RAWONLY == 1		/* make viraw the only vi mode */
- SHOPT_REGRESS ==		/* enable __regress__ builtin and instrumented intercepts for testing */
--- a/components/ksh93/patches/CR7175995.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-diff -Naur INIT.2011-02-08.orig/src/cmd/ksh93/sh/init.c INIT.2011-02-08/src/cmd/ksh93/sh/init.c
---- INIT.2011-02-08.orig/src/cmd/ksh93/sh/init.c	2012-06-25 01:05:32.997978071 -0700
-+++ INIT.2011-02-08/src/cmd/ksh93/sh/init.c	2012-06-25 01:19:10.000000000 -0700
[email protected]@ -1181,7 +1181,7 @@
- 	Shell_t	*shp;
- 	register int n;
- 	int type;
--	static char *login_files[3];
-+	static char *login_files[2];
- 	memfatal();
- 	n = strlen(e_version);
- 	if(e_version[n-1]=='$' && e_version[n-2]==' ')
[email protected]@ -1468,7 +1468,6 @@
-         shp->topscope = (Shscope_t*)shp->st.self;
- 	sh_offstate(SH_INIT);
- 	login_files[0] = (char*)e_profile;
--	login_files[1] = ".profile";
- 	shp->gd->login_files = login_files;
- 	shp->bltindata.version = SH_VERSION;
- 	shp->bltindata.shp = shp;
--- a/components/ksh93/patches/CR7178717.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-*** INIT.2011-02-08/src/cmd/ksh93/sh/jobs.c	Tue Jul 10 17:37:30 2012
---- ./jobs.c	Tue Jul 10 18:59:39 2012
-***************
-*** 1969,1985 ****
-  	register struct back_save *bp = (struct back_save*)ptr;
-  	register struct process *pw, *px, *pwnext;
-  	struct jobsave *jpnext;
-  	job_lock();
-! 	for(jp=bck.list; jp; jp=jpnext)
-! 	{
-  		jpnext = jp->next;
-! 		if(jp->curenv != sh.curenv || jp->pid==sh.spid)
-! 		{
-! 			jp->next = bp->list;
-! 			bp->list = jp;
-! 			bp->count++;
-! 		}
-! 		else
-  			job_chksave(jp->pid);
-  	}
-  	for(pw=job.pwlist; pw; pw=pwnext)
---- 1969,2000 ----
-  	register struct back_save *bp = (struct back_save*)ptr;
-  	register struct process *pw, *px, *pwnext;
-  	struct jobsave *jpnext;
-+ 
-  	job_lock();
-! 	for(jp = bck.list; jp != NULL; jp = jpnext) {
-  		jpnext = jp->next;
-! 		if (jp->curenv != sh.curenv || jp->pid == sh.spid) {
-! 			struct jobsave *jp2, *jp2next;
-! 			/*
-! 			 * We may have same pid in both saved list and current
-! 			 * list. We discard the old jobsave by copying the new
-! 			 * one.
-! 			 */
-! 			for (jp2 = bp->list; jp2 != NULL; jp2 = jp2->next) {
-! 				if (jp->pid == jp2->pid)
-! 					break;
-! 			}
-! 			if (jp2 != NULL) {
-! 				jp2next = jp2->next;
-! 				*jp2 = *jp;
-! 				jp2->next = jp2next;
-! 				job_chksave(jp2->pid);
-! 			} else {
-! 				jp->next = bp->list;
-! 				bp->list = jp;
-! 				bp->count++;
-! 			}
-! 		} else
-  			job_chksave(jp->pid);
-  	}
-  	for(pw=job.pwlist; pw; pw=pwnext)
--- a/components/ksh93/patches/CR7186440_ksh93_disable_predictive_editing.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
---- a/src/cmd/ksh93/Makefile
-+++ b/src/cmd/ksh93/Makefile
[email protected]@ -28,7 +28,7 @@ SHOPT_COSHELL == 1		/* build with connection to coshell */
- SHOPT_CRNL ==			/* accept <cr><nl> for <nl> */
- SHOPT_DYNAMIC == 1		/* dynamic loading for builtins */
- SHOPT_ECHOPRINT ==		/* make echo equivalent to print */
--SHOPT_EDPREDICT == 1		/* predictive editing  */
-+SHOPT_EDPREDICT == 0		/* predictive editing  */
- SHOPT_ESH == 1			/* emacs/gmacs edit mode */
- SHOPT_FILESCAN == 1		/* fast file scan */
- SHOPT_FIXEDARRAY == 1		/* fixed dimension indexed array */
-
--- a/components/ksh93/patches/CRXXX_Error_Catalog.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- a/src/cmd/builtin/asa.c	Wed Nov  1 16:47:27 2006
-+++ b/src/cmd/builtin/asa.c	Tue Jun 28 13:59:47 2011
[email protected]@ -110,7 +110,7 @@
- 	register Sfio_t	*fp;
- 	register int	n, reclen=0;
- 
--	cmdinit(argc, argv,(void*)0,(const char*)0,0);
-+	cmdinit(argc, argv, context, ERROR_CATALOG, 0);
- 	while (n = optget(argv, usage)) switch (n)
- 	{
- 	    case 'r':
--- a/components/ksh93/patches/MAP_TYPE_64_Bits.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-diff -rupN INIT.2011-02-08.clean/src/lib/libast/sfio/sfmode.c INIT.2011-02-08/src/lib/libast/sfio/sfmode.c
---- INIT.2011-02-08.clean/src/lib/libast/sfio/sfmode.c	2012-05-07 15:45:04.418751281 +0100
-+++ INIT.2011-02-08/src/lib/libast/sfio/sfmode.c	2012-05-07 15:49:09.326244280 +0100
[email protected]@ -400,7 +400,7 @@ reg int		local;	/* a local call */
- 
- 	if(f->mode&SF_GETR)
- 	{	f->mode &= ~SF_GETR;
--#ifdef MAP_TYPE
-+#if defined(MAP_TYPE) && (_ptr_bits < 64)
- 		if((f->bits&SF_MMAP) && (f->tiny[0] += 1) >= (4*SF_NMAP) )
- 		{	/* turn off mmap to avoid page faulting */
- 			sfsetbuf(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);
--- a/components/ksh93/patches/compiler.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-diff -rupN INIT.2011-02-08/src/cmd/INIT/cc.sol11.i386-64 INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.i386-64
-diff -rupN INIT.2011-02-08/src/cmd/INIT/cc.sol11.i386-64 INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.i386-64
---- INIT.2011-02-08/src/cmd/INIT/cc.sol11.i386-64	1970-01-01 01:00:00.000000000 +0100
-+++ INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.i386-64	2012-05-18 10:49:31.008310676 +0100
[email protected]@ -0,0 +1,9 @@
-+: solaris.i386-64 cc wrapper for reasonable ansi C defaults and 64 bit : 2012-05-18 :
-+
-+HOSTTYPE=sol11.i386-64
-+
-+case " $* " in
-+*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
-+esac
-+
-+$CC_EXPLICIT -m64 -xc99 -D_XPG6 "[email protected]"
---- INIT.2011-02-08/src/cmd/INIT/cc.sol11.i386	1970-01-01 01:00:00.000000000 +0100
-+++ INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.i386	2012-05-18 10:49:31.008310676 +0100
[email protected]@ -0,0 +1,9 @@
-+: solaris.i386 cc wrapper for reasonable ansi C defaults and 32 bit : 2012-05-18 :
-+
-+HOSTTYPE=sol11.i386
-+
-+case " $* " in
-+*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
-+esac
-+
-+$CC_EXPLICIT -m32 -xc99 -D_XPG6 "[email protected]"
-diff -rupN INIT.2011-02-08/src/cmd/INIT/cc.sol11.sun4-64 INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.sun4-64
---- INIT.2011-02-08/src/cmd/INIT/cc.sol11.sun4-64	1970-01-01 01:00:00.000000000 +0100
-+++ INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.sun4-64	2012-05-18 10:49:20.339537677 +0100
[email protected]@ -0,0 +1,9 @@
-+: solaris.sun4-64 cc wrapper for reasonable ansi C defaults and 64 bit : 2012-05-18 :
-+
-+HOSTTYPE=sol11.sun4-64
-+
-+case " $* " in
-+*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
-+esac
-+
-+$CC_EXPLICIT -m64 -xc99 -D_XPG6 "[email protected]"
-diff -rupN INIT.2011-02-08/src/cmd/INIT/cc.sol11.sun4 INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.sun4-64
---- INIT.2011-02-08/src/cmd/INIT/cc.sol11.sun4	1970-01-01 01:00:00.000000000 +0100
-+++ INIT.2011-02-08.patched/src/cmd/INIT/cc.sol11.sun4	2012-05-18 10:49:20.339537677 +0100
[email protected]@ -0,0 +1,9 @@
-+: solaris.sun4 cc wrapper for reasonable ansi C defaults and 32 bit : 2012-05-18 :
-+
-+HOSTTYPE=sol11.sun4
-+
-+case " $* " in
-+*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
-+esac
-+
-+$CC_EXPLICIT -m32 -xc99 -D_XPG6  "[email protected]"
--- a/components/ksh93/patches/multi_lang_arith.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-diff -rupN a/src/lib/libast/sfio/sfstrtof.h b/src/lib/libast/sfio/sfstrtof.h
---- a/src/lib/libast/sfio/sfstrtof.h	2010-12-24 14:32:27.000000000 +0000
-+++ b/src/lib/libast/sfio/sfstrtof.h	2011-10-25 12:21:57.749942750 +0100
[email protected]@ -414,7 +414,7 @@ S2F_function(str, end) char* str; char**
- 			m = 0;
- 			fraction = digits;
- 		}
--		else if (c != thousand)
-+		else if (c != thousand || (c == thousand && decimal == -1))
- 			break;
- 		else if (!(m = digits))
- 		{
--- a/components/ksh93/patches/package-pax-suid.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-diff -ru clean/bin/package patched/bin/package
---- clean/bin/package	Thu Feb  3 15:45:18 2011
-+++ patched/bin/package	Wed Sep 21 13:21:39 2011
[email protected]@ -5111,7 +5111,7 @@
- 						export INSTALLROOT VPATH
- 						echo lib/$command
- 						$MAKE -s $makeflags -f $i.pkg $qualifier list.installed $assign
--						) | sort -u | pax -drw -ps $dest
-+						) | sort -u | pax -drw $dest
- 					)
- 				fi
- 			fi
[email protected]@ -5916,7 +5916,7 @@
- 					;;
- 				esac
- 			elif	test "" != "$PAX"
--			then	$exec pax -L --from=ascii --local -m -ps -rvf "$f" || {
-+			then	$exec pax -L --from=ascii --local -m -rvf "$f" || {
- 					code=1
- 					continue
- 				}
[email protected]@ -6010,7 +6010,7 @@
- 					esac
- 				}
- 				# -m with delta bug fixed 2005-02-08
--				$exec pax -L --from=ascii --local -ps -rvf "$f" -z "$b" || {
-+				$exec pax -L --from=ascii --local -rvf "$f" -z "$b" || {
- 					code=1
- 					continue
- 				}
[email protected]@ -6052,7 +6052,7 @@
- 					esac
- 				}
- 				# -m with delta bug fixed 2005-02-08
--				$exec pax -L --from=ascii --local -ps -rvf "$f" -z "$b" || {
-+				$exec pax -L --from=ascii --local -rvf "$f" -z "$b" || {
- 					code=1
- 					continue
- 				}
-diff -ru clean/src/cmd/INIT/package.sh patched/src/cmd/INIT/package.sh
---- clean/src/cmd/INIT/package.sh	Thu Feb  3 15:45:16 2011
-+++ patched/src/cmd/INIT/package.sh	Wed Sep 21 13:22:04 2011
[email protected]@ -5129,7 +5129,7 @@
- 						export INSTALLROOT VPATH
- 						echo lib/$command
- 						$MAKE -s $makeflags -f $i.pkg $qualifier list.installed $assign
--						) | sort -u | pax -drw -ps $dest
-+						) | sort -u | pax -drw $dest
- 					)
- 				fi
- 			fi
[email protected]@ -5934,7 +5934,7 @@
- 					;;
- 				esac
- 			elif	test "" != "$PAX"
--			then	$exec pax -L --from=ascii --local -m -ps -rvf "$f" || {
-+			then	$exec pax -L --from=ascii --local -m -rvf "$f" || {
- 					code=1
- 					continue
- 				}
[email protected]@ -6028,7 +6028,7 @@
- 					esac
- 				}
- 				# -m with delta bug fixed 2005-02-08
--				$exec pax -L --from=ascii --local -ps -rvf "$f" -z "$b" || {
-+				$exec pax -L --from=ascii --local -rvf "$f" -z "$b" || {
- 					code=1
- 					continue
- 				}
[email protected]@ -6070,7 +6070,7 @@
- 					esac
- 				}
- 				# -m with delta bug fixed 2005-02-08
--				$exec pax -L --from=ascii --local -ps -rvf "$f" -z "$b" || {
-+				$exec pax -L --from=ascii --local -rvf "$f" -z "$b" || {
- 					code=1
- 					continue
- 				}
--- a/components/ksh93/patches/path_utmp.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-diff -rupN a/src/cmd/ss/ssd.c b/src/cmd/ss/ssd.c
---- a/src/cmd/ss/ssd.c	2010-06-09 16:06:54.000000000 +0100
-+++ b/src/cmd/ss/ssd.c	2011-10-24 15:46:09.321811427 +0100
[email protected]@ -118,9 +118,6 @@ struct whod
- #if	!defined(UTMP_PATHNAME) && defined(UTMPX_PATHNAME)
- #define UTMP_PATHNAME	UTMPX_PATHNAME
- #endif	
--#if	!defined(_PATH_UTMP) && defined(_PATH_UTMPX)
--#define _PATH_UTMP	_PATH_UTMPX
--#endif     
- 
- #else
- 
[email protected]@ -142,8 +139,8 @@ static char*		usrfiles[] =
- #ifdef	UTMP_PATHNAME
- 	UTMP_PATHNAME,
- #endif
--#ifdef	_PATH_UTMP
--	_PATH_UTMP,
-+#ifdef	_PATH_UTMPX
-+	_PATH_UTMPX,
- #endif
- #if _hdr_utmpx
- 	"/etc/utmpx",
--- a/components/ksh93/patches/solaris_alias.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,363 +0,0 @@
-diff -rupN b/lib/package/ast-base.pkg a/lib/package/ast-base.pkg
---- b/lib/package/ast-base.pkg	2009-09-21 20:35:51.000000000 +0000
-+++ a/lib/package/ast-base.pkg	2011-11-10 16:24:52.515495613 +0000
[email protected]@ -3,7 +3,7 @@ ast-base :PACKAGE: \
- 		libdll libexpr libodelta librecsort libsum libuu libvdelta \
- 		libbz libz tests 3d coshell cpp cs mam msgcc nmake probe ss \
- 		libcoshell libcs libmam libpp libcodex paxlib codexlib \
--		libdss libpz dsslib
-+		libdss libpz dsslib alias
- 
- :COVERS: ast-make ast-ksh ast-ast
- 
-diff -rupN b/src/cmd/alias/alias.c a/src/cmd/alias/alias.c
---- b/src/cmd/alias/alias.c	1970-01-01 00:00:00.000000000 +0000
-+++ a/src/cmd/alias/alias.c	2011-11-10 16:24:28.356925339 +0000
[email protected]@ -0,0 +1,255 @@
-+/*
-+ * 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 (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
-+
-+/*
-+ * alias.c is a C version of the alias.sh wrapper (which links ksh
-+ * builtins to commands in /usr/bin/, e.g. calling this wrapper as
-+ * /usr/bin/alias will call the ksh "alias" builtin, running it as
-+ * /usr/bin/cut will call the ksh "cut" builtin etc.
-+ */
-+
-+#include <shell.h>
-+#include <nval.h>
-+#include <stdio.h>
-+#include <alias.h>
-+
-+typedef struct {
-+	const char *name;
-+	int (* func)(int, char **, void *);
-+} bfastpathrec;
-+
-+/*
-+ * We've disabled the "fastpath" codepath for some commands below
-+ * because it causes a paradoxon for large input files (as used by
-+ * ON PerfPIT for testing). For /usr/bin/rev (where the issue was
-+ * first discovered) it looks like this:
-+ * - for small files like /etc/profile the fastpath is faster in a loop
-+ *   with 1000 iterations (8 seconds with fastpath, 14 seconds without
-+ *   fastpath)
-+ * - for large files (/usr/pub/UTF-8 replicated until the test file
-+ *   reaches 24884706 bytes) the benchmark reverses: The fastpath now
-+ *   needs 40 seconds and without fastpath it needs 30 seconds (for 100
-+ *   iterations).
-+ */
-+#if 0
-+#define	ENABLE_PERFORMANCE_PARADOXON 1
-+#endif
-+
-+/*
-+ * List of libcmd builtins which do not require a |Shell_t| context.
-+ * This list was automatically generated from <ast/cmdext.h>
-+ */
-+static const
-+bfastpathrec fastpath_builtins[] =
-+{
-+	/* This list must be alphabetically sorted for |strcmp()| usage */
-+	{ "basename",	b_basename	},
-+	{ "cat",	b_cat		},
-+	{ "chgrp",	b_chgrp		},
-+	{ "chmod",	b_chmod		},
-+	{ "chown",	b_chown		},
-+#ifdef ENABLE_PERFORMANCE_PARADOXON
-+	{ "cksum",	b_cksum		},
-+#endif /* ENABLE_PERFORMANCE_PARADOXON */
-+	{ "cmp",	b_cmp		},
-+	{ "comm",	b_comm		},
-+	{ "cp",		b_cp		},
-+	{ "cut",	b_cut		},
-+	{ "date",	b_date		},
-+	{ "dirname",	b_dirname	},
-+	{ "expr",	b_expr		},
-+	{ "fds",	b_fds		},
-+	{ "fmt",	b_fmt		},
-+	{ "fold",	b_fold		},
-+	{ "getconf",	b_getconf	},
-+	{ "head",	b_head		},
-+	{ "id",		b_id		},
-+	{ "join",	b_join		},
-+	{ "ln",		b_ln		},
-+	{ "logname",	b_logname	},
-+	{ "md5sum",	b_md5sum	},
-+	{ "mkdir",	b_mkdir		},
-+	{ "mkfifo",	b_mkfifo	},
-+	{ "mktemp",	b_mktemp	},
-+	{ "mv",		b_mv		},
-+	{ "paste",	b_paste 	},
-+	{ "pathchk",	b_pathchk	},
-+	{ "pids",	b_pids		},
-+#ifdef ENABLE_PERFORMANCE_PARADOXON
-+	{ "rev",	b_rev		},
-+#endif /* ENABLE_PERFORMANCE_PARADOXON */
-+	{ "rm",		b_rm		},
-+	{ "rmdir",	b_rmdir		},
-+	{ "stty",	b_stty		},
-+#ifdef ENABLE_PERFORMANCE_PARADOXON
-+	{ "sum",	b_sum		},
-+#endif /* ENABLE_PERFORMANCE_PARADOXON */
-+	{ "sync",	b_sync		},
-+	{ "tail",	b_tail		},
-+	{ "tee",	b_tee		},
-+	{ "tty",	b_tty		},
-+	{ "uname",	b_uname		},
-+	{ "uniq",	b_uniq		},
-+	{ "wc",		b_wc		},
-+	{ NULL, 	(int (*)(int, char **, void *))NULL }
-+};
-+
-+static inline
-+const bfastpathrec *
-+find_bfastpathrec(const char *name)
-+{
-+	unsigned int i;
-+	signed int cmpres;
-+	for (i = 0; fastpath_builtins[i].name != NULL; i++) {
-+		cmpres = strcmp(fastpath_builtins[i].name, name);
-+		if (cmpres == 0)
-+			return (&fastpath_builtins[i]);
-+		else if (cmpres > 0)
-+			return (NULL);
-+
-+	}
-+	return (NULL);
-+}
-+
-+static inline
-+int
-+fastpath_builtin_main(const bfastpathrec *brec, int argc, char *argv[])
-+{
-+	setlocale(LC_ALL, ""); /* calls |_ast_setlocale()| */
-+
-+	return ((*brec->func)(argc, argv, NULL));
-+}
-+
-+
-+/* Builtin script, original derived from alias.sh */
-+static const char *script = "\n"
-+/* Get name of builtin */
-+"typeset cmd=\"${0##*/}\"\n"
-+/*
-+ * 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 the path was something like
-+ * PATH=/usr/xpg4/bin:/usr/bin).
-+ */
-+"if [[ \"${cmd}\" != ~(Elr)(alias|unalias|command) ]] && "
-+	"! alias \"${cmd}\" >/dev/null 2>&1 ; then\n"
-+	"PATH='' builtin \"${cmd}\"\n"
-+"fi\n"
-+/* command is a keyword and needs to be handled separately */
-+"if [[ \"${cmd}\" == \"command\" ]] ; then\n"
-+	"command \"[email protected]\"\n"
-+"else\n"
-+#ifdef WORKAROUND_FOR_ALIAS_CRASH
-+/*
-+ * Work around a crash in /usr/bin/alias when invalid options are
-+ * passed (e.g. $ /usr/bin/alias -c #). The shell code will call
-+ * an error handler which does a |longjmp()| but somehow the code
-+ * failed to do the |setjmp()| before this point.
-+ * Putting the "alias" command in a subshell avoids the crash.
-+ * Real cause of the issue is under investigation and a fix be
-+ * delivered with the next ast-ksh update.
-+ */
-+	"( \"${cmd}\" \"[email protected]\" )\n"
-+#else
-+	"\"${cmd}\" \"[email protected]\"\n"
-+#endif /* WORKAROUND_FOR_ALIAS_CRASH */
-+"fi\n"
-+"exitval=$?";
-+
-+
-+static inline
-+int
-+script_builtin_main(int argc, char *argv[])
-+{
-+	int i;
-+	Shell_t *shp;
-+	Namval_t *np;
-+	int exitval;
-+
-+	/*
-+	 * Create copy of |argv| array shifted by one position to
-+	 * emulate $ /usr/bin/sh <scriptname> <args1> <arg2> ... #.
-+	 * First position is set to "/usr/bin/sh" since other
-+	 * values may trigger special shell modes (e.g. *rsh* will
-+	 * trigger "restricted" shell mode etc.).
-+	 */
-+	char *xargv[argc+2];
-+	xargv[0] = "/usr/bin/sh";
-+	xargv[1] = "scriptname";
-+	for (i = 0; i < argc; i++) {
-+		xargv[i+1] = argv[i];
-+	}
-+	xargv[i+1] = NULL;
-+
-+	shp = sh_init(argc+1, xargv, 0);
-+	if (!shp)
-+		error(ERROR_exit(1), "shell initialisation failed.");
-+	(void) sh_trap(script, 0);
-+
-+	np = nv_open("exitval", shp->var_tree, 0);
-+	if (!np)
-+		error(ERROR_exit(1), "variable %s not found.", "exitval");
-+	exitval = (int)nv_getnum(np);
-+	nv_close(np);
-+
-+	return (exitval);
-+}
-+
-+int
-+main(int argc, char *argv[])
-+{
-+	const char *progname;
-+	const bfastpathrec *brec;
-+	char execnamebuff[PATH_MAX+1];
-+
-+	/* Get program name */
-+	if (pathprog(argv[0], execnamebuff, sizeof (execnamebuff)) <= 0)
-+		error(ERROR_exit(1), "could not determinate exec name.");
-+
-+	progname = (const char *)strrchr(execnamebuff, '/');
-+	if (progname != NULL) {
-+		progname++;
-+	}
-+	else
-+	{
-+		progname = execnamebuff;
-+	}
-+
-+	/* Execute command... */
-+	if (brec = find_bfastpathrec(progname)) {
-+		/* ... either via a fast path (calling the code directly) ... */
-+		return (fastpath_builtin_main(brec, argc, argv));
-+	}
-+	else
-+	{
-+		/* ... or from within a full shell. */
-+		return (script_builtin_main(argc, argv));
-+	}
-+}
-diff -rupN b/src/cmd/alias/alias.h a/src/cmd/alias/alias.h
---- b/src/cmd/alias/alias.h	1970-01-01 00:00:00.000000000 +0000
-+++ a/src/cmd/alias/alias.h	2011-11-10 16:24:28.357387725 +0000
[email protected]@ -0,0 +1,79 @@
-+/***********************************************************************
-+*                                                                      *
-+*               This software is part of the ast package               *
-+*          Copyright (c) 1992-2011 AT&T Intellectual Property          *
-+*                      and is licensed under the                       *
-+*                  Common Public License, Version 1.0                  *
-+*                    by AT&T Intellectual Property                     *
-+*                                                                      *
-+*                A copy of the License is available at                 *
-+*            http://www.opensource.org/licenses/cpl1.0.txt             *
-+*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-+*                                                                      *
-+*              Information and Software Systems Research               *
-+*                            AT&T Research                             *
-+*                           Florham Park NJ                            *
-+*                                                                      *
-+*                 Glenn Fowler <[email protected]>                  *
-+*                  David Korn <[email protected]>                   *
-+*                                                                      *
-+***********************************************************************/
-+
-+extern int b_asa (int, char**, void *);
-+extern int b_basename (int, char**, void *);
-+extern int b_cat (int, char**, void *);
-+extern int b_chgrp (int, char**, void *);
-+extern int b_chmod (int, char**, void *);
-+extern int b_chown (int, char**, void *);
-+extern int b_cksum (int, char**, void *);
-+extern int b_cmp (int, char**, void *);
-+extern int b_comm (int, char**, void *);
-+extern int b_cp (int, char**, void *);
-+extern int b_cut (int, char**, void *);
-+extern int b_date (int, char**, void *);
-+extern int b_dirname (int, char**, void *);
-+extern int b_egrep (int, char**, void *);
-+extern int b_expr (int, char**, void *);
-+extern int b_fds (int, char**, void *);
-+extern int b_fgrep (int, char**, void *);
-+extern int b_find (int, char**, void *);
-+extern int b_fmt (int, char**, void *);
-+extern int b_fold (int, char**, void *);
-+extern int b_getconf (int, char**, void *);
-+extern int b_grep (int, char**, void *);
-+extern int b_head (int, char**, void *);
-+extern int b_id (int, char**, void *);
-+extern int b_join (int, char**, void *);
-+extern int b_line (int, char**, void *);
-+extern int b_ln (int, char**, void *);
-+extern int b_logname (int, char**, void *);
-+extern int b_ls (int, char**, void *);
-+extern int b_md5sum (int, char**, void *);
-+extern int b_mkdir (int, char**, void *);
-+extern int b_mkfifo (int, char**, void *);
-+extern int b_mktemp (int, char**, void *);
-+extern int b_mv (int, char**, void *);
-+extern int b_paste (int, char**, void *);
-+extern int b_od (int, char**, void *);
-+extern int b_pathchk (int, char**, void *);
-+extern int b_pids (int, char**, void *);
-+extern int b_pr (int, char**, void *);
-+extern int b_rev (int, char**, void *);
-+extern int b_readlink (int, char**, void *);
-+extern int b_rm (int, char**, void *);
-+extern int b_rmdir (int, char**, void *);
-+extern int b_stty (int, char**, void *);
-+extern int b_sum (int, char**, void *);
-+extern int b_sync (int, char**, void *);
-+extern int b_strings (int, char**, void *);
-+extern int b_tail (int, char**, void *);
-+extern int b_tee (int, char**, void *);
-+extern int b_tr (int, char**, void *);
-+extern int b_tty (int, char**, void *);
-+extern int b_uname (int, char**, void *);
-+extern int b_uniq (int, char**, void *);
-+extern int b_vmstate (int, char**, void *);
-+extern int b_wc (int, char**, void *);
-+extern int b_who (int, char**, void *);
-+extern int b_xgrep (int, char**, void *);
-+extern int b_xargs (int, char**, void *);
-diff -rupN b/src/cmd/alias/Makefile a/src/cmd/alias/Makefile
---- b/src/cmd/alias/Makefile	1970-01-01 00:00:00.000000000 +0000
-+++ a/src/cmd/alias/Makefile	2011-11-10 16:24:28.357746164 +0000
[email protected]@ -0,0 +1,5 @@
-+:PACKAGE: ast:static
-+
-+LICENSE = cddl
-+libtype = :static
-+alias :: RELEASE alias.c +lshell
--- a/components/librsync/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/librsync/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -43,10 +43,11 @@
 COMPONENT_ARCHIVE_HASH_1=	\
     sha256:e805819272f71b06823ee13f2dd7ddb92e75d75de18c33b7fd32133847c52afe
 COMPONENT_ARCHIVE_URL_1=	$(EXTERNAL_ARCHIVE_MIRROR)/$(COMPONENT_ARCHIVE_1)
+COMPONENT_POST_UNPACK_ACTION_1 = $(MV) $(COMPONENT_NAME_1) $(@D)
 
 TPNO=			9087
 
-CLOBBER_PATHS += $(COMPONENT_NAME_1)
+CLEAN_PATHS += $(COMPONENT_NAME_1)
 
 include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/configure.mk
--- a/components/libtool/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/libtool/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -90,22 +90,6 @@
 $(BUILD_DIR_32)/.installed:	$(BUILD_OLD_DIR_32)/.installed
 $(BUILD_DIR_64)/.installed:	$(BUILD_OLD_DIR_64)/.installed
 
-# we need to prep the old version too (this should be handled in prep.mk)
-$(SOURCE_DIR_1)/.unpacked:        download $(MAKEFILE_PREREQ) $(PATCHES)
-	$(RM) -r $(SOURCE_DIR_1)
-	$(UNPACK) $(UNPACK_ARGS) $(COMPONENT_ARCHIVE_1)
-	$(TOUCH) [email protected]
-
-# prep the old version first
-$(SOURCE_DIR)/.prep:	$(SOURCE_DIR_1)/.prep
-
-$(SOURCE_DIR_1)/.prep:        $(SOURCE_DIR_1)/.unpacked
-	$(TOUCH) [email protected]
-
-prep::	$(SOURCE_DIR_1)/.prep
-
-CLEAN_PATHS += $(SOURCE_DIR_1)
-
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
 # common targets
--- a/components/libusb/ugen/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/libusb/ugen/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -29,6 +29,7 @@
 COMPONENT_SRC=		src
 COMPONENT_BUGDB=	library/libusb
 
+include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/justmake.mk
 include $(WS_MAKE_RULES)/ips.mk
 
@@ -45,17 +46,9 @@
 
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
-download::
-
-clobber:	clean
+clobber::
 	$(RM) $(SOURCE_DIR)/.prep
 
-# common targets
-$(SOURCE_DIR)/.prep:
-	$(TOUCH) [email protected]
-
-prep:	$(SOURCE_DIR)/.prep
-
 build:		$(BUILD_32_and_64)
 
 install:	$(INSTALL_32_and_64)
--- a/components/libusb/wrapper/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/libusb/wrapper/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -31,6 +31,7 @@
 
 TPNO=			9184
 
+include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/justmake.mk
 include $(WS_MAKE_RULES)/ips.mk
 
@@ -44,20 +45,9 @@
 
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
-# common targets
-$(SOURCE_DIR)/.prep:
-	$(TOUCH) [email protected]
-
 $(BUILD_DIR)/libusb-64.pc:	src/libusb-64.pc
 	/bin/sed -e "s#MACH64#$(MACH64)#g" <$< >[email protected]
 
-download::
-
-clobber:	clean
-	$(RM) $(SOURCE_DIR)/.prep
-
-prep:	$(SOURCE_DIR)/.prep
-
 build:		$(BUILD_32_and_64)
 
 install:	$(INSTALL_32_and_64)
--- a/components/meta-packages/developer-opensolaris-userland/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/meta-packages/developer-opensolaris-userland/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -31,6 +31,7 @@
 COMPONENT_ARCHIVE_URL=	http://hg.java.net/solaris-userland-gate/
 COMPONENT_BUGDB=	gate-stuff/userland
 
+include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/ips.mk
 
 $(WS_MACH)/requires.mk:
@@ -45,10 +46,6 @@
 $(BUILD_DIR)/package.list:	$(BUILD_DIR) $(WS_MACH)/requires.mk
 	@echo $(REQUIRED_PACKAGES:%="depend type=require fmri=pkg:/%\\n") >[email protected]
 
-download::
-
-prep:
-
 build install: $(BUILD_DIR)/package.list
 
 test:	$(NO_TESTS)
--- a/components/meta-packages/history/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/meta-packages/history/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -28,6 +28,8 @@
 # really don't need to do for these static, uninteresting packages.  So we just
 # write a simple set of publication rules to get the packages into the repo.
 
+include $(WS_MAKE_RULES)/prep.mk
+
 PKGSEND =	/usr/bin/pkgsend
 PKGLINT =	/usr/bin/pkglint
 PKGMOGRIFY =	/usr/bin/pkgmogrify
@@ -46,8 +48,7 @@
 
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
-download::
-prep build install:
+build install:
 	@echo "nothing to be done for [email protected]"
 
 $(BUILD_DIR):
@@ -79,5 +80,5 @@
 %.p5m: 	%.p5m.$(MACH)
 	$(CP) $< [email protected]
 	
-clobber clean:
+clobber clean::
 	$(RM) -r $(BUILD_DIR) $(GENERATED_ARCH_MANIFESTS)
--- a/components/mysql-common/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/mysql-common/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -27,17 +27,14 @@
 COMPONENT_PROJECT_URL=	http://dev.mysql.com/
 COMPONENT_BUGDB=	database/mysql
 
-include $(WS_MAKE_RULES)/configure.mk
+include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/ips.mk
 
 # ASLR Mode should be set as not applicable
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
 # nothing to download or build; just package
-download::
-prep configure build install test:
-
-clobber:	clean
+build install test:
 
 REQUIRED_PACKAGES += shell/ksh93
 REQUIRED_PACKAGES += system/core-os
--- a/components/open-fabrics/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/open-fabrics/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -57,8 +57,10 @@
 
 .PHONY:	$(SUBDIRS)
 
-download:		TARGET = download
-prep:			TARGET = prep
+download::		TARGET = download
+unpack::		TARGET = unpack
+patch::			TARGET = patch
+prep::			TARGET = prep
 install:		TARGET = install
 clean:			TARGET = clean
 clobber:		TARGET = clobber
@@ -69,16 +71,16 @@
 
 .DEFAULT:	publish
 
-download::
-prep install test: $(SUBDIRS)
+download unpack patch prep::	$(SUBDIRS)
+install test: $(SUBDIRS)
 
 parfait:
 	$(MAKE) PARFAIT_BUILD=yes install
 
-clean:	$(SUBDIRS)
+clean::	$(SUBDIRS)
 	$(RM) -r prototype build
 
-clobber:	$(SUBDIRS) clean
+clobber::	$(SUBDIRS) clean
 
 $(SUBDIRS):	FORCE
 	@cd [email protected] && echo "$(TARGET) [email protected]" && $(MAKE) $(TARGET)
--- a/components/openstack/common/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/openstack/common/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -30,6 +30,7 @@
 COMPONENT_PROJECT_URL=	http://www.openstack.org/
 IPS_COMPONENT_VERSION=	0.$(COMPONENT_VERSION)
 
+include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/ips.mk
 
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
@@ -37,10 +38,6 @@
 # Do not apply the standard license transforms for this component.
 LICENSE_TRANSFORMS =
 
-# common targets
-prep:
-	$(TOUCH) [email protected]
-
 build:		FRC
 	@/bin/true
 
--- a/components/openstack/horizon/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/openstack/horizon/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -68,16 +68,12 @@
 TPNO_RICKSHAW=		20673
 TPNO_SPIN=		20674
 
-NUM_EXTRA_ARCHIVES=	1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
-
 #
 # Starting with Juno, Horizon depends on a number of XStatic modules
 # to deliver the required JavaScript modules.  This delivery method
 # may be changing in future releases, so the XStatic modules for now
 # are built as part of Horizon rather than being stand alone
-# components/packages.  The NUM_EXTRA_ARCHIVES parameter should
-# enumerate the numbers of all the extra XStatic archives to be
-# included in the Horizon build.
+# components/packages.
 #
 # XStatic itself is only used during the build process and so while it
 # is downloaded and installed in the proto area, none of its
@@ -85,14 +81,16 @@
 #
 COMPONENT_NAME_1 =	XStatic
 VERSION_XSTATIC =	1.0.1
-COMPONENT_ARCHIVE_1 =	XStatic-$(VERSION_XSTATIC).tar.gz
+COMPONENT_SRC_1 =	XStatic-$(VERSION_XSTATIC)
+COMPONENT_ARCHIVE_1 =	$(COMPONENT_SRC_1).tar.gz
 COMPONENT_ARCHIVE_HASH_1 = \
 	sha256:0ec93d7c66ebb9e0d31b664753437dc8634cb66e13310cb47c9eb1e0bc66d726
 COMPONENT_ARCHIVE_URL_1 = $(call pypi_url,1)
 
 COMPONENT_NAME_2 =	XStatic-Angular
 VERSION_ANGULAR =	1.3.7.0
-COMPONENT_ARCHIVE_2 =	XStatic-Angular-$(VERSION_ANGULAR).tar.gz
+COMPONENT_SRC_2 =	XStatic-Angular-$(VERSION_ANGULAR)
+COMPONENT_ARCHIVE_2 =	$(COMPONENT_SRC_2).tar.gz
 COMPONENT_ARCHIVE_HASH_2 = \
 	sha256:7cad216b226399cbe8d2909ed5b9f28d724907b9c9e1e078e6e25d320a3d5dd7
 COMPONENT_ARCHIVE_URL_2 = $(call pypi_url,2)
@@ -100,7 +98,8 @@
 
 COMPONENT_NAME_3 =	XStatic-Bootstrap-Datepicker
 VERSION_BOOTSTRAP_DP=	1.3.1.0
-COMPONENT_ARCHIVE_3 =	XStatic-Bootstrap-Datepicker-$(VERSION_BOOTSTRAP_DP).tar.gz
+COMPONENT_SRC_3 =	XStatic-Bootstrap-Datepicker-$(VERSION_BOOTSTRAP_DP)
+COMPONENT_ARCHIVE_3 =	$(COMPONENT_SRC_3).tar.gz
 COMPONENT_ARCHIVE_HASH_3 = \
 	sha256:9edc9b77501001fcee9fbf4bf0a722c263efd928ef928b40081a8269fdd9a944
 COMPONENT_ARCHIVE_URL_3 = $(call pypi_url,3)
@@ -108,7 +107,8 @@
 
 COMPONENT_NAME_4 =	XStatic-Bootstrap-SCSS
 VERSION_BOOTSTRAP_SCSS=	3.2.0.0
-COMPONENT_ARCHIVE_4 =	XStatic-Bootstrap-SCSS-$(VERSION_BOOTSTRAP_SCSS).tar.gz
+COMPONENT_SRC_4 =	XStatic-Bootstrap-SCSS-$(VERSION_BOOTSTRAP_SCSS)
+COMPONENT_ARCHIVE_4 =	$(COMPONENT_SRC_4).tar.gz
 COMPONENT_ARCHIVE_HASH_4 = \
 	sha256:7e9858737e2e6aac921ec7a3fca627e522901c3061611e154ebc0b8a892c7018
 COMPONENT_ARCHIVE_URL_4 = $(call pypi_url,4)
@@ -116,7 +116,8 @@
 
 COMPONENT_NAME_5 =	XStatic-D3
 VERSION_D3 =		3.1.6.2
-COMPONENT_ARCHIVE_5 =	XStatic-D3-$(VERSION_D3).tar.gz
+COMPONENT_SRC_5 =	XStatic-D3-$(VERSION_D3)
+COMPONENT_ARCHIVE_5 =	$(COMPONENT_SRC_5).tar.gz
 COMPONENT_ARCHIVE_HASH_5 = \
 	sha256:46fe521f8dad99f5e20f6702180510c37b81d11f1d78119d308fcec31381f90e
 COMPONENT_ARCHIVE_URL_5 = $(call pypi_url,5)
@@ -124,7 +125,8 @@
 
 COMPONENT_NAME_6 =	XStatic-Font-Awesome
 VERSION_FONT_AWESOME =	4.2.0.0
-COMPONENT_ARCHIVE_6 =	XStatic-Font-Awesome-$(VERSION_FONT_AWESOME).tar.gz
+COMPONENT_SRC_6 =	XStatic-Font-Awesome-$(VERSION_FONT_AWESOME)
+COMPONENT_ARCHIVE_6 =	$(COMPONENT_SRC_6).tar.gz
 COMPONENT_ARCHIVE_HASH_6 = \
 	sha256:b7fdbf1ed316f3a207eeb9ee1c052820e55b4e31d247d81c8ea059e21f555a73
 COMPONENT_ARCHIVE_URL_6 = $(call pypi_url,6)
@@ -132,7 +134,8 @@
 
 COMPONENT_NAME_7 =	XStatic-Hogan
 VERSION_HOGAN =		2.0.0.2
-COMPONENT_ARCHIVE_7 =	XStatic-Hogan-$(VERSION_HOGAN).tar.gz
+COMPONENT_SRC_7 =	XStatic-Hogan-$(VERSION_HOGAN)
+COMPONENT_ARCHIVE_7 =	$(COMPONENT_SRC_7).tar.gz
 COMPONENT_ARCHIVE_HASH_7 = \
 	sha256:5941bc7fb2a09916b8837848e6fc2a13b2dfc271811e9b522c61e1337d5fc2bd
 COMPONENT_ARCHIVE_URL_7 = $(call pypi_url,7)
@@ -140,7 +143,8 @@
 
 COMPONENT_NAME_8 =	XStatic-jQuery
 VERSION_JQUERY =	1.10.2.1
-COMPONENT_ARCHIVE_8 =	XStatic-jQuery-$(VERSION_JQUERY).tar.gz
+COMPONENT_SRC_8 =	XStatic-jQuery-$(VERSION_JQUERY)
+COMPONENT_ARCHIVE_8 =	$(COMPONENT_SRC_8).tar.gz
 COMPONENT_ARCHIVE_HASH_8 = \
 	sha256:83416a6bb86e8534858c4d1ddca45e881c87639da6f78000c28c3a193fe91305
 COMPONENT_ARCHIVE_URL_8 = $(call pypi_url,8)
@@ -148,7 +152,8 @@
 
 COMPONENT_NAME_9 =	XStatic-JQuery-Migrate
 VERSION_JQUERY_MIGRATE=	1.2.1.1
-COMPONENT_ARCHIVE_9 =	XStatic-JQuery-Migrate-$(VERSION_JQUERY_MIGRATE).tar.gz
+COMPONENT_SRC_9 =	XStatic-JQuery-Migrate-$(VERSION_JQUERY_MIGRATE)
+COMPONENT_ARCHIVE_9 =	$(COMPONENT_SRC_9).tar.gz
 COMPONENT_ARCHIVE_HASH_9 = \
 	sha256:e2959b3df49afdddb00d36b74cca727a91b994b9f4edb993d7264731a750900e
 COMPONENT_ARCHIVE_URL_9 = $(call pypi_url,9)
@@ -156,7 +161,8 @@
 
 COMPONENT_NAME_10 =	XStatic-jquery-ui
 VERSION_JQUERY_UI =	1.11.0.1
-COMPONENT_ARCHIVE_10 =	XStatic-jquery-ui-$(VERSION_JQUERY_UI).tar.gz
+COMPONENT_SRC_10 =	XStatic-jquery-ui-$(VERSION_JQUERY_UI)
+COMPONENT_ARCHIVE_10 =	$(COMPONENT_SRC_10).tar.gz
 COMPONENT_ARCHIVE_HASH_10 = \
 	sha256:099b1836eb0d91b8dc98f5b8a6b856a2631d43af0d47f33ef90ee72ed37bda58
 COMPONENT_ARCHIVE_URL_10 = $(call pypi_url,10)
@@ -164,7 +170,8 @@
 
 COMPONENT_NAME_11 =	XStatic-JQuery.quicksearch
 VERSION_JQUERY_QS =	2.0.3.1
-COMPONENT_ARCHIVE_11 =	XStatic-JQuery.quicksearch-$(VERSION_JQUERY_QS).tar.gz
+COMPONENT_SRC_11 =	XStatic-JQuery.quicksearch-$(VERSION_JQUERY_QS)
+COMPONENT_ARCHIVE_11 =	$(COMPONENT_SRC_11).tar.gz
 COMPONENT_ARCHIVE_HASH_11 = \
 	sha256:1271571b420417add56c274fd935e81bfc79e0d54a03559d6ba5ef369f358477
 COMPONENT_ARCHIVE_URL_11 = $(call pypi_url,11)
@@ -172,7 +179,8 @@
 
 COMPONENT_NAME_12 =	XStatic-JQuery.TableSorter
 VERSION_JQUERY_TS =	2.14.5.1
-COMPONENT_ARCHIVE_12 =	XStatic-JQuery.TableSorter-$(VERSION_JQUERY_TS).tar.gz
+COMPONENT_SRC_12 =	XStatic-JQuery.TableSorter-$(VERSION_JQUERY_TS)
+COMPONENT_ARCHIVE_12 =	$(COMPONENT_SRC_12).tar.gz
 COMPONENT_ARCHIVE_HASH_12 = \
 	sha256:3ba24aecd9a3dc71a79dd4096fa5a8a041c3a7b892c61d05e6e46de0605070f0
 COMPONENT_ARCHIVE_URL_12 = $(call pypi_url,12)
@@ -180,7 +188,8 @@
 
 COMPONENT_NAME_13 =	XStatic-JSEncrypt
 VERSION_JSENCRYPT =	2.0.0.2
-COMPONENT_ARCHIVE_13 =	XStatic-JSEncrypt-$(VERSION_JSENCRYPT).tar.gz
+COMPONENT_SRC_13 =	XStatic-JSEncrypt-$(VERSION_JSENCRYPT)
+COMPONENT_ARCHIVE_13 =	$(COMPONENT_SRC_13).tar.gz
 COMPONENT_ARCHIVE_HASH_13 = \
 	sha256:5852892afc6f80c7848f4110b6dad190a54aeb908271d67aaeae9d966f4a26b5
 COMPONENT_ARCHIVE_URL_13 = $(call pypi_url,13)
@@ -188,7 +197,8 @@
 
 COMPONENT_NAME_14 =	XStatic-Rickshaw
 VERSION_RICKSHAW =	1.5.0.0
-COMPONENT_ARCHIVE_14 =	XStatic-Rickshaw-$(VERSION_RICKSHAW).tar.gz
+COMPONENT_SRC_14 =	XStatic-Rickshaw-$(VERSION_RICKSHAW)
+COMPONENT_ARCHIVE_14 =	$(COMPONENT_SRC_14).tar.gz
 COMPONENT_ARCHIVE_HASH_14 = \
 	sha256:147574228757254442700a9eea5150f14acb1224ef0612f896b663ab58406de8
 COMPONENT_ARCHIVE_URL_14 = $(call pypi_url,14)
@@ -196,7 +206,8 @@
 
 COMPONENT_NAME_15 =	XStatic-Spin
 VERSION_SPIN =		1.2.5.2
-COMPONENT_ARCHIVE_15 =	XStatic-Spin-$(VERSION_SPIN).tar.gz
+COMPONENT_SRC_15 =	XStatic-Spin-$(VERSION_SPIN)
+COMPONENT_ARCHIVE_15 =	$(COMPONENT_SRC_15).tar.gz
 COMPONENT_ARCHIVE_HASH_15 = \
 	sha256:7f46ef0e45e047019ba6eda22c432fb96f681b97bbe7f1749aa9209e07727192
 COMPONENT_ARCHIVE_URL_15 = $(call pypi_url,15)
@@ -257,7 +268,7 @@
 # xstatic imports for static asset collection.
 COMPONENT_POST_INSTALL_ACTION += \
 	 $(GPATCH) -d $(PROTO_DIR) $(GPATCH_FLAGS) \
-	     < patches/99-remove.xstatic.patch
+	     < patches/99-remove.xstatic.patch-proto
 
 #
 # The xstatic target builds each XStatic component alongside Horizon.
--- a/components/openstack/horizon/patches/99-remove.xstatic.patch	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-In-house patch to remove the imports of xstatic packages.  These
-imports are no longer needed as the static assets are collected at
-package time and the xstatic modules are not being delivered.
-
-NOTE:  This patch is applied AFTER gmake install has completed rather
-than during gmake prep.  We need the xstatic functionality to collect
-all the JavaScript libraries before packaging.
-
---- a/usr/lib/python2.7/vendor-packages/openstack_dashboard/settings.py	2015-01-13 10:40:30.930622964 -0700
-+++ b/usr/lib/python2.7/vendor-packages/openstack_dashboard/settings.py	2015-01-13 10:40:57.470743881 -0700
[email protected]@ -22,21 +22,6 @@ import sys
- import warnings
-
- from django.utils.translation import ugettext_lazy as _
--import xstatic.main
--import xstatic.pkg.angular
--import xstatic.pkg.bootstrap_datepicker
--import xstatic.pkg.bootstrap_scss
--import xstatic.pkg.d3
--import xstatic.pkg.font_awesome
--import xstatic.pkg.hogan
--import xstatic.pkg.jquery
--import xstatic.pkg.jquery_migrate
--import xstatic.pkg.jquery_quicksearch
--import xstatic.pkg.jquery_tablesorter
--import xstatic.pkg.jquery_ui
--import xstatic.pkg.jsencrypt
--import xstatic.pkg.rickshaw
--import xstatic.pkg.spin
-
- from openstack_dashboard import exceptions
-
[email protected]@ -148,45 +133,6 @@ STATICFILES_FINDERS = (
-     'compressor.finders.CompressorFinder',
- )
-
--STATICFILES_DIRS = [
--    ('horizon/lib/angular',
--        xstatic.main.XStatic(xstatic.pkg.angular).base_dir),
--    ('horizon/lib/bootstrap_datepicker',
--        xstatic.main.XStatic(xstatic.pkg.bootstrap_datepicker).base_dir),
--    ('bootstrap',
--        xstatic.main.XStatic(xstatic.pkg.bootstrap_scss).base_dir),
--    ('horizon/lib',
--        xstatic.main.XStatic(xstatic.pkg.d3).base_dir),
--    ('horizon/lib',
--        xstatic.main.XStatic(xstatic.pkg.hogan).base_dir),
--    ('horizon/lib/font-awesome',
--        xstatic.main.XStatic(xstatic.pkg.font_awesome).base_dir),
--    ('horizon/lib/jquery',
--        xstatic.main.XStatic(xstatic.pkg.jquery).base_dir),
--    ('horizon/lib/jquery',
--        xstatic.main.XStatic(xstatic.pkg.jquery_migrate).base_dir),
--    ('horizon/lib/jquery',
--        xstatic.main.XStatic(xstatic.pkg.jquery_quicksearch).base_dir),
--    ('horizon/lib/jquery',
--        xstatic.main.XStatic(xstatic.pkg.jquery_tablesorter).base_dir),
--    ('horizon/lib/jsencrypt',
--        xstatic.main.XStatic(xstatic.pkg.jsencrypt).base_dir),
--    ('horizon/lib',
--        xstatic.main.XStatic(xstatic.pkg.rickshaw).base_dir),
--    ('horizon/lib',
--        xstatic.main.XStatic(xstatic.pkg.spin).base_dir),
--]
--
--
--if xstatic.main.XStatic(xstatic.pkg.jquery_ui).version.startswith('1.10.'):
--    # The 1.10.x versions already contain the 'ui' directory.
--    STATICFILES_DIRS.append(('horizon/lib/jquery-ui',
--        xstatic.main.XStatic(xstatic.pkg.jquery_ui).base_dir))
--else:
--    # Newer versions dropped the directory, add it to keep the path the same.
--    STATICFILES_DIRS.append(('horizon/lib/jquery-ui/ui',
--        xstatic.main.XStatic(xstatic.pkg.jquery_ui).base_dir))
--
- COMPRESS_PRECOMPILERS = (
-     ('text/scss', 'django_pyscss.compressor.DjangoScssFilter'),
- )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openstack/horizon/patches/99-remove.xstatic.patch-proto	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,78 @@
+In-house patch to remove the imports of xstatic packages.  These
+imports are no longer needed as the static assets are collected at
+package time and the xstatic modules are not being delivered.
+
+NOTE:  This patch is applied AFTER gmake install has completed rather
+than during gmake prep.  We need the xstatic functionality to collect
+all the JavaScript libraries before packaging.
+
+--- a/usr/lib/python2.7/vendor-packages/openstack_dashboard/settings.py	2015-01-13 10:40:30.930622964 -0700
++++ b/usr/lib/python2.7/vendor-packages/openstack_dashboard/settings.py	2015-01-13 10:40:57.470743881 -0700
[email protected]@ -22,21 +22,6 @@ import sys
+ import warnings
+
+ from django.utils.translation import ugettext_lazy as _
+-import xstatic.main
+-import xstatic.pkg.angular
+-import xstatic.pkg.bootstrap_datepicker
+-import xstatic.pkg.bootstrap_scss
+-import xstatic.pkg.d3
+-import xstatic.pkg.font_awesome
+-import xstatic.pkg.hogan
+-import xstatic.pkg.jquery
+-import xstatic.pkg.jquery_migrate
+-import xstatic.pkg.jquery_quicksearch
+-import xstatic.pkg.jquery_tablesorter
+-import xstatic.pkg.jquery_ui
+-import xstatic.pkg.jsencrypt
+-import xstatic.pkg.rickshaw
+-import xstatic.pkg.spin
+
+ from openstack_dashboard import exceptions
+
[email protected]@ -148,45 +133,6 @@ STATICFILES_FINDERS = (
+     'compressor.finders.CompressorFinder',
+ )
+
+-STATICFILES_DIRS = [
+-    ('horizon/lib/angular',
+-        xstatic.main.XStatic(xstatic.pkg.angular).base_dir),
+-    ('horizon/lib/bootstrap_datepicker',
+-        xstatic.main.XStatic(xstatic.pkg.bootstrap_datepicker).base_dir),
+-    ('bootstrap',
+-        xstatic.main.XStatic(xstatic.pkg.bootstrap_scss).base_dir),
+-    ('horizon/lib',
+-        xstatic.main.XStatic(xstatic.pkg.d3).base_dir),
+-    ('horizon/lib',
+-        xstatic.main.XStatic(xstatic.pkg.hogan).base_dir),
+-    ('horizon/lib/font-awesome',
+-        xstatic.main.XStatic(xstatic.pkg.font_awesome).base_dir),
+-    ('horizon/lib/jquery',
+-        xstatic.main.XStatic(xstatic.pkg.jquery).base_dir),
+-    ('horizon/lib/jquery',
+-        xstatic.main.XStatic(xstatic.pkg.jquery_migrate).base_dir),
+-    ('horizon/lib/jquery',
+-        xstatic.main.XStatic(xstatic.pkg.jquery_quicksearch).base_dir),
+-    ('horizon/lib/jquery',
+-        xstatic.main.XStatic(xstatic.pkg.jquery_tablesorter).base_dir),
+-    ('horizon/lib/jsencrypt',
+-        xstatic.main.XStatic(xstatic.pkg.jsencrypt).base_dir),
+-    ('horizon/lib',
+-        xstatic.main.XStatic(xstatic.pkg.rickshaw).base_dir),
+-    ('horizon/lib',
+-        xstatic.main.XStatic(xstatic.pkg.spin).base_dir),
+-]
+-
+-
+-if xstatic.main.XStatic(xstatic.pkg.jquery_ui).version.startswith('1.10.'):
+-    # The 1.10.x versions already contain the 'ui' directory.
+-    STATICFILES_DIRS.append(('horizon/lib/jquery-ui',
+-        xstatic.main.XStatic(xstatic.pkg.jquery_ui).base_dir))
+-else:
+-    # Newer versions dropped the directory, add it to keep the path the same.
+-    STATICFILES_DIRS.append(('horizon/lib/jquery-ui/ui',
+-        xstatic.main.XStatic(xstatic.pkg.jquery_ui).base_dir))
+-
+ COMPRESS_PRECOMPILERS = (
+     ('text/scss', 'django_pyscss.compressor.DjangoScssFilter'),
+ )
--- a/components/patch/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#
-# 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 (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
-#
-
-include ../../make-rules/shared-macros.mk
-
-COMPONENT_NAME=		patch
-COMPONENT_VERSION=	2.7.1
-COMPONENT_PROJECT_URL=	http://www.gnu.org/software/patch/
-COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
-COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
-COMPONENT_ARCHIVE_HASH=	\
-    sha256:c05f28668c3474bc63adcd48abae921d15e71c254fbebdbaeda40456d64039d5
-COMPONENT_ARCHIVE_URL=	http://ftp.gnu.org/gnu/patch/$(COMPONENT_ARCHIVE)
-COMPONENT_BUGDB=	utility/gpatch
-
-TPNO=			18936
-
-include $(WS_MAKE_RULES)/prep.mk
-include $(WS_MAKE_RULES)/configure.mk
-include $(WS_MAKE_RULES)/ips.mk
-
-CONFIGURE_OPTIONS  +=		CFLAGS="$(CFLAGS)"
-
-COMPONENT_INSTALL_ARGS += bindir=$(USRBINDIR)
-
-ASLR_MODE = $(ASLR_ENABLE)
-
-# common targets
-configure:	$(CONFIGURE_64)
-
-build:		$(BUILD_64)
-
-install:	$(INSTALL_64)
-
-test:		$(TEST_64)
-
-
-REQUIRED_PACKAGES += system/library
--- a/components/patch/patch.license	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,340 +0,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year  name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
--- a/components/patch/patch.p5m	Mon Apr 13 09:25:17 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-#
-# 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 (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
-#
-
-<transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted>
-set name=pkg.fmri \
-    value=pkg:/text/[email protected]$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
-set name=pkg.summary value="The GNU Patch utility"
-set name=com.oracle.info.description value="GNU patch"
-set name=com.oracle.info.tpno value=$(TPNO)
-set name=info.classification value=org.opensolaris.category.2008:Development/GNU
-set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
-set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
-set name=org.opensolaris.arc-caseid value=PSARC/1999/555 value=PSARC/2014/324
-set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
-link path=usr/bin/gpatch target=../gnu/bin/patch facet.compat.gnulinks=true
-link path=usr/bin/patch target=../gnu/bin/patch
-file usr/bin/patch path=usr/gnu/bin/patch
-file usr/share/man/man1/patch.1 path=usr/gnu/share/man/man1/patch.1
-link path=usr/share/man/man1/gpatch.1 \
-    target=../../../gnu/share/man/man1/patch.1 facet.compat.gnulinks=all
-link path=usr/share/man/man1/patch.1 target=../../../gnu/share/man/man1/patch.1
-legacy pkg=SUNWgpch desc="The GNU Patch utility" name="The GNU Patch utility"
-license patch.license license=GPLv2
--- a/components/php-5_3/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/php-5_3/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -153,6 +153,8 @@
 .PHONY:	$(SUBDIRS)
 
 download:		TARGET = download
+unpack:			TARGET = unpack
+patch:			TARGET = patch
 prep:			TARGET = prep
 install:		TARGET = install
 clean:			TARGET = clean
@@ -164,13 +166,13 @@
 
 .DEFAULT:	publish
 
-download::	$(SUBDIRS)
-prep install test publish: $(SUBDIRS)
+download unpack patch prep::	$(SUBDIRS)
+install test publish: $(SUBDIRS)
 
-clean:		$(SUBDIRS)
+clean::		$(SUBDIRS)
 	$(RM) -r $(BUILD_DIR)
 
-clobber:	$(SUBDIRS) clean
+clobber::	$(SUBDIRS) clean
 
 $(SUBDIRS):	FORCE
 	@cd [email protected] && echo "$(TARGET) [email protected]" && $(MAKE) $(TARGET)
--- a/components/php-5_3/php-sapi/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/php-5_3/php-sapi/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -45,6 +45,7 @@
 COMPONENT_ARCHIVE_1=    $(COMPONENT_SRC_1).tar.gz
 COMPONENT_ARCHIVE_HASH_1= \
     sha256:4c5d45e5f49bb164d40154fdef57b3193e7b77e306055559e60615c8ca9a3c30
+COMPONENT_POST_UNPACK_ACTION_1= $(MV) php-chunked-xhtml $(@D)
 #
 # This next download URL is completely hocus pocus.
 # php.net does not freeze their documentation to match the software versions.
--- a/components/php-5_3/php-sapi/php.mk	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/php-5_3/php-sapi/php.mk	Mon Apr 27 10:19:50 2015 -0500
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
 COMPONENT_PRE_INSTALL_ACTION += ( \
@@ -38,8 +38,6 @@
 	      $(COMPONENT_SRC)/Zend/zend_language_parser.h \
 	      $(COMPONENT_SRC)/Zend/zend_language_parser.output )
 
-PATCHES = $(shell cd $(PATCH_DIR); echo [0-9]* $$(MACH)* )
-
 COMPONENT_PRE_CONFIGURE_ACTION = ( \
 	set -e; \
 	cd $(COMPONENT_SRC); $(ENV) -i PATH=/usr/gnu/bin:$(PATH) \
--- a/components/php-common/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/php-common/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -27,7 +27,7 @@
 COMPONENT_VERSION=	11.1
 COMPONENT_PROJECT_URL=	http://www.php.net/
 COMPONENT_BUGDB=	utility/php
-include $(WS_MAKE_RULES)/configure.mk
+include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/ips.mk
 
 # Do not apply the standard license transforms for this component. The
@@ -36,10 +36,6 @@
 
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
-# nothing to download or build; just package
-download::
-prep configure build install test:
-
-clobber:	clean
+configure build install test:
 
 REQUIRED_PACKAGES += system/linker
--- a/components/ruby/ruby-common/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/ruby/ruby-common/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -28,11 +28,9 @@
 COMPONENT_PROJECT_URL=	http://www.ruby-lang.org/
 COMPONENT_BUGDB=	utility/ruby
 
-include $(WS_MAKE_RULES)/configure.mk
+include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/ips.mk
 
 # nothing to download or build; just publish the package
-download::
-prep configure build install test:
+build install test:
 
-clobber:	clean
--- a/components/timezone/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/timezone/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -39,18 +39,13 @@
 	 factory northamerica pacificnew \
 	 southamerica backward
 
+include $(WS_MAKE_RULES)/prep.mk
 include $(WS_MAKE_RULES)/ips.mk
 
 POFILE=zoneinfo.po
 
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
-download::
-	@echo "Nothing to download."
-
-prep:
-	@echo "Nothing to prep."
-
 build:
 	@/bin/sh ./do_pofile.sh > $(POFILE)
 
@@ -60,7 +55,5 @@
 # empty test target
 test:	$(NO_TESTS)
 
-clean:
+clean::
 	$(RM) -r $(BUILD_DIR) $(POFILE)
-
-clobber: clean
--- a/components/vim/Makefile	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/vim/Makefile	Mon Apr 27 10:19:50 2015 -0500
@@ -29,14 +29,12 @@
 
 COMPONENT_NAME=		vim
 COMPONENT_VERSION=	7.4
-IPS_COMPONENT_VERSION=	$(shell echo $(COMPONENT_HG_REV) | sed -e 's/-/./g' -e 's/v//')
-COMPONENT_SRC=		vim-$(COMPONENT_HG_REV)
+IPS_COMPONENT_VERSION=	$(shell echo $(HG_REV) | sed -e 's/-/./g' -e 's/v//')
+# COMPONENT_SRC* is autodefined by the prep-{SCM} Makefile fragment
 COMPONENT_PROJECT_URL=	http://www.vim.org/
-COMPONENT_ARCHIVE=	vim-$(COMPONENT_HG_REV).tar.bz2
-COMPONENT_ARCHIVE_URL=	$(EXTERNAL_ARCHIVE_MIRROR)/$(COMPONENT_ARCHIVE)
-COMPONENT_ARCHIVE_HASH=	sha256:e7f4f411d9ff4c9dbf0ec57cc5da2e9d5e586e69fe3d69f31cbce9118e443507
-COMPONENT_HG_URL=	https://vim.googlecode.com/hg
-COMPONENT_HG_REV=	v7-4
+
+HG_REPO=	https://vim.googlecode.com/hg
+HG_REV=		v7-4
 
 COMPONENT_BUGDB=	utility/vim
 
@@ -46,32 +44,11 @@
 include $(WS_MAKE_RULES)/configure.mk
 include $(WS_MAKE_RULES)/ips.mk
 
-HGREPODIR=		$(COMPONENT_NAME).hg
-TARBALLDIR=		$(COMPONENT_NAME)-$(COMPONENT_HG_REV)
-
-$(HGREPODIR)/.hg:
-	hg clone -U $(COMPONENT_HG_URL) $(@D)
-
-# Create the tarball.
-hgball: $(HGREPODIR)/.hg
-	cd $(HGREPODIR); \
-	hg pull; \
-	if [[ -n "$(COMPONENT_HG_NEWREV)" ]]; then \
-		newrev=$(COMPONENT_HG_NEWREV); \
-	else \
-		newrev=$$(hg tags | awk '$$1 ~ /^v7-/ {print $$1; exit}'); \
-	fi; \
-	hg archive -p vim-$$newrev -r $$newrev ../vim-$$newrev.tar.bz2; \
-	hg stat -ar --rev $(COMPONENT_HG_REV):$$newrev runtime src/po; \
-	digest=$$(digest -a sha256 ../vim-$$newrev.tar.bz2); \
-	$(GSED) -i \
-		-e "s/^COMPONENT_ARCHIVE_HASH=.*/COMPONENT_ARCHIVE_HASH=	sha256:$$digest/" \
-		-e "s/^COMPONENT_HG_REV=.*/COMPONENT_HG_REV=	$$newrev/" \
-		../Makefile
-
 PATCH_LEVEL =	0
 
 PKG_MACROS +=	VIMVER=vim74
+PKG_MACROS +=	HG_REPO=$(HG_REPO)
+PKG_MACROS +=	HG_REV=$(HG_REV)
 
 ASLR_MODE =	$(ASLR_ENABLE)
 
--- a/components/vim/gvim.p5m	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/vim/gvim.p5m	Mon Apr 27 10:19:50 2015 -0500
@@ -33,8 +33,8 @@
 set name=info.classification \
     value=org.opensolaris.category.2008:Development/Editors \
     value="org.opensolaris.category.2008:System/Text Tools"
-set name=info.repository-changeset value=$(COMPONENT_HG_REV)
-set name=info.repository-url value=$(COMPONENT_HG_URL)
+set name=info.repository-changeset value=$(HG_REV)
+set name=info.repository-url value=$(HG_REPO)
 set name=info.upstream [email protected]
 set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
 set name=org.opensolaris.arc-caseid value=PSARC/2007/267 value=PSARC/2008/546
--- a/components/vim/vim-core.p5m	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/vim/vim-core.p5m	Mon Apr 27 10:19:50 2015 -0500
@@ -34,8 +34,8 @@
 set name=info.classification \
     value=org.opensolaris.category.2008:Development/Editors \
     value="org.opensolaris.category.2008:System/Text Tools"
-set name=info.repository-changeset value=$(COMPONENT_HG_REV)
-set name=info.repository-url value=$(COMPONENT_HG_URL)
+set name=info.repository-changeset value=$(HG_REV)
+set name=info.repository-url value=$(HG_REPO)
 set name=info.upstream [email protected]
 set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
 set name=org.opensolaris.arc-caseid value=PSARC/2007/267
--- a/components/vim/vim.p5m	Mon Apr 13 09:25:17 2015 -0500
+++ b/components/vim/vim.p5m	Mon Apr 27 10:19:50 2015 -0500
@@ -34,8 +34,8 @@
 set name=info.classification \
     value=org.opensolaris.category.2008:Development/Editors \
     value="org.opensolaris.category.2008:System/Text Tools"
-set name=info.repository-changeset value=$(COMPONENT_HG_REV)
-set name=info.repository-url value=$(COMPONENT_HG_URL)
+set name=info.repository-changeset value=$(HG_REV)
+set name=info.repository-url value=$(HG_REPO)
 set name=info.upstream [email protected]
 set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
 set name=org.opensolaris.arc-caseid value=PSARC/2007/267
--- a/doc/makefile-targets.txt	Mon Apr 13 09:25:17 2015 -0500
+++ b/doc/makefile-targets.txt	Mon Apr 27 10:19:50 2015 -0500
@@ -19,7 +19,7 @@
   build machines as those are managed by dedicated staff.
 
 download::
-  This target must be present in all Makefiles.  It can be used at the top level
+  This target is present in all Makefiles.  It can be used at the top level
   to act across all components, or on an individual component basis.  It is
   typically defined by including $(WS_MAKE_RULES)/prep.mk in your component
   Makefile.  This target depends on your component Makefile, so changes to your
@@ -29,12 +29,28 @@
   macro should only be used in the calling environment via something like:
     $ gmake MAKEFILE_PREREQ= install
 
+unpack::
+  This target is present in all Makefiles.  It can be used at the top level
+  to act across all components, or on an individual component basis.  It is
+  typically defined by including $(WS_MAKE_RULES)/prep.mk in your component
+  Makefile.  This target depends on the previously described "download" target,
+  This target will unpack any downloaded source archives.  It is an interim
+  step in the source code preparation phase of the build.
+
+patch::
+  This target is present in all Makefiles.  It can be used at the top level
+  to act across all components, or on an individual component basis.  It is
+  typically defined by including $(WS_MAKE_RULES)/prep.mk in your component
+  Makefile.  This target depends on the previously described "unpack" target,
+  This target will patch any unpacked source.  It is an interim step in the
+  source code preparation phase of the build.
+
 prep::
-  This target must be present in all Makefiles.  It can be used at the top level
+  This target is present in all Makefiles.  It can be used at the top level
   to act across all components, or on an individual component basis.  It is 
   typically defined by including $(WS_MAKE_RULES)/prep.mk in your component
   Makefile.  It depends on the previously described "download" target, as well
-  as internal interum targets to unpack source archives and apply patches to
+  as internal interim targets to unpack source archives and apply patches to
   the unpacked source.
 
 configure:
@@ -74,22 +90,22 @@
   necessary to pkglint the manifests for a component.
 
 publish::
-  This target must be present in all Makefiles.  It can be used at the top level
+  This target is present in all Makefiles.  It can be used at the top level
   to act across all components, or on an individual component basis.  It is
-  often automatically defined by including $(WS_MAKE_RULES)/prep.mk.  It depends
+  automatically defined by including $(WS_MAKE_RULES)/ips.mk.  It depends
   on the previously described 'install' target and will perform a series of
   internal, intermediate steps to use the component package manifests to
   generate and publish packages for that component.
 
 clean::
-  This target must be present in all Makefiles.  It can be used at the top level
+  This target is present in all Makefiles.  It can be used at the top level
   to act across all components, or on an individual component basis.  It is
   often automatically defined by including one of the $(WS_MAKE_RULES)
   Makefile fragments.  It cleans up any files created by building the component
   with the exception of any downloaded files.
 
 clobber::
-  This target must be present in all Makefiles.  It can be used at the top level
+  This target is present in all Makefiles.  It can be used at the top level
   to act across all components, or on an individual component basis.  It is
   often automatically defined by including one of the $(WS_MAKE_RULES)
   Makefile fragments.  It depends on the previously described 'clean' target
--- a/doc/makefile-variables.txt	Mon Apr 13 09:25:17 2015 -0500
+++ b/doc/makefile-variables.txt	Mon Apr 27 10:19:50 2015 -0500
@@ -35,6 +35,31 @@
 * REQUIRED_PACKAGES is a list of packages required to build or run the
   component and its tests.
 
+* GIT_REPO can be used in place of COMPONENT_ARCHIVE_URL to pull the component
+  source from the GIT repository referenced in the value.
+* GIT_REV is the tag or changeset that you wish to pull from GIT.
+
+* HG_REPO can be used in place of COMPONENT_ARCHIVE_URL to pull the component
+  source from the Mercurial repository referenced in the value.
+* HG_REV is the tag or changeset that you wish to pull from Mercurial.
+
+* SVN_REPO can be used in place of COMPONENT_ARCHIVE_URL to pull the component
+  source from the Subversion repository referenced in the value.
+* SVN_REV is the tag or changeset that you wish to pull from Subversion.
+
+When using a source code management system as the canonical source for a
+component, the build automatically generates a source archive for the
+component by pulling the source from the SCM and creating a tarball from
+the pulled source.  This allows us to automatically store a copy of the
+canonical source that we build from in our source archive cache and not
+continually hammer on the component's SCM repo.  The source archive name
+is automatically generated from the COMPONENT_NAME, COMPONENT_VERSION,
+and {GIT|HG|SVN}_REV values.  Also, the source is archived and unpacked
+in a directory using these values.   You should also define a hash for
+this tarball in your Makefile similar to what you do with downloaded
+source archives.
+
+
 These two are both initialized in make-rules/shared-macros.mk rather than any
 component-level Makefile, but are frequently referenced from the latter.
 * COMPONENT_DIR is the top-level directory of the given component in question.
--- a/make-rules/ips.mk	Mon Apr 13 09:25:17 2015 -0500
+++ b/make-rules/ips.mk	Mon Apr 27 10:19:50 2015 -0500
@@ -450,15 +450,3 @@
 	# workspace.
 	$(error Missing canonical manifest(s))
 endif
-
-# This converts required paths to containing package names for be able to
-# properly setup the build environment for a component.
-required-pkgs.mk:	$(MAKEFILE_PREREQ)
-	@echo "generating [email protected] from Makefile REQUIRED_* data"
-	@pkg search -H -l '<$(DEPENDS:%=% OR) /bin/true>' \
-		| sed -e 's/pkg:\/\(.*\)@.*/REQUIRED_PKGS += \1/g' >[email protected]
-
-pre-prep:	required-pkgs.mk
-
-
-CLEAN_PATHS +=	required-pkgs.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make-rules/prep-download.mk	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,67 @@
+#
+# 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 (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+#
+
+FETCH =		$(WS_TOOLS)/userland-fetch
+
+#
+# Anything that we download must have a COMPONENT_ARCHIVE_URL{_[0-9]+} macro
+# that tells us where the canonical source for the archive can be found.  The
+# macro for the first archive is typically un-suffixed.  By convention,
+# subsequent archives will include a _[0-9]+ in the macro name.  This allows
+# an abitrary number of archives to be downloaded for a particular component
+# Makefile.  It is also important to note that there is a corresponding
+# COMPONENT_ARCHIVE macro defining a local file name for the archive, and
+# optional COMPONENT_ARCHIVE_HASH and COMPONENT_SIG_URL containing a hash of
+# the file and signature for verification of its contents.
+#
+
+TMP_SUFFIXES = $(subst COMPONENT_ARCHIVE_URL_,, \
+		$(filter COMPONENT_ARCHIVE_URL_%, $(.VARIABLES)))
+
+# Template for download rules.
+define download-rules
+ifdef COMPONENT_ARCHIVE_URL$(1)
+
+ARCHIVES += $$(COMPONENT_ARCHIVE$(1))
+CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
+
+download::	$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
+
+$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)):	$(MAKEFILE_PREREQ)
+	$$(FETCH) --file [email protected] \
+		$$(COMPONENT_ARCHIVE_URL$(1):%=--url %) \
+		$$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %) \
+		$$(COMPONENT_SIG_URL$(1):%=--sigurl %)
+	$$(TOUCH) [email protected]
+
+REQUIRED_PACKAGES += runtime/python-27
+
+endif
+endef
+
+#
+# Define the rules required to download any source archives and augment any
+# cleanup macros.
+#
+$(eval $(call download-rules,))
+$(foreach suffix, $(TMP_SUFFIXES), $(eval $(call download-rules,_$(suffix))))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make-rules/prep-git.mk	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,77 @@
+#
+# 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 (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+#
+
+GIT =		/usr/bin/git
+
+#
+# Anything that we pull from a GIT repo must have a GIT_REPO{_[0-9]+} and
+# GIT_COMMIT_ID{_[0-9]+} to match.
+#
+
+TMP_SUFFIXES = $(subst GIT_REPO_,, $(filter GIT_REPO_%, $(.VARIABLES)))
+
+define git-rules
+ifdef GIT_REPO$(1)
+ifdef GIT_COMMIT_ID$(1)
+
+COMPONENT_SRC$(1) = $(COMPONENT_NAME)-$(COMPONENT_VERSION)-$$(GIT_COMMIT_ID$(1))
+COMPONENT_ARCHIVE$(1) = $$(COMPONENT_SRC$(1)).tar.gz
+
+CLEAN_PATHS += $$(COMPONENT_SRC$(1))
+CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
+SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$(COMPONENT_SRC$(1))
+
+download::	$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
+
+# First attempt to download a cached archive of the SCM repo at the proper
+# changeset ID.  If that fails, create an archive by cloning the SCM repo,
+# updating to the selected changeset, archiving that directory, and cleaning up
+# when complete.
+$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)):	$(MAKEFILE_PREREQ)
+	$$(FETCH) --file [email protected] $$(GIT_HASH$(1):%=--hash %) || \
+	(TMP_REPO=$$$$(mktemp --directory) && \
+	 $(GIT) clone $$(GIT_REPO$(1)) $$$${TMP_REPO} && \
+	 (cd $$$${TMP_REPO} ; $(GIT) checkout \
+		 $$(GIT_COMMIT_ID$(1))) && \
+	 (cd $$$${TMP_REPO} ; $(GIT) archive --format tar.gz \
+		--prefix $$(COMPONENT_SRC$(1))/ \
+		$$(GIT_COMMIT_ID$(1))) > [email protected] && \
+	 $(RM) -r $$$${TMP_REPO} && \
+	 GIT_HASH=$$$$(digest -a sha256 [email protected]) && \
+	 $(GSED) -i \
+		-e "s/^GIT_HASH$(1)=.*/GIT_HASH$(1)=  sha256:$$$${GIT_HASH}/" \
+		Makefile)
+
+
+REQUIRED_PACKAGES += developer/versioning/git
+
+endif
+endif
+endef
+
+#
+# Define the rules required to download any source archives and augment any
+# cleanup macros.
+#
+$(eval $(call git-rules,))
+$(foreach suffix, $(TMP_SUFFIXES), $(eval $(call git-rules,_$(suffix))))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make-rules/prep-hg.mk	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,75 @@
+#
+# 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 (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+#
+
+HG =		/usr/bin/hg
+
+#
+# Anything that we pull from a Mercurial repo must have a HG_REPO{_[0-9]+} and
+# HG_REV{_[0-9]+} to match.
+#
+
+TMP_SUFFIXES = $(subst HG_REPO_,, $(filter HG_REPO_%, $(.VARIABLES)))
+
+define mercurial-rules
+ifdef HG_REPO$(1)
+ifdef HG_REV$(1)
+
+COMPONENT_SRC$(1) = $(COMPONENT_NAME)-$(COMPONENT_VERSION)-$$(HG_REV$(1))
+COMPONENT_ARCHIVE$(1) = $$(COMPONENT_SRC$(1)).tar.bz2
+
+CLEAN_PATHS += $$(COMPONENT_SRC$(1))
+CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
+SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$(COMPONENT_SRC$(1))
+
+download::	$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
+
+# First attempt to download a cached archive of the SCM repo at the proper
+# changeset ID.  If that fails, create an archive by cloning the SCM repo,
+# updating to the selected changeset, archiving that directory, and cleaning up
+# when complete.
+$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)):	$(MAKEFILE_PREREQ)
+	$$(FETCH) --file [email protected] $$(HG_HASH$(1):%=--hash %) || \
+	(TMP_REPO=$$$$(mktemp --directory) && \
+	 $(HG) clone $$(HG_REPO$(1)) $$(HG_REV$(1):%=--rev %) \
+		 $$(HG_REV$(1):%=--updaterev %) \
+		 $$(HG_BRANCH$(1):%=--branch %) \
+		    $$$${TMP_REPO} && \
+	 $(HG) -R $$$${TMP_REPO} archive --prefix $$(COMPONENT_SRC$(1)) [email protected] && \
+	 $(RM) -rf $${TMP_REPO} && \
+	 HG_HASH=$$$$(digest -a sha256 [email protected]) && \
+	 $(GSED) -i \
+		-e "s/^HG_HASH$(1)=.*/HG_HASH$(1)=	sha256:$$$${HG_HASH}/" \
+		Makefile)
+
+REQUIRED_PACKAGES += developer/versioning/mercurial
+
+endif
+endif
+endef
+
+#
+# Define the rules required to download any source archives and augment any
+# cleanup macros.
+#
+$(eval $(call mercurial-rules,))
+$(foreach suffix, $(TMP_SUFFIXES), $(eval $(call mercurial-rules,_$(suffix))))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make-rules/prep-patch.mk	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,91 @@
+#
+# 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 (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+#
+
+GPATCH =	/usr/gnu/bin/patch
+PATCH_LEVEL ?=	1
+GPATCH_BACKUP =	--backup --version-control=numbered
+GPATCH_FLAGS =	--strip=$(PATCH_LEVEL) $(GPATCH_BACKUP)
+
+#
+# Rules for patching source that is downloaded and unpacked or pulled from
+# a source repository.  Patches should be named
+# patches/{patch-file-name}.patch{version} where {patch-file-name} is a
+# meaningful name for the patch contents and {version} corresponds to the
+# COMPONENT_NAME{version} of the source to be patched.  Typically, version
+# would be something like "_1", "_2", ...  After all {version} patches have
+# been applied, a final set of patches without a {version} suffix may be
+# applied.
+#
+# PATCH_DIR can be overridden to move patches to a different location
+# PATCH_PATTERN can be overridden to adjust the patch naming scheme that the
+#     build recognizes.
+# EXTRA_PATCHES{version} can be defined in the component Makefile to include
+#     additional patches.
+#
+
+PATCH_PATTERN ?=	*.patch*
+
+PATCH_DIR ?=		patches
+# patches specific to parfait builds.
+PARFAIT_PATCH_DIR =	parfait
+
+PATCHES =	$(shell find $(PATCH_DIR) $(PARFAIT_PATCH_DIR) -type f \
+			 -name '$(PATCH_PATTERN)' 2>/dev/null | \
+				LC_COLLATE=C sort)
+PATHCES +=	$(EXTRA_PATCHES)
+
+TMP_SUFFIXES = $(patsubst .patch_%,%, $(filter-out .patch,$(suffix $(PATCHES))))
+
+define patch-rule
+
+ifeq ($(1),_0)
+PATCH_PATTERN$(1) ?=	%.patch
+PATCHES$(1) = $(filter %.patch,$(PATCHES))
+else
+PATCH_PATTERN$(1) ?=	%.patch$(1)
+PATCHES$(1) = $(filter %.patch$(1),$(PATCHES))
+endif
+
+ifneq ($$(PATCHES$(1)),)
+PATCH_STAMPS$(1) += $$(PATCHES$(1):$(PATCH_DIR)/%=$$(SOURCE_DIR$(1))/.patched-%)
+
+# We should unpack the source that we patch before we patch it.
+$$(PATCH_STAMPS$(1)::	$$(UNPACK_STAMP$(1)) unpack
+
+$$(SOURCE_DIR$(1))/.patched-%:	$(PATCH_DIR)/%
+	$(GPATCH) -d $$(@D) $$(GPATCH_FLAGS) < $$<
+	$(TOUCH) $$(@)
+
+patch::	$$(PATCH_STAMPS$(1))
+
+REQUIRED_PACKAGES += text/gnu-patch
+
+endif
+endef
+
+#
+# Define the rules required to download any source archives and augment any
+# cleanup macros.
+#
+$(foreach suffix, $(TMP_SUFFIXES), $(eval $(call patch-rule,_$(suffix))))
+$(eval $(call patch-rule,))	# this must be last so we don't drop *.patch_%.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make-rules/prep-svn.mk	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,74 @@
+#
+# 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 (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+#
+
+SVN =		/usr/bin/svn
+
+#
+# Anything that we pull from a Subversion repo must have a SVN_REPO{_[0-9]+} and
+# SVN_REV{_[0-9]+} to match.
+#
+
+TMP_SUFFIXES = $(subst SVN_REPO_,, $(filter SVN_REPO_%, $(.VARIABLES)))
+
+define subversion-rules
+ifdef SVN_REPO$(1)
+ifdef SVN_REV$(1)
+
+COMPONENT_SRC$(1) = $(COMPONENT_NAME)-$(COMPONENT_VERSION)-$$(SVN_REV$(1))
+COMPONENT_ARCHIVE$(1) = $$(COMPONENT_SRC$(1)).tar.bz2
+
+CLEAN_PATHS += $$(COMPONENT_SRC$(1))
+CLOBBER_PATHS += COMPONENT_ARCHIVE$(1)
+SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$(COMPONENT_SRC$(1))
+
+download::	$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
+
+# First attempt to download a cached archive of the SCM repo at the proper
+# changeset ID.  If that fails, create an archive by cloning the SCM repo,
+# updating to the selected changeset, archiving that directory, and cleaning up # when complete.
+$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)):	$(MAKEFILE_PREREQ)
+	$$(FETCH) --file [email protected] $$(SVN_HASH$(1):%=--hash %) || \
+	(TMP_REPO=$$$$(mktemp --directory --dry-run) && \
+	 $(SVN) export $$(SVN_REPO$(1)) $$(SVN_REV$(1):%=--revision %) \
+			$$$${TMP_REPO} && \
+	 /usr/gnu/bin/tar --create --file - --absolute-names \
+	      --transform="s;$$$${TMP_REPO};$$(COMPONENT_SRC$(1));g" \
+	      --bzip2 $$$${TMP_REPO} >[email protected] && \
+	 $(RM) -rf $$$${TMP_REPO} && \
+	 SVN_HASH=$$$$(digest -a sha256 [email protected]) && \
+	 $(GSED) -i \
+		-e "s/^SVN_HASH$(1)=.*/SVN_HASH$(1)=  sha256:$$$${SVN_HASH}/" \
+		Makefile)
+
+REQUIRED_PACKAGES += developer/versioning/subversion
+
+endif
+endif
+endef
+
+#
+# Define the rules required to download any source archives and augment any
+# cleanup macros.
+#
+$(eval $(call subversion-rules,))
+$(foreach suffix, $(TMP_SUFFIXES), $(eval $(call subversion-rules,_$(suffix))))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make-rules/prep-unpack.mk	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,69 @@
+#
+# 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 (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+#
+
+UNPACK =		$(WS_TOOLS)/userland-unpack
+
+#
+# Anything that we downloaded and want to unpack must have a
+# COMPONENT_ARCHIVE{_[0-9]+} macro.
+#
+TMP_SUFFIXES = $(subst COMPONENT_ARCHIVE_,, \
+                $(filter COMPONENT_ARCHIVE_%, $(.VARIABLES)))
+
+# Template for unpacking rules.
+define unpack-rules
+ifdef COMPONENT_ARCHIVE$(1)
+ifdef COMPONENT_SRC$(1)
+
+CLEAN_PATHS += $$(COMPONENT_SRC$(1))
+SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$(COMPONENT_SRC$(1))
+
+UNPACK_STAMP$(1) =	$$(SOURCE_DIR$(1))/.unpacked
+
+$$(UNPACK_STAMP$(1)):	$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)) download
+	$$(RM) -r $$(SOURCE_DIR$(1))
+	$$(UNPACK) $$(UNPACK_ARGS$(1)) $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
+	$$(COMPONENT_POST_UNPACK_ACTION$(1))
+	$$(TOUCH) [email protected]
+
+unpack::	$$(UNPACK_STAMP$(1))
+
+REQUIRED_PACKAGES += archiver/gnu-tar
+REQUIRED_PACKAGES += compress/bzip2
+REQUIRED_PACKAGES += compress/gzip
+REQUIRED_PACKAGES += compress/p7zip
+REQUIRED_PACKAGES += compress/unzip
+REQUIRED_PACKAGES += compress/xz
+REQUIRED_PACKAGES += developer/java/jdk
+REQUIRED_PACKAGES += runtime/ruby
+
+endif
+endif
+endef
+
+#
+# Define the rules required to download any source archives and augment any
+# cleanup macros.
+#
+$(eval $(call unpack-rules,))
+$(foreach suffix, $(TMP_SUFFIXES), $(eval $(call unpack-rules,_$(suffix))))
--- a/make-rules/prep.mk	Mon Apr 13 09:25:17 2015 -0500
+++ b/make-rules/prep.mk	Mon Apr 27 10:19:50 2015 -0500
@@ -23,134 +23,28 @@
 # Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
-# One must do all unpack and patch in sequence.
-.NOTPARALLEL: (SOURCE_DIR)/.prep
-
-UNPACK =	$(WS_TOOLS)/userland-unpack
-FETCH =		$(WS_TOOLS)/userland-fetch
-
-ARCHIVES += $(COMPONENT_ARCHIVE)
-CLEAN_PATHS += $(SOURCE_DIR)
-
-# In order to override PATCH_DIR and PATCH_PATTERN in component makefiles, they
-# need to be conditionally set here.  This means that the override needs to
-# happen prior to including prep.mk.  Otherwise other variables set here which
-# are based on those will be expanded too early for the override to take
-# effect.
-# You also can't override PATCHES after including prep.mk; if you want to
-# append filenames to PATCHES, you'll have to set $(EXTRA_PATCHES) prior to
-# inclusion.
-PATCH_DIR ?=	patches
-
-# we may need patches only for use with parfait
-ifeq   ($(strip $(PARFAIT_BUILD)),yes)
-PARFAIT_PATCH_DIR =	parfait
-endif
-PATCH_PATTERN ?=	*.patch
-PATCHES =	$(shell find $(PATCH_DIR) $(PARFAIT_PATCH_DIR) -type f -name '$(PATCH_PATTERN)' \
-				2>/dev/null | sort) $(EXTRA_PATCHES)
-
-# Rule to perform the patching.
-$(SOURCE_DIR)/.%ed:	$(PATCH_DIR)/%
-	$(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
-	$(TOUCH) [email protected]
-
-# Parfait patches rule: TODO - Integrate with other patch rules
-ifeq   ($(strip $(PARFAIT_BUILD)),yes)
-$(SOURCE_DIR)/.%ed:	$(PARFAIT_PATCH_DIR)/%
-	$(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
-	$(TOUCH) [email protected]
-endif
-
-# Template for download rules.
-define download-rule
-ARCHIVES += $$(COMPONENT_ARCHIVE$(1))
-CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
-$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)):	$(MAKEFILE_PREREQ)
-	$$(FETCH) --file [email protected] \
-		$$(COMPONENT_ARCHIVE_URL$(1):%=--url %) \
-		$$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %) \
-		$$(COMPONENT_SIG_URL$(1):%=--sigurl %)
-	$$(TOUCH) [email protected]
-endef
+include $(WS_MAKE_RULES)/prep-download.mk
+include $(WS_MAKE_RULES)/prep-hg.mk
+include $(WS_MAKE_RULES)/prep-git.mk
+include $(WS_MAKE_RULES)/prep-svn.mk
+include $(WS_MAKE_RULES)/prep-unpack.mk
+include $(WS_MAKE_RULES)/prep-patch.mk
 
-# Template for patching rules, note that patching is actually done by the
-# %.ed pattern rule above.
-# To maintain backwards compatibility, the flag PATCH_EACH_ARCHIVE must
-# be non-empty in order to activate individual archive patching.
-define patch-rule
-ifneq ($(strip $$(PATCH_EACH_ARCHIVE)),)
-# Prepend the patch directory to each archive patch.
-#$$(COMPONENT_PATCHES$(1):%=$$(PATCH_DIR)/%)
-#PATCHDIR_PATCHES$(1) += $$(COMPONENT_PATCHES)
-PATCHDIR_PATCHES$(1) += $$(foreach patch,$$(COMPONENT_PATCHES$(1)), \
-						 $$(PATCH_DIR)/$$(patch))
-else
-PATCHDIR_PATCHES = $$(PATCHES)
-endif
-# Substitute the patch dir for the source dir on the patches
-STAMPS$(1)+= $$(PATCHDIR_PATCHES$(1):$$(PATCH_DIR)/%=$$(SOURCE_DIR)/.%ed)
-ifeq   ($(strip $(PARFAIT_BUILD)),yes)
-STAMPS$(1)+= $$(PATCHDIR_PATCHES$(1):$$(PARFAIT_PATCH_DIR)/%=$$(SOURCE_DIR)/.%ed)
-endif
-$$(SOURCE_DIR)/.patched$(1): $$(SOURCE_DIR)/.unpacked$(1) $$(STAMPS$(1))
-	$$(TOUCH) [email protected]
-endef
+download::
+
+unpack::	download
 
-# Template for unpacking rules.
-define unpack-rule
-$$(SOURCE_DIR)/.unpacked$(1): download $(MAKEFILE_PREREQ) $$(PATCHDIR_PATCHES$(1))
-	$$(RM) -r $$(COMPONENT_SRC$(1))
-	$$(UNPACK) $$(UNPACK_ARGS$(1)) \
-		$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
-	$$(COMPONENT_POST_UNPACK_ACTION$(1))
-	$$(TOUCH) [email protected]
-endef
+patch::		unpack
 
-# If an archive is defined, create a download, unpack and patch rule.
-define archive-rule
-ifneq ($(strip $$(COMPONENT_ARCHIVE$(1))),)
-$(eval $(call download-rule,$(1)))
-$(eval $(call unpack-rule,$(1)))
-$(eval $(call patch-rule,$(1)))
-ARCHIVE_STAMPS +=$$(SOURCE_DIR)/.patched$(1)
-endif
-endef
-
-# Calculate the number of defined archives.
-# Always generate at least the basic prep rules.
-# Work out if there are any other archives to be downloaded and patched.
-NUM_EXTRA_ARCHIVES ?= 1 2 3 4 5 6 7 8 9
-$(eval $(call archive-rule,))
-ifneq ($(strip $(PATCH_EACH_ARCHIVE)),)
-$(foreach suffix,$(NUM_EXTRA_ARCHIVES), \
-	$(eval $(call archive-rule,_$(suffix))))
-else
-# Backwards compatibility - only download, do not unpack or patch automatically
-$(foreach suffix,$(NUM_EXTRA_ARCHIVES), \
-	$(eval $(call download-rule,_$(suffix))))
-endif
-
-$(SOURCE_DIR)/.prep: $(ARCHIVE_STAMPS)
+$(SOURCE_DIR)/.prep:	download unpack patch
 	$(COMPONENT_PREP_ACTION)
 	$(TOUCH) [email protected]
 
 prep::	$(SOURCE_DIR)/.prep
 
-download::	$(ARCHIVES:%=$(USERLAND_ARCHIVES)%)
-
 clean::
 	$(RM) -r $(CLEAN_PATHS)
 
 clobber::	clean
 	$(RM) -r $(CLOBBER_PATHS)
 
-REQUIRED_PACKAGES += archiver/gnu-tar
-REQUIRED_PACKAGES += compress/bzip2
-REQUIRED_PACKAGES += compress/gzip
-REQUIRED_PACKAGES += compress/p7zip
-REQUIRED_PACKAGES += compress/unzip
-REQUIRED_PACKAGES += compress/xz
-REQUIRED_PACKAGES += developer/java/jdk
-REQUIRED_PACKAGES += runtime/ruby
-REQUIRED_PACKAGES += text/gnu-patch
--- a/make-rules/shared-macros.mk	Mon Apr 13 09:25:17 2015 -0500
+++ b/make-rules/shared-macros.mk	Mon Apr 27 10:19:50 2015 -0500
@@ -926,8 +926,10 @@
 REQUIRED_PACKAGES += developer/gcc-47
 endif
 ifeq ($(COMPILER),studio)
+ifeq ($(findstring /opt/solarisstudio12.4,$(CC)),)
 # uncomment this line if you need to install Studio
-#REQUIRED_PACKAGES += developer/solarisstudio-124
+REQUIRED_PACKAGES += developer/solarisstudio-124
+endif
 endif
 ifeq ($(PARFAIT_BUILD),yes)
 # uncomment this line if you need to install Parfait
--- a/tools/userland-fetch	Mon Apr 13 09:25:17 2015 -0500
+++ b/tools/userland-fetch	Mon Apr 27 10:19:50 2015 -0500
@@ -308,9 +308,6 @@
 		else:
 			assert False, "unknown option"
 
-	if url_arg == None:
-		usage()
-
 	for name in download_from_paths(search_list, file_arg, url_arg, link_arg):
 		print "\n    validating signature...",