Hi Thorsten,

Sorry for the late reply, I have been away from home due to unexpected
family issues.

On ven., 2017-02-17 at 22:37 +0000, Thorsten Glaser wrote:
> Jean Delvare dixit:
> >Our previous products included ksh93.
> 
> OK. (Found out as well that ksh93 has print -e, which we had code
> for but no member in the getopt call…)

Good catch. As ‘\’ sequences are processed by default, the use cases
for -e must be fairly limited. As I understand it, the only purpose of
the option is to cancel a previous -r, which is kind of a corner case.
That must be why nobody noticed so far. But for compatibility with
other ksh implementations, I agree it is better to support it, so
thanks for having fixed it.

> (...)
> I looked at ksh93 and investigated several approaches and ended
> up codifying “as soon as -R is encountered, we jump into the BSD
> echo (formerly called Debian echo) codepath”.
> 
> This matches ksh93 in that things like a previous -n, -uN, -s, …
> are *not* reset:
> 
> tg@blau:/usr/src/bin/mksh $ obj/mksh -c 'print -u2 -R -42' >/dev/null
> -42
> 
> This allows your use cases:
> 
> tg@blau:/usr/src/bin/mksh $ obj/mksh -c 'print -R -n -4; print -R 2'
> -42

Looks good.

> Parsing after -R like ksh93 does is not supported:
> 
> tg@blau:/usr/src/bin/mksh $ ksh93 -c 'print -Rn foo; print bar'
> foobar
> tg@blau:/usr/src/bin/mksh $ obj/mksh -c 'print -Rn foo; print bar'
> foo
> bar
> 
> But:
> 
> tg@blau:/usr/src/bin/mksh $ obj/mksh -c 'print -R -n foo; print bar'
> foobar

Fair enough. I hope this minor incompatibility won't be a problem for
out customer.

> This will be in the next mksh release.

Thank you very much. I have backported your work to mksh R50 as this is
what our product includes, and will send to our customer shortly for
testing.

-- 
Jean Delvare
SUSE L3 Support

Reply via email to