bugGNU nano - Bugs: bug #65649, shortcut for `runmacro` can get...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #65649: shortcut for `runmacro` can get stored in macro buffer and hang nano

Submitter:  correctmost <correctmost>
Submitted:  Sat 27 Apr 2024 07:24:16 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Thu 02 May 2024 05:42:31 AM UTC, comment #3: 

The fix was released in nano-8.0.  Thanks again for reporting.

Benno Schulenberg <bens>
Group administrator
Sat 27 Apr 2024 03:29:41 PM UTC, comment #2: 

Fixed in git, commit c020d53e, by snipping not the last keystroke but the last burst of keystrokes.  This prevents a hang, but could snip too many keystrokes when the user types fast, which would result in a misrecorded macro.  I do not see a simple solution for that.

(Also, previously, when the user had bound `runmacro` to a function key and ran nano with --raw, then typing `runmacro` while recording a macro would leave a truncated escape sequence in the macro, which would result in an "Unknown sequence" message every time the macro was executed.  The above commit fixes also that remote issue.)

Thanks for reporting and the clear recipe!

Benno Schulenberg <bens>
Group administrator
Sat 27 Apr 2024 12:01:13 PM UTC, comment #1: 

Attached patch should fix the problem.  (This solution occurred to me also while fixing bug #65394, but I didn't think it through then.)


(file #55985)

Benno Schulenberg <bens>
Group administrator
Sat 27 Apr 2024 07:24:16 AM UTC, original submission:  

I often encounter the following hang when leaving my xdotool script running for millions of iterations.  It looks similar to the timing issue that caused bug #65394.

I'm not sure if a human can easily trigger this bug, so it might not be worth fixing if the changes are too risky or complicated.  (I can look into avoiding certain key sequences in my script.)


Patch that makes the bug easier to reproduce (adapted from bug #65394):

diff --git a/src/winio.c b/src/winio.c
index 0d977708..00229186 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -290,6 +290,8 @@ void read_keys_from(WINDOW *frame)
        if (input == ESC_CODE && (linger_after_escape || ISSET(RAW_SEQUENCES)))
                napms(20);

+       napms(200);
+
        while (TRUE) {
 #ifndef NANO_TINY
                if (recording)



Steps to reproduce:
1 - Apply the above patch and recompile
2 - Run `src/nano --ignore`
3 - Alt + :
4 - Type a
5 - Hold down Alt + ; for a few seconds
6 - Alt + :
7 - Alt + ;
--> nano hangs

Here's what I see in macro_buffer after step 7:

(gdb) p macro_length
$2 = 261

(gdb) p *macro_buffer@261
$3 = {97, 27, 59, 27, 59, 27, 59, <27, 59 repeats until the end>}


Version: cb029377146f9cce87f0532ab55b4855c2f10738

correctmost <correctmost>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Updated the item)
  • -email is unavailable- added by correctmost (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-05-02 bens Open/ClosedOpen Closed
    2024-04-27 bens StatusNone Fixed
    2024-04-27 bens Attached File- Added use-milestone-instead-of-snipping.patch, #55985
        Assigned toNone bens
        Summaryrun_macro shortcut can get stored in macro buffer and hang nano shortcut for `runmacro` can get stored in macro buffer and hang nano

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code