ksh: hash (#) at beginning of a line exits the shell

This is WILD! :eek:

Under Ubuntu (where I am cross-posting this problem) I have lately noticed by terminal windows/tabs closing unexpectedly. I finally caught it: I was composing a complicated command so I practices it a few times commented out - that is, with a # at the start of the line. What is now happening is as follows:

  • If I start the line with #<white-space> i.e. a space or tab following the #, the shell abruptly exits.
  • If I start with the # and a letter, say l, it traces down my history for all old commands that started with l. When I add a letter to that - e.g. s, the list is pared down to all old commands [in my history] that had started with ls. As soon as my typed comment becomes fails to match anything in my history, it exits.
  • If there are any command lines in my history that did start with blanks (I've been experimenting) it pops those up, paring the list as I type characters, until it hits something not in my history. Then it exits. This is essentially the same as my point above.

This appears to be a bizarre setting or option in my history; that the hash activates a history search.

I don't want it! What is it and how do I turn it off? :wall:

The version I'm using is "Version JM 93u 2011-02-08".

This does not happen with bash; the first time I have found bash behaving better than ksh. Furthermore, after searching the ksh man page, it occurred to me to set -o emacs and try it. I still get the history search but it does not exit the shell upon confirmed mismatch.

Thanks for diagnosis/advice/help.
__________________
-- Rasputin Paskudniak II (In pursuit of undomesticated, semi-aquatic avians)

This is a known bug fixed in the last ksh release (ksh93u+).

11-09-20 A bug with SHOPT_EDPREDICT when neither vi or emacs was enabled for lines beginning with # when in a multibyte locale has been fixed.

Thank you, j.

I should have ended my initial post with "Don't tell me it's a bug!" Then I would have started this post with "I asked you not to tell me that." :rolleyes:

A bug?!! Imp-Possible! :eek: That is indeed disappointing.:mad:
HMM.. Perhaps there is some way to explicitly block this SHOPT_EDPREDICT option. Ubuntu's update manager is going to be a bit shy about including the 93u+ update all that fast.

OK, where can I download an installable package of ksh93-u+ for Debian/Ubuntu ?
__________________
-- Rasputin Paskudniak II (In pursuit of undomesticated, semi-aquatic avians)

As far as I know, SHOPT_EDPREDICT is only a compile time option, not something you can disable at run time. To get ksh93u+ on ubuntu, I guess you need to compile from source.