>Synopsis: ksh(pd) `typeset -p` lists all variables as readonly
System : OpenBSD 6.2
Details : OpenBSD 6.2 (GENERIC.MP) #5: Fri Feb 2 23:02:19 CET 2018
Machine : amd64
The ksh(1) man page describes the `-p` option as being equivalent
to the default of no parameters, but actually using the `-p` option
results in a very different output with the somewhat bizarre
behavior of prefixing each variable with "readonly "
From within ksh issue the command `typeset -p`
Within the source code (src/bin/ksh/c_ksh.c), the offending lines
test the pflag variable and if set test the variable `flag` instead
of testing `vp->flag` and further assume that the a shell variable
can only be EXPORT or RDONLY.
The following patch will fix that behavior but it still won't be
consistent with the manual. And the default printout and the `-p`
format of ksh93 is the reverse of what the fix will do, though that
seems to be what the code intended to do anyway.
Possibly a better fix would be to remove the special handling of
the `-p` format.