In present, semantics of xterm's OSC 12 sequence is always either one of "set cursor color" or "get cursor color". if the substring after ";" in an OSC 12 sequence means "set cursor color", It can never begin with "?", and if it means the other, It always begins with "?". So I think that this condition is necessary and sufficient for infinite echo loop problem.
On 2013/01/17, at 7:55, Nicholas Marriott wrote: > ok this makes more sense now thanks > > do we really need to drop all sequences starting with "?" or is it enough > to match only when it is only "?"? > > > On Thu, Jan 17, 2013 at 02:38:54AM +0900, Hayaki Saito wrote: >> >> Oh, I apologize for not providing you with enough explanation. >> I just noticed that this is configuration-specific issue. >> In order to reproduce this problem, we should enable visual bell. >> >>> set-option -g visual-bell on >> >> If we type this command on shell environment, ECHO-backed OSC sequences such >> as '\033]12;rgb:xx/xx/xx\033\\' will be emitted infinitely, >> >>> printf '\033]12;?\033\\' >> >> I found this problem on OSX 10.7 / Xterm patch level 288, at present. >> The another person seems to reproduce it on Ubuntu 12.10. >> >> I guess the process of this problem is as follows; >> >> 1. Tmux accepts '\033]12;?\033\\' as OSC sequence and misunderstand "?" as a >> "cursor color". >> So Tmux comes to emit '\033]12;?\033\\' every time the cursor is updated. >> However, according to Xterm's specification, this sequence does not mean >> "set cursor color", but "query cursor color". >> ref.http://invisible-island.net/xterm/ctlseqs/ctlseqs.html >> >> 2. Xterm replies current cursor color, such as '\033]12;rgb:xx/xx/xx\033\\', >> against this query. >> >> 3. bash / tcsh / zsh / ksh accepts it as key input, and it is echoed back to >> stout. >> Then the shell treats "\033]" or "\033\\" as invalid key sequences. >> typically they will emit BEL(^G). >> >> 4. Tmux accept BEL and does visual-bell action. >> status line is updated and cursor is updated again. >> >> They establishes the following circuit. it looks like an infinite echo loop. >> 1.cursor update -> 2.xterm's response -> 3.shell emits BEL -> 4.visual bell >> -> 1.cursor update -> ... >> >> On 2013/01/16, at 17:31, Nicholas Marriott wrote: >> >>> I don't understand what the problem is or how this fixes it. Where is ST >>> in your change? >>> >>> >>> On Wed, Jan 16, 2013 at 04:54:06PM +0900, Hayaki Saito wrote: >>>>> Is the ? in this diff supposed to be \\234? >>>> >>>> No, It's just a hot fix, for infinite echo problem. >>>> >>>> On 2013/01/15, at 13:26, Nicholas Marriott wrote: >>>> >>>>> Hi >>>>> >>>>> Why only check the first character of the string? >>>>> >>>>> Is the ? in this diff supposed to be \\234? >>>>> >>>>> >>>>> >>>>> >>>>> On Tue, Jan 01, 2013 at 11:51:24AM +0900, Hayaki Saito wrote: >>>>>> >>>>>> This is a hotfix patch for infinite echo loop issue which occurs with >>>>>> following shell command. >>>>>> >>>>>>> $ echo -en '\033]12;?\033\\' >>>>>> >>>>>> This problem occurs in some terminals that support OSC 12/get access >>>>>> feature (e.g. xterm). >>>>>> >>>>>> I think OSC 12 sequense should be completely parsed and validated. >>>>>> Some terminals like PuTTY accept 8bit ST (0x9c) control and treat it as >>>>>> OSC terminate character. >>>>>> So if cursor color string sequence includes 9c, it might cause >>>>>> unexpected behavior. >>>>>> >>>>>> --- >>>>>> input.c | 3 ++- >>>>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>>>> >>>>>> diff --git a/input.c b/input.c >>>>>> index 23b9574..9855324 100644 >>>>>> --- a/input.c >>>>>> +++ b/input.c >>>>>> @@ -1560,7 +1560,8 @@ input_exit_osc(struct input_ctx *ictx) >>>>>> server_status_window(ictx->wp->window); >>>>>> break; >>>>>> case 12: >>>>>> - screen_set_cursor_colour(ictx->ctx.s, p); >>>>>> + if (*p != '?') >>>>>> + screen_set_cursor_colour(ictx->ctx.s, p); >>>>>> break; >>>>>> case 112: >>>>>> if (*p == '\0') /* No arguments allowed. */ >>>>>> -- >>>>>> 1.7.11.5 >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS >>>>>> and more. Get SQL Server skills now (including 2012) with LearnDevNow - >>>>>> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts. >>>>>> SALE $99.99 this month only - learn more at: >>>>>> http://p.sf.net/sfu/learnmore_122512 >>>>>> _______________________________________________ >>>>>> tmux-users mailing list >>>>>> tmux-users@lists.sourceforge.net >>>>>> https://lists.sourceforge.net/lists/listinfo/tmux-users >>>> >> ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712 _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users