The ksh(1) man page says that PPID should be a read-only variable.
This diff makes that happen. It does not work to combine the two
lines into "typeset -ir PPID" as the following session demonstrates:
  $ NUM=42
  $ typeset -ir NUM
  ksh: NUM: is read only

Curiously, I did this right the first time and tested it, but before
submitting it yesterday I changed it to the incorrect typeset -ir and
apparently failed to retest. I also submitted it from the command line
with the title "ksh ${PPID} should be read-only" and my shell helpfully
replaced ${PPID} with 641.

This change works correctly and hopefully has a correct subject line.

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      28 May 2016 20:37:25 -0000
@@ -85,6 +85,7 @@ static const char *initcoms [] = {
        "typeset", "-r", "KSH_VERSION", NULL,
        "typeset", "-x", "SHELL", "PATH", "HOME", NULL,
        "typeset", "-i", "PPID", NULL,
+       "typeset", "-r", "PPID", NULL,
        "typeset", "-i", "OPTIND=1", NULL,
        "eval", "typeset -i RANDOM MAILCHECK=\"${MAILCHECK-600}\" 
SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL,
        "alias",

Reply via email to