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

 
 

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

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

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

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>
Group administrator
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>
Group administrator
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>
Group administrator

 

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

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-07-22 bens Open/ClosedOpen Closed
    2017-07-16 bens StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code