7175995 Problem with shell/korn93 s11u1-sru
authorPetr Cvachoucek <petr.cvachoucek@oracle.com>
Tue, 09 Oct 2012 00:20:06 -0700
branchs11u1-sru
changeset 2372 e2d08e2aec7f
parent 2370 c539542fe61d
child 2373 d53697a8bd66
7175995 Problem with shell/korn93
components/ksh93/Makefile
components/ksh93/files/ksh.1
components/ksh93/files/ksh.1.ja_JP.UTF-8
components/ksh93/files/ksh.1.zh_CN.UTF-8
components/ksh93/patches/CR7175995.patch
--- a/components/ksh93/Makefile	Mon Oct 08 19:44:45 2012 -0700
+++ b/components/ksh93/Makefile	Tue Oct 09 00:20:06 2012 -0700
@@ -71,7 +71,8 @@
 					 CR7089799.patch CR6917338.patch \
 					 CR7019368.patch CR6729252.patch \
 					 MAP_TYPE_64_Bits.patch CR7167466.patch \
-					 CR7168611.patch CR7178717.patch
+					 CR7168611.patch CR7178717.patch \
+					 CR7175995.patch
 
 # Fixup HOSTTYPE to match uname output and bits
 HOSTTYPE32=sol11.$(shell uname -p)
--- a/components/ksh93/files/ksh.1	Mon Oct 08 19:44:45 2012 -0700
+++ b/components/ksh93/files/ksh.1	Tue Oct 09 00:20:06 2012 -0700
@@ -5938,7 +5938,7 @@
 .SS "Invocation"
 .sp
 .LP
-If the shell is invoked by \fBexec\fR(2), and the first character of argument zero (\fB$0\fR) is \fB-\fR, then the shell is assumed to be a login shell and commands are read from \fB/etc/profile\fR and then from either .\fBprofile\fR in the current directory or \fB$HOME/.profile\fR, if either file exists. Next, for interactive shells, commands are read first from \fB/etc/ksh.kshrc\fR, and then from the file named by performing parameter expansion, command substitution, and arithmetic substitution on the value of the environment variable \fBENV\fR if the file exists. If the \fB-s\fR option is not present and \fIarg\fR and a file by the name of \fIarg\fR exists, then it reads and executes this script. Otherwise, if the first \fIarg\fR does not contain a \fB/\fR, a path search is performed on the first \fIarg\fR to determine the name of the script to execute. The script \fIarg\fR must have execute permission and any \fBsetuid\fR and \fBsetgid\fR settings are ignored. If the script is not found on the path, \fIarg\fR is processed as if it named a built-in command or function. 
+If the shell is invoked by \fBexec\fR(2), and the first character of argument zero (\fB$0\fR) is \fB-\fR, then the shell is assumed to be a login shell and commands are read from \fB/etc/profile\fR and then from \fB$HOME/.profile\fR. Next, for interactive shells, commands are read first from \fB/etc/ksh.kshrc\fR, and then from the file named by performing parameter expansion, command substitution, and arithmetic substitution on the value of the environment variable \fBENV\fR if the file exists. If the \fB-s\fR option is not present and \fIarg\fR and a file by the name of \fIarg\fR exists, then it reads and executes this script. Otherwise, if the first \fIarg\fR does not contain a \fB/\fR, a path search is performed on the first \fIarg\fR to determine the name of the script to execute. The script \fIarg\fR must have execute permission and any \fBsetuid\fR and \fBsetgid\fR settings are ignored. If the script is not found on the path, \fIarg\fR is processed as if it named a built-in command or function. 
 .sp
 .LP
 Commands are then read as described, and the following options are interpreted by the shell when it is invoked:
--- a/components/ksh93/files/ksh.1.ja_JP.UTF-8	Mon Oct 08 19:44:45 2012 -0700
+++ b/components/ksh93/files/ksh.1.ja_JP.UTF-8	Tue Oct 09 00:20:06 2012 -0700
@@ -5938,7 +5938,7 @@
 .SS "呼び出し"
 .sp
 .LP
-シェルを \fBexec\fR(2) で呼び出し、0 番目の引数 (\fB$0\fR) の最初の文字が \fB-\fR である場合は、シェルをログインシェルとみなし、\fB/etc/profile\fR からコマンドを読み取ります。次に、現在のディレクトリ内に .\fBprofile\fR が存在するか、または \fB$HOME/.profile\fR がある場合は、そのいずれかのファイルからコマンドを読み取ります。次に、対話型シェルの場合、コマンドは最初に \fB/etc/ksh.kshrc\fR から読み取られ、続いて環境変数 \fBENV\fR の値に対してパラメータ展開、コマンド置換、および算術置換を実行することによって指定された名前のファイルが存在する場合はこのファイルから読み取られます。\fB-s\fR オプションが存在せず、\fIarg\fR と、\fIarg\fR の名前のファイルが存在する場合、このスクリプトを読み取って実行します。それ以外の場合は、最初の \fIarg\fR に \fB/\fR が含まれなければ、最初の \fIarg\fR に対してパス検索を実行し、実行するスクリプトの名前を判定します。\fIarg\fR が示すスクリプトには実行権が必要で、\fBsetuid\fR と \fBsetgid\fR の設定は無視されます。パス上でスクリプトが見つからない場合、\fIarg\fR は組み込みコマンドまたは組み込み関数の名前を示しているものとして処理されます。 
+シェルを \fBexec\fR(2) で呼び出し、0 番目の引数 (\fB$0\fR) の最初の文字が \fB-\fR である場合は、シェルをログインシェルとみなし、\fB/etc/profile\fR からコマンドを読み取り、次に \fB$HOME/.profile\fR からコマンドを読み取ります。次に、対話型シェルの場合、コマンドは最初に \fB/etc/ksh.kshrc\fR から読み取られ、続いて環境変数 \fBENV\fR の値に対してパラメータ展開、コマンド置換、および算術置換を実行することによって指定された名前のファイルが存在する場合はこのファイルから読み取られます。\fB-s\fR オプションが存在せず、\fIarg\fR と、\fIarg\fR の名前のファイルが存在する場合、このスクリプトを読み取って実行します。それ以外の場合は、最初の \fIarg\fR に \fB/\fR が含まれなければ、最初の \fIarg\fR に対してパス検索を実行し、実行するスクリプトの名前を判定します。\fIarg\fR が示すスクリプトには実行権が必要で、\fBsetuid\fR と \fBsetgid\fR の設定は無視されます。パス上でスクリプトが見つからない場合、\fIarg\fR は組み込みコマンドまたは組み込み関数の名前を示しているものとして処理されます。 
 .sp
 .LP
 続いてコマンドが記述に従って読み取られ、次のオプションがシェルの起動時にシェルによって解釈されます。
--- a/components/ksh93/files/ksh.1.zh_CN.UTF-8	Mon Oct 08 19:44:45 2012 -0700
+++ b/components/ksh93/files/ksh.1.zh_CN.UTF-8	Tue Oct 09 00:20:06 2012 -0700
@@ -5938,7 +5938,7 @@
 .SS "调用"
 .sp
 .LP
-如果使用 \fBexec\fR(2) 调用 shell,并且参数的第一个字符 0 (\fB$0\fR) 为 \fB-\fR,则假定此 shell 为登录 shell,并从 \fB/etc/profile\fR 读取命令,然后从当前目录的 .\fBprofile\fR 或 \fB$HOME/.profile\fR 中读取命令(如果存在任何一个文件)。接着,对于交互式 shell,首先从 \fB/etc/ksh.kshrc\fR 读取命令,然后从通过对环境变量 \fBENV\fR 的值执行参数扩展、命令替换和算术替换进行命名的文件中读取命令(如果存在此文件)。如果 \fB-s\fR 选项不存在,并且存在 \fIarg\fR 以及名为 \fIarg\fR 的文件,则会读取和执行此脚本。否则,如果第一个 \fIarg\fR 不包含 \fB/\fR,则会对第一个 \fIarg\fR 执行路径搜索,以便确定要执行的脚本的名称。脚本 \fIarg\fR 必须具有执行权限,并且忽略任何 \fBsetuid\fR 和 \fBsetgid\fR 设置。如果未在此路径中找到脚本,则会处理 \fIarg\fR,就像指定了内置命令或函数一样。 
+如果使用 \fBexec\fR(2) 调用 shell,并且参数的第一个字符 0 (\fB$0\fR) 为 \fB-\fR,则假定此 shell 为登录 shell,并从 \fB/etc/profile\fR 读取命令,然后从 \fB$HOME/.profile\fR 中读取命令。接着,对于交互式 shell,首先从 \fB/etc/ksh.kshrc\fR 读取命令,然后从通过对环境变量 \fBENV\fR 的值执行参数扩展、命令替换和算术替换进行命名的文件中读取命令(如果存在此文件)。如果 \fB-s\fR 选项不存在,并且存在 \fIarg\fR 以及名为 \fIarg\fR 的文件,则会读取和执行此脚本。否则,如果第一个 \fIarg\fR 不包含 \fB/\fR,则会对第一个 \fIarg\fR 执行路径搜索,以便确定要执行的脚本的名称。脚本 \fIarg\fR 必须具有执行权限,并且忽略任何 \fBsetuid\fR 和 \fBsetgid\fR 设置。如果未在此路径中找到脚本,则会处理 \fIarg\fR,就像指定了内置命令或函数一样。 
 .sp
 .LP
 然后按照说明读取命令,并且 shell 会在调用时解释下列选项:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/CR7175995.patch	Tue Oct 09 00:20:06 2012 -0700
@@ -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
+@@ -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]==' ')
+@@ -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;