On Mon, Jan 08 2018, Jeremie Courreges-Anglas <[email protected]> wrote:
> On Mon, Jan 08 2018, Klemens Nanni <[email protected]> wrote:
>
> [...]
>
>> See attached diff for the first NOTES changes.
>
> [...]
>
>> Regarding "POSIX sh questions", we should probably unreference the 1992
>> standard.
>>
>> POSIX.1-2008, 2.6.2 Parameter Expansion:
>>
>> In each case that a value of word is needed (based on the state
>> of parameter, as described below), word shall be subjected to
>> tilde expansion, [...]
>
> Looks good, except you give no rationale for moving the FPATH quirk
> from "known differences [...] that are not likely to change" to "known
> differences [...] that may change".
>
> IIUC ksh93 now documents this behavior:
>
> FPATH The search path for function definitions. The
> directories in this path are searched for a file with the
> same name as the function or command when a function with
> the -u attribute is referenced and when a command is not
> found. If an executable file with the name of that
> command is found, then it is read and executed in the
> current environment. [...]
>
> (Actually ksh93 doesn't require the file to be executable.)
>
> Right now I'm tempted to leave the FPATH bits as is or to amend them,
> not to move them to the "may change later" section.
Another small round of fixes.
- unreadable/setuid scripts... what?
- BUG-REPORTS has been moved to Attic
- s/effect/affect where relevant
- tweak the note about FPATH
- pdksh "understand[s] C integer constants (ie, 0x123, 0177)"
I've been tempted to remove the second paragraph in POSIX sh bugs, but
I don't know whether ksh handles all the details of parameter
expansions.
Index: NOTES
===================================================================
RCS file: /cvs/src/bin/ksh/NOTES,v
retrieving revision 1.15
diff -u -p -r1.15 NOTES
--- NOTES 8 Jan 2018 13:39:06 -0000 1.15
+++ NOTES 8 Jan 2018 14:00:45 -0000
@@ -6,12 +6,10 @@ General features of at&t ksh88 that are
- signals/traps not cleared during functions.
- trap DEBUG, local ERR and EXIT traps in functions.
- ERRNO parameter.
- - use of an `agent' to execute unreadable/setuid/setgid shell scripts
- (don't ask).
- read/select aren't hooked in to the command line editor
- the last command of a pipeline is not run in the parent shell
-Known bugs (see also BUG-REPORTS and PROJECTS files):
+Known bugs (see also PROJECTS files):
Variable parsing, Expansion:
- some specials behave differently when unset (eg, IFS behaves like
" \t\n") others lose their special meaning. IFS/PATH taken care of,
@@ -25,9 +23,9 @@ Known bugs (see also BUG-REPORTS and PRO
Commands,Execution:
- setting special parameters that have side effects when
changed/restored (ie, HISTFILE, OPTIND, RANDOM) in front
- of a command (eg, HISTFILE=/foo/bar echo hi) effects the parent
+ of a command (eg, HISTFILE=/foo/bar echo hi) affects the parent
shell. Note that setting other (not so special) parameters
- does not effect the parent shell.
+ does not affect the parent shell.
- `echo hi | exec cat -n' causes at&t to exit, `exec echo hi | cat -n'
does not. pdksh exits for neither. Don't think POSIX requires
an exit, but not sure.
@@ -239,8 +237,8 @@ Oddities in ksh (pd & at&t):
- when tracing (set -x), and a command's stderr is redirected, the trace
output is also redirected. so "set -x; echo foo 2> /tmp/O > /dev/null"
will create /tmp/foo with the lines "+ > /dev/null" and "+ echo foo".
- - undocumented at&t ksh feature: FPATH is searched after PATH if no
- executable is found, even if typeset -uf wasn't used.
+ - undocumented at&t ksh88, documented in ksh93: FPATH is searched
+ after PATH if no executable is found, even if typeset -uf wasn't used.
POSIX sh questions (references are to POSIX 1003.2-1992)
- arithmetic expressions: how are empty expressions treated?
@@ -276,9 +274,6 @@ POSIX sh bugs (references are to POSIX 1
functions don't do the save/restore automatically). Restoring
OPTIND is kind of dumb since getopts may have been in the middle
of parsing a group of flags (eg, -abc).
- - unclear whether arithmetic expressions (eg, $((..))) should
- understand C integer constants (ie, 0x123, 0177). at&t ksh doesn't
- and neither does pdksh.
- `...` definition (3.6.3) says nothing about backslash followed by
a newline, which sh and at&t ksh strip out completely. e.g.,
$ show-args `echo 'X
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE