On Thu, May 26, 2016 at 11:00:39PM -0400, Anthony Coulter wrote:
> The man page for ksh says that ${PPID} should be read-only but
> apparently it is not. There is also a line nearby that is more
> than 80 characters long but I'm not comfortable enough with KNF
> to select the best way to fix that.
> 
> 
> Index: main.c
> ===================================================================
> RCS file: /cvs/src/bin/ksh/main.c,v
> retrieving revision 1.79
> diff -u -p -r1.79 main.c
> --- main.c    4 Mar 2016 15:11:06 -0000       1.79
> +++ main.c    27 May 2016 02:37:41 -0000
> @@ -84,7 +84,7 @@ static const char initsubs[] = "${PS2=> 
>  static const char *initcoms [] = {
>       "typeset", "-r", "KSH_VERSION", NULL,
>       "typeset", "-x", "SHELL", "PATH", "HOME", NULL,
> -     "typeset", "-i", "PPID", NULL,
> +     "typeset", "-ir", "PPID", NULL,

ksh won't start after this change.  The problem is that it will try to
assign the return value of getppid() to PPID *after* PPID was made read
only.

$ obj/ksh
obj/ksh: PPID: is read only
$ echo $?
1

Reply via email to