bugGNU nano - Bugs: bug #51477, resuming from suspension under...

 
 

bug #51477: resuming from suspension under S-Lang can enter an invalid byte

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Sun 16 Jul 2017 09:06:13 AM UTC  
 
Severity: 3 - NormalStatus: Fixed
Assigned to: Benno Schulenberg <bens>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 16 Jul 2017 05:17:37 PM UTC, comment #2:

Oh, to be clear: the bug was not in nano, but in SLang. So, commit 43a5c876 is not a fix but a workaround.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 16 Jul 2017 12:00:53 PM UTC, comment #1:

The bug was worse: the plugging of KEY_F0 into the key buffer (to trigger a screen update) masked another SLang bug: when that plugging is dropped, it results that the code for the first keystroke after having resumed is clipped to a single byte -- meaning that the code for <Right>, which is 0x104, gets clipped to 0x04, which is ^D, which deletes a character. :| (SLang brain damage, episode I-forget-how-many.)

Fixed in git, 43a5c876. But note: it is only fixed when using UTF-8. It can't be fixed for single-byte locales without (slightly) hindering normal typing.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 16 Jul 2017 09:06:13 AM UTC, original submission:

To see what I mean, configure nano with --with-slang and compile. Then run:

src/nano -z +1,30 NEWS

Note that the cursor is on the "F" of "Farouche". Now press ^Z and then type: fg <Enter>. Note that the cursor is now on the "a" of "avoid", which is the next word. Apparently KEY_F0 does the same as ^Space under SLang.

This is not entirely surprising, because during compilation there is this warning:

nano.c: In function ‘do_continue’:
nano.c:1288:13: warning: large integer implicitly truncated to unsigned type [-Woverflow]
ungetch(KEY_F0);
^~~~~~
This jumping to the next word when waking from suspension might still be acceptable, but when nano is suspended from the outside...

Run the same command as above, and then, in a different terminal, do: kill -SIGTSTP $(pidof nano). Then, on the first terminal, type: fg <Enter>. See how an invalid byte, "�", has been entered into the buffer. (This is with UTF-8 enabled, of course.)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bens (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 22 Jul 2017 07:15:32 PM UTCbensOpen/ClosedOpen=>Closed
    Sun 16 Jul 2017 12:00:53 PM UTCbensStatusNone=>Fixed

    Back to the top


    Powered by Savane 3.1-cleanup1