Re: FYI: ksh88 (/usr/xpg4/bin/sh) is not actually POSIX compliant

2017-10-01 Thread Chet Ramey
On 9/30/17 8:56 AM, Joerg Schilling wrote: > It may be that ksh86 did not support Bourne Shell functions, but ksh88 > definitely does. I believe that the name() { command; } syntax was in ksh86. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita

Re: FYI: ksh88 (/usr/xpg4/bin/sh) is not actually POSIX compliant

2017-10-01 Thread Chet Ramey
On 10/1/17 9:15 AM, Martijn Dekker wrote: > 2.9.4 Compound Commands > [...] > { compound-list ; } > Execute compound-list in the current process environment. > > This means any compound-command in that form (which therefore includes > any such compound-command that is the body of a function

Re: FYI: ksh88 (/usr/xpg4/bin/sh) is not actually POSIX compliant

2017-10-01 Thread Chet Ramey
On 9/30/17 8:58 AM, Joerg Schilling wrote: > Chet Ramey wrote: > >> This is from the ksh93 release documentation: >> >> 1. Functions, defined with name() with ksh-93 are compatible with >> the POSIX standard, not with ksh-88. No local variables are >>

Re: FYI: ksh88 (/usr/xpg4/bin/sh) is not actually POSIX compliant

2017-10-01 Thread Chet Ramey
On 9/30/17 9:01 AM, Joerg Schilling wrote: >> If I read the spec correctly, one should expect >> >> noglob() { set -f; } >> glob() { set +f; } >> >> noglob; echo *; glob >> >> to output *, but that doesn't work with /usr/xpg4/bin/sh on >> Solaris. >> >> Local scope for options is useful in

Re: FYI: ksh88 (/usr/xpg4/bin/sh) is not actually POSIX compliant

2017-10-01 Thread Chet Ramey
On 10/1/17 8:43 AM, Joerg Schilling wrote: > Martijn Dekker wrote: > >>> Such a text is however missing in POSIX. >> >> It is not missing. As previously shown (and you removed from the quoted >> text), the POSIX definition of a "function" incorporates the POSIX >> definition of

Re: FYI: ksh88 (/usr/xpg4/bin/sh) is not actually POSIX compliant

2017-10-01 Thread Joerg Schilling
Martijn Dekker wrote: > > This is an interesting behavior, but it is not related to local/dynamic > > scoping, since this is a test whether a function is run in a sub-shell. > > That's easy to disprove. I just did the the following on my Solaris 11.3 > VM using

Re: FYI: ksh88 (/usr/xpg4/bin/sh) is not actually POSIX compliant

2017-10-01 Thread Martijn Dekker
Op 01-10-17 om 12:58 schreef Joerg Schilling: > Martijn Dekker wrote: >> So the shell options don't change outside of the function, but the >> variable does. Which means that the function is not run in a subshell, >> and that shell options have a mandatory local scope, so

Re: FYI: ksh88 (/usr/xpg4/bin/sh) is not actually POSIX compliant

2017-10-01 Thread Joerg Schilling
Martijn Dekker wrote: > > Such a text is however missing in POSIX. > > It is not missing. As previously shown (and you removed from the quoted > text), the POSIX definition of a "function" incorporates the POSIX > definition of a "Compound Command". And that says: > > {

Re: FYI: ksh88 (/usr/xpg4/bin/sh) is not actually POSIX compliant

2017-10-01 Thread Martijn Dekker
Op 01-10-17 om 14:43 schreef Joerg Schilling: > The standard does not claim that a function has to be executed the same way > as > a compound ist would have been executed, or do you see such a claim in the > standard? > > The way I read the standard just mentions that the function body in a