summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ksh
diff options
context:
space:
mode:
authorApril Chin <April.Chin@Sun.COM>2008-12-27 14:59:38 -0800
committerApril Chin <April.Chin@Sun.COM>2008-12-27 14:59:38 -0800
commit7c2fbfb345896881c631598ee3852ce9ce33fb07 (patch)
tree4b173b5657508562dfc0aa05f7d056d1e9add505 /usr/src/cmd/ksh
parent6071ac1de68fed78e1e10052045bbb5f1732a263 (diff)
downloadillumos-joyent-7c2fbfb345896881c631598ee3852ce9ce33fb07.tar.gz
PSARC/2008/094 ksh93 Update 1
PSARC/2008/344 ksh93 Integration Update 1 Amendments 1 PSARC/2008/589 Remove /usr/bin/printf from PSARC case 2008 094 6619428 *ksh93* RFE: Update ksh93 in Solaris to ast-ksh.2008-11-04 6788659 RFE: Update libpp in Solaris to ast-open.2008-07-25 6561901 RFE: Add "shcomp" (shell script compiler) + kernel module to exec binary sh code 6599668 RFE: Move consumers of alias.sh over to ksh93 6595183 *ksh93* RFE: Update ksh93-integration demo code 6775901 *ksh93* no C message catalogs are generated for ksh93 6451262 *sleep* RFE: /usr/bin/sleep should support floating-point values 6687139 *ksh93* command substitution, exec, and stdout redirection cause allocation loop 6703761 *ksh93* crashes in script containing uncommon output redirections 6715496 *ksh93* SEGVs on array reinitialization 6713682 *ksh93* Creating a compound variable in a subshell "bleeds through" to the calling subshell 6672350 *ksh93* causes parent shell to die when child shell is suspended 6745015 *ksh93* VARIABLE=`command substitution` assignment is not reliable on OpenSolaris 6710205 *ksh93* problem with command substitution (within back quotes) containing \$' 6737600 *ksh93* exits debugger when user presses ctrl-c 6748645 *ksh93* fc -l -e - is mis-parsed, outputs wrong error message "-e - requires single argument" 6754020 *ksh93* does weird '[' expansion 6753538 *ksh93* umask modification leaks out of a ksh93 subshell 6766246 *ksh93* bug in pattern matching 6763594 *ksh93* executes command after "command" builtin twice on failure 6762665 *ksh93* Difficult-to-reproduce SIGSEGV in ksh93
Diffstat (limited to 'usr/src/cmd/ksh')
-rw-r--r--usr/src/cmd/ksh/Makefile27
-rw-r--r--usr/src/cmd/ksh/Makefile.com48
-rw-r--r--usr/src/cmd/ksh/Makefile.testshell122
-rw-r--r--usr/src/cmd/ksh/amd64/Makefile17
-rw-r--r--usr/src/cmd/ksh/builtins/Makefile76
-rw-r--r--usr/src/cmd/ksh/builtins/alias.sh51
-rw-r--r--usr/src/cmd/ksh/i386/Makefile17
-rw-r--r--usr/src/cmd/ksh/sparc/Makefile17
-rw-r--r--usr/src/cmd/ksh/sparcv9/Makefile17
9 files changed, 254 insertions, 138 deletions
diff --git a/usr/src/cmd/ksh/Makefile b/usr/src/cmd/ksh/Makefile
index 2412f65264..ae658a020c 100644
--- a/usr/src/cmd/ksh/Makefile
+++ b/usr/src/cmd/ksh/Makefile
@@ -18,19 +18,18 @@
#
# CDDL HEADER END
#
+
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-SHELL=/usr/bin/ksh
+SHELL=/usr/bin/ksh93
include ../../Makefile.ksh93switch
$(BINKSH_IS_KSH93)PROG= ksh
-$(BINKSH_IS_KSH93)USRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93 pfksh
+$(BINKSH_IS_KSH93)USRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93 pfksh pfksh93 pfrksh pfrksh93
$(BINKSH_ISNOT_KSH93)PROG= ksh93
$(BINKSH_ISNOT_KSH93)USRKSH_ALIAS_LIST=ksh93 rksh93
@@ -40,6 +39,8 @@ include ../Makefile.cmd
SUBDIRS= $(MACH)
$(BUILD64)SUBDIRS += $(MACH64)
+SUBDIRS += builtins
+
# Serialise the build to avoid that we run the test suite for 32bit
# and 64bit in parallel
.NO_PARALLEL: $(SUBDIRS)
@@ -59,17 +60,19 @@ all clean clobber lint testshell: $(SUBDIRS)
# (and "ksh" is just a frontend which calls directly into libshell,
# e.g. there are no l10n strings here)
$(PROG).po:
- $(RM) ksh.po ksh93.po
- touch $(PROG).po
+ $(RM) ksh.po ksh93.po ; \
+ $(TOUCH) $(PROG).po
install: $(ISAEXEC) $(SUBDIRS)
- $(RM) $(ROOTPROG)
- $(LN) $(ISAEXEC) $(ROOTPROG)
@(set -o xtrace ; \
+ builtin ln ; \
+ builtin rm ; \
+ rm -f $(ROOTPROG) ; \
+ ln $(ISAEXEC) $(ROOTPROG) ; \
for i in $(USRKSH_ALIAS_LIST) ; do \
- [[ "$$i" = "$(PROG)" ]] && continue ; \
- $(RM) "$(ROOTBIN)/$$i" ; \
- $(LN) "$(ROOTBIN)/$(PROG)" "$(ROOTBIN)/$$i" ; \
+ [[ "$$i" == "$(PROG)" ]] && continue ; \
+ rm -f "$(ROOTBIN)/$$i" ; \
+ ln "$(ROOTBIN)/$(PROG)" "$(ROOTBIN)/$$i" ; \
done \
)
diff --git a/usr/src/cmd/ksh/Makefile.com b/usr/src/cmd/ksh/Makefile.com
index 3094d06f89..1bfb543ba5 100644
--- a/usr/src/cmd/ksh/Makefile.com
+++ b/usr/src/cmd/ksh/Makefile.com
@@ -18,19 +18,18 @@
#
# CDDL HEADER END
#
+
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
-SHELL=/usr/bin/ksh
+SHELL=/usr/bin/ksh93
include ../../../Makefile.ksh93switch
$(BINKSH_IS_KSH93)PROG= ksh
-$(BINKSH_IS_KSH93)USRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93 pfksh
+$(BINKSH_IS_KSH93)USRKSH_ALIAS_LIST=ksh ksh93 rksh rksh93 pfksh pfksh93 pfrksh pfrksh93
$(BINKSH_ISNOT_KSH93)PROG= ksh93
$(BINKSH_ISNOT_KSH93)USRKSH_ALIAS_LIST=ksh93 rksh93
@@ -38,13 +37,17 @@ $(BINKSH_ISNOT_KSH93)USRKSH_ALIAS_LIST=ksh93 rksh93
OBJECTS= \
pmain.o
-LIBSHELLSRC=../../../lib/libshell/common/sh
+LIBSHELLBASE=../../../lib/libshell
+LIBSHELLSRC=$(LIBSHELLBASE)/common/sh
SRCS= $(OBJECTS:%.o=$(LIBSHELLSRC)/%.c)
GROUP= bin
LDLIBS += -lshell
+# Set common AST build flags (e.g., needed to support the math stuff).
+include ../../../Makefile.ast
+
# 1. Make sure that the -D/-U defines in CFLAGS below are in sync
# with usr/src/lib/libshell/Makefile.com
# 2. We use "=" here since using $(CPPFLAGS.master) is very tricky in our
@@ -57,14 +60,12 @@ CPPFLAGS = \
$(LIBSHELLCPPFLAGS)
CFLAGS += \
- $(CCVERBOSE) \
- -xstrconst
+ $(ASTCFLAGS)
CFLAGS64 += \
- $(CCVERBOSE) \
- -xstrconst
+ $(ASTCFLAGS64)
-# Set common AST build flags (e.g., needed to support the math stuff).
-include ../../../Makefile.ast
+# Workaround for CR#6628728 ("|memcntl()| prototype not available for C99/XPG6")
+pmain.o := CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED
.KEEP_STATE:
@@ -98,6 +99,28 @@ CLOBBERFILES += \
ksh \
ksh93
+# Install rule for $(MACH)/Makefile (32bit)
+INSTALL.ksh.32bit=@ \
+ (print "$(POUND_SIGN) Installing 32bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
+ set -o xtrace ; \
+ for i in $(USRKSH_ALIAS_LIST) ; do \
+ [[ "$$i" == "$(PROG)" ]] && continue ; \
+ $(RM) "$(ROOTBIN32)/$$i" ; \
+ $(LN) "$(ROOTBIN32)/$(PROG)" "$(ROOTBIN32)/$$i" ; \
+ done \
+ )
+
+# Install rule for $(MACH64)/Makefile (64bit)
+INSTALL.ksh.64bit=@ \
+ (print "$(POUND_SIGN) Installing 64bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
+ set -o xtrace ; \
+ for i in $(USRKSH_ALIAS_LIST) ; do \
+ [[ "$$i" == "$(PROG)" ]] && continue ; \
+ $(RM) "$(ROOTBIN64)/$$i" ; \
+ $(LN) "$(ROOTBIN64)/$(PROG)" "$(ROOTBIN64)/$$i" ; \
+ done \
+ )
+
#
# ksh is not lint-clean yet; fake up a target. (You can use
# "make lintcheck" to actually run lint; please send all lint fixes
@@ -105,6 +128,5 @@ CLOBBERFILES += \
#
lint:
@ print "usr/src/cmd/ksh is not lint-clean: skipping"
- @ $(TRUE)
include ../Makefile.testshell
diff --git a/usr/src/cmd/ksh/Makefile.testshell b/usr/src/cmd/ksh/Makefile.testshell
index 6e9a264f0c..fdad066a57 100644
--- a/usr/src/cmd/ksh/Makefile.testshell
+++ b/usr/src/cmd/ksh/Makefile.testshell
@@ -18,15 +18,16 @@
#
# CDDL HEADER END
#
+
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
#
-# run the ksh93 minimum set of tests
+# Run the ksh93 minimum set of tests
+#
+
#
# Notes:
# - "builtins.sh" may fail in some locales like this:
@@ -43,21 +44,10 @@
# This may be simply a different sort order or a bug in the test suite.
# Currently under investigation.
#
-# - "io.sh" may fail due a subtle bug in ksh93 or the test suite which
-# only happens when ksh93 is NOT called "ksh"; to work around the
-# problem the test sequence currently uses $(SRC)/cmd/ksh/$(CMDTRANSMACH)/ksh
-# instead of $(SRC)/cmd/ksh/$(CMDTRANSMACH)/$(PROG) until we+upstream figure
-# out what exactly is going wrong in this case.
-# -- snip --
-# ./close0[2]: ./close1: cannot execute [Exec format error]
-# io.sh[81]: picked up file descriptor zero for opening script file
-# -- snip --
-#
# - These tests need a working system clock, otherwise they'll bite you.
#
-# - The test frontend in this Makefile should be rewritten in ksh93
-# instead of the current /usr/bin/ksh (=ksh88i). This would be far less
-# complicated.
+# - The current list of locales was mainly composed to cover various encodings
+# and all important markets based on suggestions by Sun's i18n team.
#
# - More locales should be tested here (via ON_KSH_TEST_LOCALES below).
# Locales like "ru_RU.KOI8-R","de_DE.UTF-8", "is_IS.ISO8859-1",
@@ -65,28 +55,28 @@
# that is getting little bit more compliciated because these locales use
# ',' as decimal delimter. The best solution may be to wait for ksh93
# being integrated into OS/Net and then change the test sequence to
-# use ksh93's associate/compound variables (this may require a flag
+# use ksh93's associative/compound variables (this may require a flag
# day... ;-( ).
-# The current list was mainly composed to cover various encodings and
-# all important markets based on suggestions by Sun's i18n team.
#
# - Due to the timing sensitivity of some of the tests, these tests should
# be run on a quiet system with no other activity.
#
-TESTSRC= $(LIBSHELLSRC)/../tests
+TESTSRC= $(LIBSHELLBASE)/common/tests
# ON_KSH_TEST_LOCALES can be overridden via
# $ export ON_KSH_TEST_LOCALES=<value> # before $ make install #
ON_KSH_TEST_LOCALES = \
C \
- en_US en_US.UTF-8 \
+ en_US.UTF-8 en_US en_US.ISO8859-15@euro \
he_IL.UTF-8 \
hi_IN.UTF-8 \
- ja_JP.PCK ja_JP.UTF-8 ja_JP.eucJP \
- ko_KR.EUC \
+ ja ja_JP.PCK ja_JP.UTF-8 ja_JP.eucJP \
+ ko_KR.UTF-8 ko_KR.EUC \
th_TH.TIS620 \
- zh_CN.EUC zh_CN.GBK zh_CN.GB18030 zh_CN.UTF-8 \
+ zh_CN.EUC zh_CN.GBK \
+ zh_CN.GB18030 zh_CN.GB18030@pinyin zh_CN.GB18030@radical zh_CN.GB18030@stroke \
+ zh_CN.UTF-8 zh_CN.UTF-8@pinyin zh_CN.UTF-8@radical zh_CN.UTF-8@stroke \
zh_HK.BIG5HK \
zh_TW.BIG5 zh_TW.EUC zh_TW.UTF-8
@@ -103,61 +93,71 @@ ON_KSH_TEST_IGNORE_TESTFAILURE=false
# test failures).
testshell: $(PROG)
@ \
+ builtin basename ; \
print '# NOTE: Make sure your binaries in ROOT match your kernel!' ; \
( \
set +o errexit ; \
- export PATH="$(SRC)/cmd/ksh/$(CMDTRANSMACH):/bin:/usr/bin" ; \
+ export PATH="$(SRC)/cmd/ksh/$(LIBSHELLMACH):/bin:/usr/bin" ; \
printf "# which ksh='%s', ksh93='%s'\n" \
"$$(which ksh)" "$$(which ksh93)" ; \
) ; \
- if [[ "$$(isalist | fgrep "$(CMDTRANSMACH)")" = "" ]] ; then \
+ if [[ "$$(isalist)" != ~(E)$(LIBSHELLMACH) ]] ; then \
printf \
"# ISA='%s' not available on this system, skipping tests...\n" \
- "$(CMDTRANSMACH)" ; \
+ "$(LIBSHELLMACH)" ; \
exit 0 ; \
fi ; \
- exec 2>&1 ; \
+ print "# Libraries used:" ; \
+ LD_LIBRARY_PATH_64="$(ROOTLIB64)/" \
+ LD_LIBRARY_PATH_32="$(ROOTLIB)/" \
+ LD_LIBRARY_PATH="$(ROOTLIB64)/:$(ROOTLIB)/" \
+ /usr/bin/ldd "$(SRC)/cmd/ksh/$(LIBSHELLMACH)/ksh" ; \
+ print "# Running tests:" ; \
+ redirect 2>&1 ; \
(supported_locales="$$(/usr/bin/locale -a)" ; \
for test_lang in $(ON_KSH_TEST_LOCALES) ; do \
- if [[ "$$(print "$${supported_locales}" | \
- egrep "^$${test_lang}\$$")" = "" ]] ; then \
+ if [[ "$$(egrep "^$${test_lang}\$$" <<< "$${supported_locales}")" == "" ]] ; then \
printf \
"# Locale '%s' not supported, skipping tests...\n" \
"$${test_lang}" ; \
continue ; \
fi ; \
(for test_item in $(ON_KSH_TEST_LIST) ; do \
- [[ "$${test_item}" = "$(TESTSRC)/builtins.sh" || \
- "$${test_item}" = "$(TESTSRC)/options.sh" ]] || \
+ [[ "$${test_item}" == "$(TESTSRC)/builtins.sh" || \
+ "$${test_item}" == "$(TESTSRC)/options.sh" ]] || \
$(ON_KSH_TEST_IGNORE_TESTFAILURE) && \
set +o errexit ; \
- printf \
- "## Running %s test: LANG='%s' script='%s'\n" \
- "$(CMDTRANSMACH)/ksh" \
- "$${test_lang}" \
- "$$(basename "$${test_item}")"; \
- ( \
- test_output="$$( ( \
- export \
- SHELL="$(SRC)/cmd/ksh/$(CMDTRANSMACH)/ksh" \
- LD_LIBRARY_PATH_64="$(ROOTLIB64)/" \
- LD_LIBRARY_PATH_32="$(ROOTLIB)/" ; \
- LD_LIBRARY_PATH="$(ROOTLIB64)/:$(ROOTLIB)/" ; \
- "$${SHELL}" "$(TESTSRC)/shtests" -t \
- LD_LIBRARY_PATH_64="$${LD_LIBRARY_PATH_64}" \
- LD_LIBRARY_PATH_32="$${LD_LIBRARY_PATH_32}" \
- LD_LIBRARY_PATH="$${LD_LIBRARY_PATH}" \
- SHELL="$${SHELL}" \
- LANG="$${test_lang}" \
- LC_ALL="$${test_lang}" \
- "$${test_item}" \
- ) 2>&1 | while read ; do \
- printf "#\t%s\n" "$${REPLY}" ; \
- done | tee /dev/stderr)" ; \
- [[ "$$(print "$${test_output}" | \
- egrep 'passed \[ .* tests 0 errors \]')" != "" ]] || \
- (print "##> test failed" ; exit 1) \
- ) ; \
- set -o errexit ; \
+ for mode in 'plain_script:-s' 'compiled_script:-c' ; do \
+ printf \
+ "## Running %s test: LANG='%s' script='%s', mode='%s'\n" \
+ "$(LIBSHELLMACH)/ksh" \
+ "$${test_lang}" \
+ "$$(basename "$${test_item}")" \
+ "$${mode%:*}"; \
+ ( \
+ test_output="$$( ( \
+ export \
+ SHELL="$(SRC)/cmd/ksh/$(LIBSHELLMACH)/ksh" \
+ LD_LIBRARY_PATH_64="$(ROOTLIB64)/" \
+ LD_LIBRARY_PATH_32="$(ROOTLIB)/" \
+ LD_LIBRARY_PATH="$(ROOTLIB64)/:$(ROOTLIB)/" ; \
+ "$${SHELL}" "$(TESTSRC)/shtests" -t "$${mode#*:}" \
+ LD_LIBRARY_PATH_64="$${LD_LIBRARY_PATH_64}" \
+ LD_LIBRARY_PATH_32="$${LD_LIBRARY_PATH_32}" \
+ LD_LIBRARY_PATH="$${LD_LIBRARY_PATH}" \
+ SHELL="$${SHELL}" \
+ LANG="$${test_lang}" \
+ LC_ALL="$${test_lang}" \
+ VMDEBUG=a \
+ SHCOMP="$(ROOTBIN)/shcomp" \
+ "$${test_item}" \
+ ) 2>&1 | while read ; do \
+ printf "#\t%s\n" "$${REPLY}" ; \
+ done | tee /dev/stderr)" ; \
+ [[ "$${test_output}" == ~(E)test.*passed\ \[\ [[:digit:]]*\ test.*\ 0\ errors\ \] ]] || \
+ (print "##--------> test failed" ; exit 1) \
+ ) ; \
+ done ; \
+ set -o errexit ; \
done) ; \
done)
diff --git a/usr/src/cmd/ksh/amd64/Makefile b/usr/src/cmd/ksh/amd64/Makefile
index 093e92da1e..c6a3da7fe7 100644
--- a/usr/src/cmd/ksh/amd64/Makefile
+++ b/usr/src/cmd/ksh/amd64/Makefile
@@ -18,15 +18,14 @@
#
# CDDL HEADER END
#
+
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
# Specify the MACH we currently use to build and test ksh
-CMDTRANSMACH= $(MACH64)
+LIBSHELLMACH= $(MACH64)
include ../../Makefile.cmd
include ../../Makefile.cmd.64
@@ -34,14 +33,6 @@ include ../../Makefile.cmd.64
include ../Makefile.com
install: all $(ROOTPROG64)
- @ \
- (print "# Installing 64bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
- set -o xtrace ; \
- for i in $(USRKSH_ALIAS_LIST) ; do \
- [[ "$$i" = "$(PROG)" ]] && continue ; \
- $(RM) "$(ROOTBIN64)/$$i" ; \
- $(LN) "$(ROOTBIN64)/$(PROG)" "$(ROOTBIN64)/$$i" ; \
- done \
- )
+ $(INSTALL.ksh.64bit)
include ../../Makefile.targ
diff --git a/usr/src/cmd/ksh/builtins/Makefile b/usr/src/cmd/ksh/builtins/Makefile
new file mode 100644
index 0000000000..57584c04cc
--- /dev/null
+++ b/usr/src/cmd/ksh/builtins/Makefile
@@ -0,0 +1,76 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+SHELL=/usr/bin/ksh93
+
+PROG= alias
+ALIASPROG= \
+ bg \
+ cd \
+ command \
+ fc \
+ fg \
+ getopts \
+ hash \
+ jobs \
+ kill \
+ read \
+ rev \
+ sleep \
+ sum \
+ test \
+ type \
+ ulimit \
+ umask \
+ unalias \
+ wait
+
+include ../../Makefile.cmd
+
+ROOTALIASPROG= $(ALIASPROG:%=$(ROOTBIN)/%)
+
+FILEMODE= 555
+OWNER= root
+GROUP= bin
+
+.KEEP_STATE:
+
+all: $(PROG)
+
+$(ROOTBIN)/%: $(ROOTBIN)/alias
+ $(INS.link)
+
+# In the future we should replace the "cat" with a call to
+# "shcomp" to compile the script (for better performance).
+$(PROG): alias.sh
+ cat "alias.sh" >"$@"
+
+install: all $(ROOTALIASPROG)
+
+clean clobber:
+ rm -f $(PROG)
+
+lint:
diff --git a/usr/src/cmd/ksh/builtins/alias.sh b/usr/src/cmd/ksh/builtins/alias.sh
new file mode 100644
index 0000000000..e59558d3d0
--- /dev/null
+++ b/usr/src/cmd/ksh/builtins/alias.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/ksh93
+
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+# Get name of builtin
+builtin basename
+typeset cmd="$(basename "$0")"
+
+# If the requested command is not an alias load it explicitly
+# to make sure it is not bound to a path (those built-ins which
+# are mapped via shell aliases point to commands which are
+# "special shell built-ins" which cannot be bound to a specific
+# PATH element) - otherwise we may execute the wrong command
+# if an executable with the same name sits in a PATH element
+# before /usr/bin (e.g. /usr/xpg4/bin/ls would be executed
+# before /usr/bin/ls if would look like
+# PATH=/usr/xpg4/bin:/usr/bin).
+if [[ "${cmd}" != ~(Elr)(alias|unalias|command) ]] && ! alias "${cmd}" >/dev/null 2>&1 ; then
+ builtin "${cmd}"
+fi
+
+# command is a keyword and needs to be handled separately
+if [[ "${cmd}" == "command" ]] ; then
+ command "$@"
+else
+ "${cmd}" "$@"
+fi
diff --git a/usr/src/cmd/ksh/i386/Makefile b/usr/src/cmd/ksh/i386/Makefile
index da5146beb6..5ce68f9ef3 100644
--- a/usr/src/cmd/ksh/i386/Makefile
+++ b/usr/src/cmd/ksh/i386/Makefile
@@ -18,29 +18,20 @@
#
# CDDL HEADER END
#
+
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
# Specify the MACH we currently use to build and test ksh
-CMDTRANSMACH= $(MACH)
+LIBSHELLMACH= $(MACH)
include ../../Makefile.cmd
include ../Makefile.com
install: all $(ROOTPROG32)
- @ \
- (print "# Installing 32bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
- set -o xtrace ; \
- for i in $(USRKSH_ALIAS_LIST) ; do \
- [[ "$$i" = "$(PROG)" ]] && continue ; \
- $(RM) "$(ROOTBIN32)/$$i" ; \
- $(LN) "$(ROOTBIN32)/$(PROG)" "$(ROOTBIN32)/$$i" ; \
- done \
- )
+ $(INSTALL.ksh.32bit)
include ../../Makefile.targ
diff --git a/usr/src/cmd/ksh/sparc/Makefile b/usr/src/cmd/ksh/sparc/Makefile
index da5146beb6..5ce68f9ef3 100644
--- a/usr/src/cmd/ksh/sparc/Makefile
+++ b/usr/src/cmd/ksh/sparc/Makefile
@@ -18,29 +18,20 @@
#
# CDDL HEADER END
#
+
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
# Specify the MACH we currently use to build and test ksh
-CMDTRANSMACH= $(MACH)
+LIBSHELLMACH= $(MACH)
include ../../Makefile.cmd
include ../Makefile.com
install: all $(ROOTPROG32)
- @ \
- (print "# Installing 32bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
- set -o xtrace ; \
- for i in $(USRKSH_ALIAS_LIST) ; do \
- [[ "$$i" = "$(PROG)" ]] && continue ; \
- $(RM) "$(ROOTBIN32)/$$i" ; \
- $(LN) "$(ROOTBIN32)/$(PROG)" "$(ROOTBIN32)/$$i" ; \
- done \
- )
+ $(INSTALL.ksh.32bit)
include ../../Makefile.targ
diff --git a/usr/src/cmd/ksh/sparcv9/Makefile b/usr/src/cmd/ksh/sparcv9/Makefile
index 093e92da1e..c6a3da7fe7 100644
--- a/usr/src/cmd/ksh/sparcv9/Makefile
+++ b/usr/src/cmd/ksh/sparcv9/Makefile
@@ -18,15 +18,14 @@
#
# CDDL HEADER END
#
+
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
# Specify the MACH we currently use to build and test ksh
-CMDTRANSMACH= $(MACH64)
+LIBSHELLMACH= $(MACH64)
include ../../Makefile.cmd
include ../../Makefile.cmd.64
@@ -34,14 +33,6 @@ include ../../Makefile.cmd.64
include ../Makefile.com
install: all $(ROOTPROG64)
- @ \
- (print "# Installing 64bit $(PROG) aliases $(USRKSH_ALIAS_LIST)" ; \
- set -o xtrace ; \
- for i in $(USRKSH_ALIAS_LIST) ; do \
- [[ "$$i" = "$(PROG)" ]] && continue ; \
- $(RM) "$(ROOTBIN64)/$$i" ; \
- $(LN) "$(ROOTBIN64)/$(PROG)" "$(ROOTBIN64)/$$i" ; \
- done \
- )
+ $(INSTALL.ksh.64bit)
include ../../Makefile.targ