** Changed in: mksh Status: Fix Committed => Fix Released -- 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/1380389
Title: x=<< functionality cannot be used in functions Status in mksh: Fix Released Bug description: Several bugs with this construct: x=<<EOF foo EOF x+=<< foo << 1. It cannot be used in functions: assignment is done at parse time 2. It uses ATEMP of parse time, which is gone at runtime in functions ⇒ hides first bug unless exec.c alloc(z * 2 + n, ATEMP) → APERM 3. Size calculations not fully checked, one too big ⇒ (z-1) * 2 + 1 /* EOS */ + n Ad 1: (sid-amd64)tglase@tglase:~/b $ ./mksh ~/x a abla5424 bar abla5424 bar bla5424 bar function bar { x+=\b\l\a\5\4\2\4\ \b\a\r\ } (sid-amd64)tglase@tglase:~/b $ cat ~/x function bar { x+=<< bla$RANDOM bar << } x=a echo $x bar echo $x bar echo $x typeset -f bar Substitution happens at first use: (sid-amd64)tglase@tglase:~/b $ ./mksh ~/x2 function bar { x=<< bla$RANDOM bar << } function bar { x=\b\l\a\1\2\2\8\1\ \b\a\r\ } (sid-amd64)tglase@tglase:~/b $ /bin/mksh ~/x2 function bar { x=<< bla$RANDOM bar << } function bar { x=\b\l\a\2\6\7\7\9\ \b\a\r\ } (sid-amd64)tglase@tglase:~/b $ cat ~/x2 function bar { x=<< bla$RANDOM bar << } typeset -f bar bar typeset -f bar So this is even worse than thought, the ATEMP context is the one from the first use of the function… This was introduced in R40, when the x=<< syntax was added. To manage notifications about this bug go to: https://bugs.launchpad.net/mksh/+bug/1380389/+subscriptions