bugGNU nano - Bugs: bug #49893, an embedded null at the search...

 
 

bug #49893: an embedded null at the search prompt gets shown as ^J

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Tue 20 Dec 2016 10:49:52 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.

 

Fri 30 Dec 2016 10:56:41 AM UTC, comment #5:

Hrrrmm. Upon first testing this with an up-to-date nano, I got a ^J when typing M-V 000000 at the search prompt, and any subsequent M-V 000000 was rejected with a beep. WTH? Any runs after that worked okay. Weird! I've seen it before: the first run after a new install behaves strangely -- as if the kernel still runs the old binary the first time around. :|

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Fri 23 Dec 2016 10:03:06 AM UTC, comment #4:

Fixed in git, eef7d104.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Thu 22 Dec 2016 03:57:36 PM UTC, comment #3:

Improved patch is attached. But this got so messy that I've tried a different approach: another global variable. :| Attached too. I like the second approach better, because there are just two main entry points into 0x0A=^J state: reading in a file or writing out a file. A third one is whenever the title bar is written.

(file #39293, file #39294)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Thu 22 Dec 2016 12:53:34 PM UTC, comment #2:

The patch is not good enough: when opening multiple files and then switching between buffers, a newline in a filename gets shown as a ^@ (both in the titlebar and in the statusbar) instead of a ^J.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 20 Dec 2016 06:42:15 PM UTC, comment #1:

Besides the search-related menus, an M-V 000000 should be shown as ^@ also in the MSPELL menu. (The speller will never find anything with an embedded NUL byte, but... the user /might/ type it.)

Attached is a patch that fixes the representation problem for me. It's not a nice patch. Things become messier and messier with all this looking at global variables to decide what to do. But... can't be helped. Passing a parameter around through five, six, seven different layers feels even worse.

Oh, and as a follow-up patch, the sundering and unsundering of the search history has to be restored, because search terms /can/ contain a newline: an encoded NUL byte.

(file #39290)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 20 Dec 2016 10:49:52 AM UTC, original submission:

In current git, when one tries to search a file for NUL bytes, and thus one types M-V 000000 at the "Search: " prompt, the NUL is shown as ^J. This is pretty confusing.

Expected behavior: at the Search, Replace, ReplaceWith, and GoToLine prompts, an embbeded NUL byte (which is encoded as 0x0A, otherwise it would terminate the string) should get shown as ^@. Only at the WriteOut, InsertFile, ExecuteCommand, WhereIsFile and GoToDir prompts should a 0x0A byte get shown as ^J (because there ^J means ^J).

(The problem was noticed by David Ramsey.)

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:
   

 

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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 30 Dec 2016 08:54:43 PM UTCbensOpen/ClosedOpen=>Closed
    Fri 23 Dec 2016 10:03:06 AM UTCbensStatusIn Progress=>Fixed
    Thu 22 Dec 2016 03:57:36 PM UTCbensAttached File-=>Added 0001-screen-display-an-encoded-NUL-byte-as-at-the-search-.patch, #39293
      Attached File-=>Added 0001-screen-display-byte-value-0x0A-as-or-as-J-in-the-rig.patch, #39294
    Tue 20 Dec 2016 06:42:15 PM UTCbensAttached File-=>Added 0001-screen-show-an-encoded-NUL-byte-as-at-the-search-pro.patch, #39290
      StatusNone=>In Progress

    Back to the top


    Powered by Savane 3.1-cleanup1