>  Nowhere did I deliberately do anything wrt. field splitting or not-
splitting or joining.

understood.

> I’m somewhat afraid even that, if this is wrong, it’s systematically
wrong somewhere…

could very well be. I even believe that ksh93 might also not do what it
should/intends to do at this point. e.g. the ksh93 manpages states:

```
The  meaning  of $* and $@ is identical when not quoted or when
       used as a variable assignment value or as a file name.   However,  when
       used  as a command argument, "$*" is equivalent to "$1d$2d...", where d
       is the first character of the IFS variable, whereas "$@" is  equivalent
       to  "$1" "$2" .... 
```

this (meaning of $* and $@ identical w/o quotes) seems definitely not
completely true considering (and skipping the array part since it seems
irrelevant to the problem):

```
set a 'b c'
IFS=,
print ' * : '$*
print '"*": '"$*"
print ' @ : '$@
print '"@": '"$@"
print ++++++++++++++
a=$*;   print ' * : '"$a"
a="$*"; print '"*": '"$a"
a=$@;   print ' @ : '"$a"
a="$@"; print '"@": '"$a" 
```

where

a=$*;   print ' * : '"$a"

produces different output than

a=$@;   print ' @ : '"$a"

(mksh does the same but seemingly does not explicitly claim what ksh does, here 
;)). do you agree?
in the above examples it seems that even when first assigning to `a', the 
expansion is only coming into effect in the subsequent print (where double 
quotes are used), like in a sort of "lazy evaluation". this is also true for

a=$*;   print ' * : '"$a"

vs.

a="$*"; print '"*": '"$a"

I wouldn't expect this. should I?


> What do the zsh developers say regarding this? I assume you also contacted 
> them?

no, not at all. I have decided quite some years ago that ?ksh?? is the
way to go for me;).

> What does the GNU bash developer say? Did you contact Chet?

sorry, no again, for the same reason: I always preferred ksh93 due to
its clear specification, additional useful features (rather than
feature-creep...) and much better performance.

> For that matter, situ (ksh2020), although I could talk to him directly
(#ksh on IRC).

well... I've had some contact to _that_ project during the last 2 months
or so. if `situ' is the same guy as "Siteshwar Vashisht", it might make
sense if you talk to him. he seems sensible as far as I can tell. but
what is going on in that project (the main committer there being some
ignoramus doing severe harm to the ksh93 legacy for the last two years
in a row, getting according feedback from assorted people -- I also
raised a few issues there recently and received astonishing reactions --
and basically misunderstanding or ignoring it completely) has made me
look for a viable alternative to (a no longer properly maintained) ksh93
(successor): hence mksh (plus a working binary of ksh93u+). so, given my
discouraging experience there I did not bother to raise this (in my view
sufficiently intricate) issue there... but maybe you'll have more luck.

-- 
You received this bug notification because you are a member of mksh
Mailing List, which is subscribed to mksh.
Matching subscriptions: mkshlist-to-mksh-bugmail
https://bugs.launchpad.net/bugs/1857195

Title:
  here string behaviour different in mksh and ksh93

Status in mksh:
  New

Bug description:
  consider

  IFS=$'\n'
  x=(a "b c")
  cat <<< ${x[*]}
  cat <<< "${x[*]}"
  cat <<< ${x[@]}
  cat <<< "${x[@]}"

  executing this in mksh (or zsh, incidentally) yields the output

  a
  b c
  a
  b c
  a
  b c
  a
  b c

  (i.e. identical output, always inserting first IFS char between
  elements, for all variants of accessing all elements of the array)
  while ksh93 (or bash, for that matter) yields

  a
  b c
  a
  b c
  a b c
  a b c

  (i.e. `*' behaves different from `@' but double quoting is
  ineffectual).

  I am not sure whether this is a bug (either in ksh93 or mksh) but wanted to 
report this inconsistency and to ask for clarification. what I _would_ have 
expected to start with is, that
  the above "here string" commands would yield the same output as

  print ${x[*]}
  print "${x[*]}"
  print ${x[@]}
  print "${x[@]}"

  which is neither true for ksh93 nor for mksh. is this all good and
  well and I am only overlooking something obvious?

To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1857195/+subscriptions

Reply via email to