Breakage on Solaris under ISO-8859 locales
Reproduced. But yash does not seem to compile correctly on Solaris in the first place.
Yash's configuration header defines _XOPEN_SOURCE_EXTENDED to get the declaration of the "enhanced curses" features, but on Solaris this macro hides functions that are only available on XPG5 or later. The macro should not be defined on Solaris.
That said, just removing the macro definition did not fix the encoding issue.
It seems the wcsnrtombs function is broken on Solaris. If you comment out the HAVE_WCSNRTOMBS macro definition in config.h, yash no longer prints "yashbug".
Added a note in the README.
Yash 2.48 breaks badly on Solaris when an ISO-8859-* locale is active and any high-byte characters are processed.
Test script:
To trigger the bug, run this on Solaris with something like: LANG=nl_NL.ISO8859-1 yash test.sh
Symptoms:
Whether this is a Solaris bug or a yash bug, I couldn't say. However, yash seems to be the only shell exhibiting these symptoms on Solaris.
FYI, Solaris VMs can be downloaded and used free of charge for the purposes of software development and testing. See: https://www.oracle.com/technetwork/server-storage/solaris11/downloads/vm-templates-2245495.html