From ariel at pixelcr.com Tue Oct 2 22:47:18 2012 From: ariel at pixelcr.com (arielcr) Date: Tue, 2 Oct 2012 15:47:18 -0700 (PDT) Subject: MC dive into subdir Message-ID: <34505953.post@talk.nabble.com> Hi, what does "dive into subdir" option do? I've just move an entire directory to another directory using this option, and it created some directories inside the directories. The directory where i moved the file was the same, but like 1 week older, it was supposed to replace the old files, or not? -- View this message in context: http://old.nabble.com/MC-dive-into-subdir-tp34505953p34505953.html Sent from the Gnu MC - General mailing list archive at Nabble.com. From aborodin at vmail.ru Wed Oct 10 05:18:05 2012 From: aborodin at vmail.ru (Andrew Borodin) Date: Wed, 10 Oct 2012 09:18:05 +0400 Subject: MC dive into subdir In-Reply-To: <34505953.post@talk.nabble.com> References: <34505953.post@talk.nabble.com> Message-ID: On Tue, 2 Oct 2012 15:47:18 -0700 (PDT) arielcr wrote: > Hi, what does "dive into subdir" option do? > > I've just move an entire directory to another directory using this option, > and it created some directories inside the directories. The directory where > i moved the file was the same, but like 1 week older, it was supposed to > replace the old files, or not? That is described in the internal help. Just read it. -- Andrew From SchwarzerA at messe-duesseldorf.de Tue Oct 16 10:43:57 2012 From: SchwarzerA at messe-duesseldorf.de (Schwarzer, Axel) Date: Tue, 16 Oct 2012 12:43:57 +0200 Subject: root can not save files anymore Message-ID: <5A22EDEAB4199B41BAB4EE74EB8F5EE604F93AFE97@1-EXMBX.messe-duesseldorf.de> Hello, With the switch to openSUSE 12.2 (from 11.4) root is not able to edit (and save) files. That holds true for existing and newly created ones. Currently I'm unable to figure out the underlying problem. Other editors work as expected. Even a strace provided me with no hints. My system consists of: Linux lnx30 3.4.11-2.16-default #1 SMP Wed Sep 26 17:05:00 UTC 2012 (259fc87) x86_64 x86_64 x86_64 GNU/Linux mc-4.8.1.3-4.1.2.x86_64 Please find the ini (after automatic relocation) afterwards: ---8<--- lnx30:~/.config/mc # cat ini [Midnight-Commander] verbose=1 pause_after_run=1 shell_patterns=1 auto_save_setup=1 auto_menu=0 use_internal_view=1 use_internal_edit=1 clear_before_exec=1 confirm_delete=1 confirm_overwrite=1 confirm_execute=0 confirm_history_cleanup=0 confirm_exit=0 confirm_directory_hotlist_delete=0 safe_delete=1 mouse_repeat_rate=100 double_click_speed=250 use_8th_bit_as_meta=0 confirm_view_dir=0 mouse_move_pages_viewer=1 mouse_close_dialog=0 fast_refresh=0 drop_menus=0 wrap_mode=0 old_esc_mode=0 old_esc_mode_timeout=1000000 cd_symlinks=1 show_all_if_ambiguous=1 max_dirt_limit=10 torben_fj_mode=0 use_file_to_guess_type=1 alternate_plus_minus=0 only_leading_plus_minus=1 show_output_starts_shell=0 xtree_mode=0 num_history_items_recorded=60 file_op_compute_totals=1 classic_progressbar=1 vfs_timeout=60 ftpfs_directory_timeout=900 use_netrc=1 ftpfs_retry_seconds=30 ftpfs_always_use_proxy=0 ftpfs_use_passive_connections=1 ftpfs_use_passive_connections_over_proxy=0 ftpfs_use_unix_list_options=1 ftpfs_first_cd_then_ls=1 fish_directory_timeout=900 editor_tab_spacing=8 editor_word_wrap_line_length=72 editor_fill_tabs_with_spaces=0 editor_return_does_auto_indent=0 editor_backspace_through_tabs=0 editor_fake_half_tabs=0 editor_option_save_mode=2 editor_option_save_position=0 editor_option_auto_para_formatting=0 editor_option_typewriter_wrap=0 editor_edit_confirm_save=0 editor_syntax_highlighting=1 editor_persistent_selections=1 editor_cursor_beyond_eol=0 editor_visible_tabs=1 editor_visible_spaces=1 editor_line_state=0 editor_simple_statusbar=0 editor_check_new_line=1 editor_show_right_margin=0 nice_rotating_dash=1 mcview_remember_file_position=0 auto_fill_mkdir_name=1 copymove_persistent_attr=1 select_flags=6 editor_backup_extension=~ mcview_eof= kilobyte_si=0 mix_all_files=0 show_backups=1 show_dot_files=1 fast_reload=0 fast_reload_msg_shown=0 mark_moves_down=1 reverse_files_only=1 navigate_with_arrows=0 scroll_pages=1 mouse_move_pages=1 filetype_mode=1 permission_mode=0 quick_search_case_sensitive=2 ignore_ftp_chattr_errors=true keymap=mc.keymap skin=default preallocate_space=0 editor_group_undo=0 [Layout] message_visible=0 keybar_visible=1 xterm_title=0 output_lines=0 command_prompt=1 menubar_visible=0 show_mini_info=1 free_space=1 horizontal_split=0 vertical_equal=1 left_panel_size=66 horizontal_equal=1 top_panel_size=66 [Misc] timeformat_recent=%b %e %H:%M timeformat_old=%b %e %Y ftp_proxy_host=gate ftpfs_password=anonymous@ display_codepage=ASCII source_codepage=Other_8_bit autodetect_codeset= clipboard_store= clipboard_paste= [Colors] base_color= xterm= color_terminals= linux= [Panels] simple_swap=false kilobyte_si=false mix_all_files=false show_backups=true show_dot_files=true fast_reload=false fast_reload_msg_shown=false mark_moves_down=true reverse_files_only=true auto_save_setup_panels=true navigate_with_arrows=true panel_scroll_pages=true mouse_move_pages=true filetype_mode=true permission_mode=false quick_search_mode=2 show_mini_info=true torben_fj_mode=false [terminal:xterm] f13=\\e[1\;2P f14=\\e[1\;2Q f15=\\e[1\;2R f16=\\e[1\;2S f17=\\e[15\;2~ f19=\\e[18\;2~ f20=\\e[19\;2~ kpasterisk=\\eOj f18=\\e[17\;2~ [Panelize] Find *.orig after patching=find . -name \\*.orig -print Find SUID and SGID programs=find . \\( \\( -perm -04000 -a -perm +011 \\) -o \\( -perm -02000 -a -perm +01 \\) \\) -print Find rejects after patching=find . -name \\*.rej -print ---8<--- Can you recommend something for a solution? Thank you in advance. -- Mit freundlichem Gruss/Kind regards -Axel Schwarzer- ___________________________________________________________________________ Key-FingerPrint: 0E18 D30F B175 1D09 7E55 B0F2 A09A 4F8E E5A8 4570 ___________________________________________________________________________ Messe D?sseldorf GmbH tel +49 211 45 60-294 G2-IT, Systemtechnik/System Technology tfx +49 211 45 60-87 294 Axel Schwarzer (Syst. Prog) tfx +49 211 454 23 11 Messeplatz cell phone +49 151 16 23 19 15 40474 Duesseldorf mailto:SchwarzerA at messe-duesseldorf.de Germany http://www.messe-duesseldorf.de/ http://www.messe-duesseldorf.com/ From mrmazda at earthlink.net Sun Oct 21 21:10:55 2012 From: mrmazda at earthlink.net (Felix Miata) Date: Sun, 21 Oct 2012 17:10:55 -0400 Subject: root can not save files anymore In-Reply-To: <5A22EDEAB4199B41BAB4EE74EB8F5EE604F93AFE97@1-EXMBX.messe-duesseldorf.de> References: <5A22EDEAB4199B41BAB4EE74EB8F5EE604F93AFE97@1-EXMBX.messe-duesseldorf.de> Message-ID: <508464DF.2020607@earthlink.net> On 2012-10-16 12:43 (GMT+0200) Schwarzer, Axel composed: > With the switch to openSUSE 12.2 (from 11.4) root is not able to Via fresh install, or an update? If the latter, how was it done? > edit (and save) files. That holds true for existing and newly created > ones. Currently I'm unable to figure out the underlying problem. > Other editors work as expected. Even a strace provided me with no > hints. This does not happen on any of my dozen+ 12.2 systems, though I don't run that broken mc version. I have 4.8.3-7.1 from the build service on some, and the current version from the Factory mirrors on others. Also, I do not migrate settings to ~/.config. I create a symlink there from ~/.mc. > My system consists of: > Linux lnx30 3.4.11-2.16-default #1 SMP Wed Sep 26 17:05:00 UTC 2012 (259fc87) x86_64 x86_64 x86_64 GNU/Linux What root filesystem? > mc-4.8.1.3-4.1.2.x86_64 OpenSUSE rpm? Things I would try: Force fsck on the root filesystem. Upgrade to the Factory version. -- "The wise are known for their understanding, and pleasant words are persuasive." Proverbs 16:21 (New Living Translation) Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata *** http://fm.no-ip.com/ From vda.linux at googlemail.com Mon Oct 22 14:49:40 2012 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Mon, 22 Oct 2012 16:49:40 +0200 Subject: [PATCH 0/5] keyboard input: stop generating garbage input from unknown ESC sequences Message-ID: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> I got tired of seeing garbage when I press function key MC doesn't know. This changeset attempts to eradicate this problem. Denys Vlasenko (5): keyboard input: simplify code, no logic changes keyboard input: add commented-out debugging logging mechanism. keyboard input: remove unreachable code keyboard input: treat only ESC or as valid keyboard input: when an unknown sequence is seen, purge all buffered input lib/tty/key.c | 204 ++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 136 insertions(+), 68 deletions(-) -- 1.7.7.6 From vda.linux at googlemail.com Mon Oct 22 14:49:41 2012 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Mon, 22 Oct 2012 16:49:41 +0200 Subject: [PATCH 1/5] keyboard input: simplify code, no logic changes In-Reply-To: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> References: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> Message-ID: <1350917385-12545-2-git-send-email-vda.linux@googlemail.com> This change slightly simplifies and rearranges the code in get_key_code(), reduces indentation levels there, adds a few comments. The logic remains the same. This is a preparatory patch for subsequent changes. Signed-off-by: Denys Vlasenko --- lib/tty/key.c | 126 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 63 insertions(+), 63 deletions(-) diff --git a/lib/tty/key.c b/lib/tty/key.c index f050202..d2142fa 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -1847,7 +1847,7 @@ get_key_code (int no_delay) pending_keys = NULL; seq_append = NULL; } - if ((d == ESC_CHAR) && (pending_keys != NULL)) + else if (d == ESC_CHAR) { d = ALT (*pending_keys++); goto check_pend; @@ -1928,49 +1928,12 @@ get_key_code (int no_delay) this = keys->child; } } + while (this != NULL) { if (c == this->ch) { - if (this->child) - { - if (!push_char (c)) - { - pending_keys = seq_buffer; - goto pend_send; - } - parent = this; - this = this->child; - if (parent->action == MCKEY_ESCAPE && old_esc_mode) - { - if (no_delay) - { - GET_TIME (esctime); - if (this == NULL) - { - /* Shouldn't happen */ - fputs ("Internal error\n", stderr); - exit (EXIT_FAILURE); - } - goto nodelay_try_again; - } - esctime.tv_sec = -1; - c = xgetch_second (); - if (c == -1) - { - pending_keys = seq_append = NULL; - this = NULL; - return ESC_CHAR; - } - } - else - { - if (no_delay) - goto nodelay_try_again; - c = tty_lowlevel_getch (); - } - } - else + if (!this->child) { /* We got a complete match, return and reset search */ int code; @@ -1980,36 +1943,73 @@ get_key_code (int no_delay) this = NULL; return correct_key_code (code); } - } - else - { - if (this->next != NULL) - this = this->next; - else + /* No match yet, but it may be a prefix for a valid seq */ + + if (!push_char (c)) { - if ((parent != NULL) && (parent->action == MCKEY_ESCAPE)) + pending_keys = seq_buffer; + goto pend_send; + } + parent = this; + this = this->child; + if (parent->action == MCKEY_ESCAPE && old_esc_mode) + { + if (no_delay) + { + GET_TIME (esctime); + if (this == NULL) + { + /* Shouldn't happen */ + fputs ("Internal error\n", stderr); + exit (EXIT_FAILURE); + } + goto nodelay_try_again; + } + esctime.tv_sec = -1; + c = xgetch_second (); + if (c == -1) { - /* Convert escape-digits to F-keys */ - if (g_ascii_isdigit (c)) - c = KEY_F (c - '0'); - else if (c == ' ') - c = ESC_CHAR; - else - c = ALT (c); - pending_keys = seq_append = NULL; this = NULL; - return correct_key_code (c); + return ESC_CHAR; } - /* Did not find a match or {c} was changed in the if above, - so we have to return everything we had skipped - */ - push_char (c); - pending_keys = seq_buffer; - goto pend_send; + continue; } + if (no_delay) + goto nodelay_try_again; + c = tty_lowlevel_getch (); + continue; } - } + + /* c != this->ch. Try other keys with this prefix */ + if (this->next != NULL) { + this = this->next; + continue; + } + + /* No match found. Is it one of our ESC specials? */ + if ((parent != NULL) && (parent->action == MCKEY_ESCAPE)) + { + /* Convert escape-digits to F-keys */ + if (g_ascii_isdigit (c)) + c = KEY_F (c - '0'); + else if (c == ' ') + c = ESC_CHAR; + else + c = ALT (c); + + pending_keys = seq_append = NULL; + this = NULL; + return correct_key_code (c); + } + + /* Unknown sequence. Maybe a prefix of a longer one. Save it. */ + push_char (c); + pending_keys = seq_buffer; + goto pend_send; + + } /* while (this != NULL) */ + this = NULL; return correct_key_code (c); } -- 1.7.7.6 From vda.linux at googlemail.com Mon Oct 22 14:49:44 2012 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Mon, 22 Oct 2012 16:49:44 +0200 Subject: [PATCH 4/5] keyboard input: treat only ESC or as valid In-Reply-To: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> References: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> Message-ID: <1350917385-12545-5-git-send-email-vda.linux@googlemail.com> This change prevents misinterpreting an unknown ESC sequence's tail as a garbage input. To reproduce, run "sleep 3" and hold down Down_Arrow key until sleep runs. With debugging log enabled, the following can be seen: entered get_key_code(no_delay:0) c=tty_lowlevel_getch()=27 push_char(27) !0 c=xgetch_second()=91 push_char(91) !0 2 c=tty_lowlevel_getch()=66 push_char(66) seq_buffer[0]:27 <---- the saved Down Arrow sequence "ESC [ B" seq_buffer[1]:91 seq_buffer[2]:66 seq_buffer[3]:0 pending_keys!=NULL. m=-1 d=*pending_keys++=27 d=ALT(*pending_keys++)=ALT(91)=8283 ^^^^^^^^^^^^^^^^^^^^^^^ we misinterpret "ESC [ B" as "ESC [" return correct_key_code(8283) entered get_key_code(no_delay:0) pending_keys!=NULL. m=-1 d=*pending_keys++=66 ^^^^^^^^^^^^ we think user pressed "B" return correct_key_code(66) With this patch, no bogus "input" is generated. Longer unknown sequences need an additional fix, coming next. Signed-off-by: Denys Vlasenko --- lib/tty/key.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/tty/key.c b/lib/tty/key.c index 77185ce..9b97aa8 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -1874,7 +1874,6 @@ get_key_code (int no_delay) { int d = *pending_keys++; keylog (" d=*pending_keys++=%d\n", d); - check_pend: if (*pending_keys == 0) { pending_keys = NULL; @@ -1882,9 +1881,17 @@ get_key_code (int no_delay) } else if (d == ESC_CHAR) { + int bad_seq; d = ALT (*pending_keys++); keylog (" d=ALT(*pending_keys++)=ALT(%d)=%d\n", pending_keys[-1], d); - goto check_pend; + bad_seq = (*pending_keys != ESC_CHAR && *pending_keys != 0); + if (*pending_keys == 0 || bad_seq) + { + pending_keys = NULL; + seq_append = NULL; + } + if (bad_seq) + goto nodelay_try_again; } if ((d > 127 && d < 256) && use_8th_bit_as_meta) { -- 1.7.7.6 From vda.linux at googlemail.com Mon Oct 22 14:49:43 2012 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Mon, 22 Oct 2012 16:49:43 +0200 Subject: [PATCH 3/5] keyboard input: remove unreachable code In-Reply-To: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> References: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> Message-ID: <1350917385-12545-4-git-send-email-vda.linux@googlemail.com> With the recently rearranged code, it's easy to see that "this == NULL" can't be true here: note -> if (!this->child) { ... return correct_key_code (code); } if (!push_char (c)) { ... goto pend_send; } keylog (" push_char(%d) ok\n", c); parent = this; never NULL->this = this->child; if (parent->action == MCKEY_ESCAPE && old_esc_mode) { if (no_delay) { GET_TIME (esctime); can't be true----> if (this == NULL) This patch removes that if(). Signed-off-by: Denys Vlasenko --- lib/tty/key.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/lib/tty/key.c b/lib/tty/key.c index 33732db..77185ce 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -1999,12 +1999,6 @@ get_key_code (int no_delay) if (no_delay) { GET_TIME (esctime); - if (this == NULL) - { - /* Shouldn't happen */ - fputs ("Internal error\n", stderr); - exit (EXIT_FAILURE); - } goto nodelay_try_again; } esctime.tv_sec = -1; -- 1.7.7.6 From vda.linux at googlemail.com Mon Oct 22 14:49:42 2012 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Mon, 22 Oct 2012 16:49:42 +0200 Subject: [PATCH 2/5] keyboard input: add commented-out debugging logging mechanism. In-Reply-To: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> References: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> Message-ID: <1350917385-12545-3-git-send-email-vda.linux@googlemail.com> Figuring out what exactly happens in get_key_code() when user uses various function keys is not trivial. While working on some fixes, I added a debugging code which records a log in /tmp/mc_key.log; I would like to save future developers from doing this again. This patch adds my debugging code, disabled via "#if 0". Signed-off-by: Denys Vlasenko --- lib/tty/key.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-) diff --git a/lib/tty/key.c b/lib/tty/key.c index d2142fa..33732db 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -1811,6 +1811,34 @@ is_idle (void) } /* --------------------------------------------------------------------------------------------- */ +#if 0 +# define key_debug 1 +static void keylog (const char *fmt, ...) +{ + static int logfd = -1; + + if (logfd < 0) { + logfd = open ("/tmp/mc_key.log", O_CREAT | O_WRONLY | O_APPEND, 0666); + if (logfd < 0) + return; + } + + va_list ap; + va_start (ap, fmt); + char *p = NULL; + vasprintf (&p, fmt, ap); + va_end (ap); + + if (p) + { + write (logfd, p, strlen(p)); + free (p); + } +} +#else +# define key_debug 0 +# define keylog(...) ((void)0) +#endif int get_key_code (int no_delay) @@ -1820,6 +1848,8 @@ get_key_code (int no_delay) static struct timeval esctime = { -1, -1 }; static int lastnodelay = -1; + keylog ("entered %s(no_delay:%d)\n", __func__, no_delay); + if (no_delay != lastnodelay) { this = NULL; @@ -1832,15 +1862,18 @@ get_key_code (int no_delay) int m; m = parse_extended_mouse_coordinates (); + keylog (" pending_keys!=NULL. m=%d\n", m); if (m == 1) { pending_keys = seq_append = NULL; this = NULL; + keylog ("return MCKEY_EXTENDED_MOUSE\n"); return MCKEY_EXTENDED_MOUSE; } if (m == -1) { int d = *pending_keys++; + keylog (" d=*pending_keys++=%d\n", d); check_pend: if (*pending_keys == 0) { @@ -1850,11 +1883,16 @@ get_key_code (int no_delay) else if (d == ESC_CHAR) { d = ALT (*pending_keys++); + keylog (" d=ALT(*pending_keys++)=ALT(%d)=%d\n", pending_keys[-1], d); goto check_pend; } if ((d > 127 && d < 256) && use_8th_bit_as_meta) + { d = ALT (d & 0x7f); + keylog (" d=ALT(d & 0x7f)=ALT(%d)=%d\n", d & 0x7f, d); + } this = NULL; + keylog ("return correct_key_code(%d)\n", d); return correct_key_code (d); } /* else if (m == 0), just let it continue */ @@ -1865,6 +1903,7 @@ get_key_code (int no_delay) tty_nodelay (TRUE); c = tty_lowlevel_getch (); + keylog (" c=tty_lowlevel_getch()=%d\n", c); #if (defined(USE_NCURSES) || defined(USE_NCURSESW)) && defined(KEY_RESIZE) if (c == KEY_RESIZE) goto nodelay_try_again; @@ -1941,15 +1980,18 @@ get_key_code (int no_delay) pending_keys = seq_append = NULL; code = this->code; this = NULL; + keylog ("2 return correct_key_code(%d)\n", code); return correct_key_code (code); } /* No match yet, but it may be a prefix for a valid seq */ if (!push_char (c)) { + keylog (" push_char(%d) failure (no more space)\n", c); pending_keys = seq_buffer; goto pend_send; } + keylog (" push_char(%d) ok\n", c); parent = this; this = this->child; if (parent->action == MCKEY_ESCAPE && old_esc_mode) @@ -1967,10 +2009,12 @@ get_key_code (int no_delay) } esctime.tv_sec = -1; c = xgetch_second (); + keylog (" c=xgetch_second()=%d\n", c); if (c == -1) { pending_keys = seq_append = NULL; this = NULL; + keylog ("return ESC_CHAR\n"); return ESC_CHAR; } continue; @@ -1978,6 +2022,7 @@ get_key_code (int no_delay) if (no_delay) goto nodelay_try_again; c = tty_lowlevel_getch (); + keylog (" 2 c=tty_lowlevel_getch()=%d\n", c); continue; } @@ -2000,17 +2045,27 @@ get_key_code (int no_delay) pending_keys = seq_append = NULL; this = NULL; + keylog ("3 return correct_key_code(%d)\n", c); return correct_key_code (c); } /* Unknown sequence. Maybe a prefix of a longer one. Save it. */ + keylog (" push_char(%d)\n", c); push_char (c); + if (key_debug) + { + int i = 0; + do + keylog (" seq_buffer[%d]:%d\n", i, seq_buffer[i]); + while (seq_buffer[i++]); + } pending_keys = seq_buffer; goto pend_send; } /* while (this != NULL) */ this = NULL; + keylog ("4 return correct_key_code(%d)\n", c); return correct_key_code (c); } -- 1.7.7.6 From vda.linux at googlemail.com Mon Oct 22 14:49:45 2012 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Mon, 22 Oct 2012 16:49:45 +0200 Subject: [PATCH 5/5] keyboard input: when an unknown sequence is seen, purge all buffered input In-Reply-To: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> References: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> Message-ID: <1350917385-12545-6-git-send-email-vda.linux@googlemail.com> When we see an unknown sequence, it is not enough to drop already received part - there can be more of it coming over e.g. a serial line. To prevent interpreting it as a random garbage, eat and discard all chars that follow. Small, but non-zero timeout is needed to reconnect escape sequence split up by a serial line. 50 milliseconds seem to work well. Before this change, Ctrl-Alt-Shift-Right_Arrow generates "1;8C" bogus "input" in MC on my machine; after the change, nothing is generated. Signed-off-by: Denys Vlasenko --- lib/tty/key.c | 22 +++++++++++++++++----- 1 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/tty/key.c b/lib/tty/key.c index 9b97aa8..593d0f6 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -1216,14 +1216,14 @@ correct_key_code (int code) /* --------------------------------------------------------------------------------------------- */ static int -xgetch_second (void) +getch_with_timeout (unsigned delay_ms) { fd_set Read_FD_Set; int c; struct timeval time_out; - time_out.tv_sec = old_esc_mode_timeout / 1000000; - time_out.tv_usec = old_esc_mode_timeout % 1000000; + time_out.tv_sec = delay_ms / 1000000u; + time_out.tv_usec = delay_ms % 1000000u; tty_nodelay (TRUE); FD_ZERO (&Read_FD_Set); FD_SET (input_fd, &Read_FD_Set); @@ -1891,7 +1891,19 @@ get_key_code (int no_delay) seq_append = NULL; } if (bad_seq) + { + /* This is an unknown ESC sequence. + * To prevent interpreting its tail as a random garbage, + * eat and discard all buffered and quickly following chars. + * Small, but non-zero timeout is needed to reconnect + * escape sequence split up by e.g. a serial line. + * 50 milliseconds seems to work well. + */ + int paranoia = 20; + while (getch_with_timeout (50*1000) >= 0 && --paranoia != 0) + continue; goto nodelay_try_again; + } } if ((d > 127 && d < 256) && use_8th_bit_as_meta) { @@ -2009,8 +2021,8 @@ get_key_code (int no_delay) goto nodelay_try_again; } esctime.tv_sec = -1; - c = xgetch_second (); - keylog (" c=xgetch_second()=%d\n", c); + c = getch_with_timeout (old_esc_mode_timeout); + keylog (" c=getch_with_timeout(%d)=%d\n", old_esc_mode_timeout, c); if (c == -1) { pending_keys = seq_append = NULL; -- 1.7.7.6 From ossi at kde.org Wed Oct 24 07:54:30 2012 From: ossi at kde.org (Oswald Buddenhagen) Date: Wed, 24 Oct 2012 09:54:30 +0200 Subject: [PATCH 5/5] keyboard input: when an unknown sequence is seen, purge all buffered input In-Reply-To: <1350917385-12545-6-git-send-email-vda.linux@googlemail.com> References: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> <1350917385-12545-6-git-send-email-vda.linux@googlemail.com> Message-ID: <20121024075429.GA24282@ugly.local> On Mon, Oct 22, 2012 at 04:49:45PM +0200, Denys Vlasenko wrote: > 50 milliseconds seem to work well. > why don't you use the existing timeout? it exists exactly for this purpose. From vda.linux at googlemail.com Thu Oct 25 14:45:06 2012 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Thu, 25 Oct 2012 16:45:06 +0200 Subject: [PATCH 5/5 v2] keyboard input: when an unknown sequence is seen, purge all buffered input Message-ID: <1351176306-23071-1-git-send-email-vda.linux@googlemail.com> When we see an unknown sequence, it is not enough to drop already received part - there can be more of it coming over e.g. a serial line. To prevent interpreting it as a random garbage, eat and discard all chars that follow. Small, but non-zero timeout is needed to reconnect escape sequence split up by a serial line. Before this change, Ctrl-Alt-Shift-Right_Arrow generates "1;8C" bogus "input" in MC on my machine; after the change, nothing is generated. Signed-off-by: Denys Vlasenko --- lib/tty/key.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/tty/key.c b/lib/tty/key.c index 9b97aa8..818b2e6 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -1216,14 +1216,14 @@ correct_key_code (int code) /* --------------------------------------------------------------------------------------------- */ static int -xgetch_second (void) +getch_with_timeout (unsigned delay_us) { fd_set Read_FD_Set; int c; struct timeval time_out; - time_out.tv_sec = old_esc_mode_timeout / 1000000; - time_out.tv_usec = old_esc_mode_timeout % 1000000; + time_out.tv_sec = delay_us / 1000000u; + time_out.tv_usec = delay_us % 1000000u; tty_nodelay (TRUE); FD_ZERO (&Read_FD_Set); FD_SET (input_fd, &Read_FD_Set); @@ -1891,7 +1891,18 @@ get_key_code (int no_delay) seq_append = NULL; } if (bad_seq) + { + /* This is an unknown ESC sequence. + * To prevent interpreting its tail as a random garbage, + * eat and discard all buffered and quickly following chars. + * Small, but non-zero timeout is needed to reconnect + * escape sequence split up by e.g. a serial line. + */ + int paranoia = 20; + while (getch_with_timeout (old_esc_mode_timeout) >= 0 && --paranoia != 0) + continue; goto nodelay_try_again; + } } if ((d > 127 && d < 256) && use_8th_bit_as_meta) { @@ -2009,8 +2020,8 @@ get_key_code (int no_delay) goto nodelay_try_again; } esctime.tv_sec = -1; - c = xgetch_second (); - keylog (" c=xgetch_second()=%d\n", c); + c = getch_with_timeout (old_esc_mode_timeout); + keylog (" c=getch_with_timeout(%d)=%d\n", old_esc_mode_timeout, c); if (c == -1) { pending_keys = seq_append = NULL; -- 1.7.7.6 From vda.linux at googlemail.com Thu Oct 25 14:46:37 2012 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Thu, 25 Oct 2012 16:46:37 +0200 Subject: [PATCH 5/5] keyboard input: when an unknown sequence is seen, purge all buffered input In-Reply-To: <20121024075429.GA24282@ugly.local> References: <1350917385-12545-1-git-send-email-vda.linux@googlemail.com> <1350917385-12545-6-git-send-email-vda.linux@googlemail.com> <20121024075429.GA24282@ugly.local> Message-ID: On Wed, Oct 24, 2012 at 9:54 AM, Oswald Buddenhagen wrote: > On Mon, Oct 22, 2012 at 04:49:45PM +0200, Denys Vlasenko wrote: >> 50 milliseconds seem to work well. > > why don't you use the existing timeout? it exists exactly for this > purpose. Good idea, I just sent an updated patch #5. (It also fixes a badly named delay_ms parameter - it was meant to be delay_us). Thanks! -- vda From kovzol at particio.com Fri Oct 26 14:14:41 2012 From: kovzol at particio.com (=?UTF-8?B?S292w6FjcyBab2x0w6Fu?=) Date: Fri, 26 Oct 2012 16:14:41 +0200 Subject: mc-devel Digest, Vol 99, Issue 6 In-Reply-To: References: Message-ID: Dear mc-devel, I learned that fish in mc does not copy files correctly when a @ character is present in the file name. It assumes that a network copying is required, but it is not the case. Is this enough for a normal bug report? I use 4.8.1 (3:4.8.1-4 in an Ubuntu box). Thank you and best regards, Zoltan -------------- next part -------------- An HTML attachment was scrubbed... URL: From aborodin at vmail.ru Sat Oct 27 05:14:51 2012 From: aborodin at vmail.ru (Andrew Borodin) Date: Sat, 27 Oct 2012 09:14:51 +0400 Subject: Bugreports In-Reply-To: References: Message-ID: On Fri, 26 Oct 2012 16:14:41 +0200 Kov?cs Zolt?n wrote: > Dear mc-devel, First of all, print relevant subject. > Is this enough for a normal bug report? I use 4.8.1 (3:4.8.1-4 in an Ubuntu > box). No. Current release is 4.8.6. For bug report for recent mc version welcome to https://www.midnight-commander.org/wiki/NewTicket. Don't forget to use search to avoid ticket duplication. For bug report for old releases welcome to bugzilla of your distro. -- Andrew