bugGNU nano - Bugs: bug #58890, crash on first keystroke in new...

 
 

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

bug #58890: crash on first keystroke in new buffer when using --indicator and --softwrap

Submitter:  Jerry Kindall <kindall>
Submitted:  Mon 03 Aug 2020 04:30:41 PM UTC
   
 
Severity:  5 - Blocker Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Thu 13 Aug 2020 05:07:34 AM UTC, comment #12: 

Released in 5.1.  Thanks again for reporting.

Benno Schulenberg <bens>
Group administrator
Fri 07 Aug 2020 06:01:08 AM UTC, comment #11: 

Thanks for testing.  I asked because I was a bit worried that a workaround [1] for a stubborn emulator might cause double line feeds when pasting in DOS files.  But apparently Putty does the right thing and reduces \r\n to just \r (or just \n) for the clipboard.

[1] https://git.savannah.gnu.org/cgit/nano.git/commit/?id=481529e8

Benno Schulenberg <bens>
Group administrator
Wed 05 Aug 2020 05:59:36 PM UTC, comment #10: 


comment #9:

> When you're using Putty from a Windows machine, may I ask: does selecting and copying several lines at once from a Windows file and then pasting these over Putty into a Unix file in nano do the right thing?  No unwanted justifying?  No extra blank lines?  In other words: does the bracketed-paste mode (since version 4.8) work correctly?


I do that all the time and haven't noticed any trouble, and just tried it to be sure and got exactly what I expected.

Jerry Kindall <kindall>
Wed 05 Aug 2020 09:17:12 AM UTC, comment #9: 

Thanks for confirming that the change fixes the problem.  I will make a new release with this fix (and others) next week.

When you're using Putty from a Windows machine, may I ask: does selecting and copying several lines at once from a Windows file and then pasting these over Putty into a Unix file in nano do the right thing?  No unwanted justifying?  No extra blank lines?  In other words: does the bracketed-paste mode (since version 4.8) work correctly?

Benno Schulenberg <bens>
Group administrator
Wed 05 Aug 2020 03:07:32 AM UTC, comment #8: 

Can confirm that the three-line change to utils.c resolves this issue. I've applied only this change to my build; building the from the repo would require upgrading a bunch of stuff. I might do that sometime, but not today.  :-)

Thanks again for the quick fix.

Jerry Kindall <kindall>
Tue 04 Aug 2020 09:52:28 PM UTC, comment #7: 


comment #6:

> (About the o-caron that I see before 2010: does that mean you're not in a UTF-8 locale?  What is the output of 'nano --version'?)


That was meant to be a copyright symbol. Firefox must have munched it. I'm using nano successfully with UTF-8 over SSH from a Windows 10 machine running PuTTY (even have a couple scripts that actually use Unicode characters).

Jerry Kindall <kindall>
Tue 04 Aug 2020 04:50:31 PM UTC, comment #6: 

You're welcome.  :)

(The need for an ncurses devel package is normal on most distros. Also, ./configure says to install something like that when it can't find any curses header files, so that is okay.  The need for exporting LDFLAGS=-ltinfo must be due to the older gcc: it appears to be automatic in newer gccs.)

(About the o-caron that I see before 2010: does that mean you're not in a UTF-8 locale?  What is the output of 'nano --version'?)

Benno Schulenberg <bens>
Group administrator
Tue 04 Aug 2020 02:06:29 PM UTC, comment #5: 

comment #4:

> Fixed in git, commit c8a87b4d.  Thanks again for reporting.
>
> (Out of curiosity: did you need to make any changes to the code to get it to compile with the ancient gcc?  If yes, and if you wish, please post any patches to a new issue.)


Thanks for the quick turnaround on the fix!

The only things I needed to do to get Nano 4.5 to compile (first version I built, the machine had version 3.0) were to install ncurses-devel yum package and export LDFLAGS="-ltinfo".  Didn't have to do anything else to build 5.0.

gcc is v4.4.6 BTW, ǒ 2010  :-)  It feels weird to refer to anything with a copyright date in the 2000s as "ancient," but it's ten years old...

Also thanks for the guidance on cleaning up my nanorc.

Jerry Kindall <kindall>
Tue 04 Aug 2020 07:56:37 AM UTC, comment #4: 

Fixed in git, commit c8a87b4d.  Thanks again for reporting.

(Out of curiosity: did you need to make any changes to the code to get it to compile with the ancient gcc?  If yes, and if you wish, please post any patches to a new issue.)

Benno Schulenberg <bens>
Group administrator
Tue 04 Aug 2020 07:26:01 AM UTC, comment #3: 

A more direct reproduction recipe is:

src/nano --ignore --indicator --softwrap

Then type some letter.  Result: crash.

With your more extended nanorc, I can still reproduce the crash, both with and without 'set linenumbers'.

Anyway, the problem is that 'extrarows' gets initiliazed to a bad value.  This was done on purpose to find any cases where 'extrarows' does not get properly computed.  One case where it does not get set properly is when adding a magic line, resulting that the "total number of rows" becomes zero: the first line with the single letter, plus the magic line, plus the faulty -2.  (There is no crash if one adds --nonewlines on the command line.)

(By the way, 'set morespace', 'set nowrap' and 'set smooth' are the default since 4.0.  If you have 'set indicator' (since 5.0) in your nanorc, it means those first three are redundant.)

Benno Schulenberg <bens>
Group administrator
Mon 03 Aug 2020 08:13:28 PM UTC, comment #2: 

After a little experimenting I can also mention that with my usual .nanorc, I have to have softwrap, indicator, AND linenumbers on to reproduce this. So there may be a more complicated interaction at work here.

My usual .nanorc follows. With linenumbers commented out, this works fine despite having indicator and softwrap.

set afterends
set autoindent
set casesensitive
set constantshow
set historylog
set indicator
set linenumbers
set morespace
set nohelp
set nowrap
set positionlog
set quickblank
set smarthome
set smooth
set softwrap
set suspend
set tabsize 4
set tabstospaces
set wordchars -_
set mouse

include "/usr/share/nano/*.nanorc"


Jerry Kindall <kindall>
Mon 03 Aug 2020 05:55:39 PM UTC, comment #1: 

Thanks for reporting!

I can reproduce by putting

set indicator
set softwrap

in a file called crashrc, and then running 'src/nano -f crashrc'.  Then typping a single character causes a floating point exception.

Will look into this tomorrow.

Benno Schulenberg <bens>
Group administrator
Mon 03 Aug 2020 04:30:41 PM UTC, original submission:  

Default build options

If ~/.nanorc contains at least these two options:

set indicator
set softwrap

then upon editing a new file, or a file that exists but contains no data, nano crashes when you press a key that would insert a character into the document. (the command keys work OK)

I get a floating point exception and am returned to the shell (though the terminal now formats stuff weirdly because nano didn't get a chance to put things back the way they were)

if you have trouble reproducing this issue, I would accept that it's just my system; it is an internal system at my employer with some old stuff on it (the gcc in particular is ancient). built it from source without serious difficulty, though, and it otherwise seems to work fine.

Jerry Kindall <kindall>

 

(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 (Posted a comment)
  • -email is unavailable- added by kindall (Submitted the item)
  • -email is unavailable- added by kindall
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2020-08-13 bens Open/ClosedOpen Closed
    2020-08-04 bens Summarycrash on first keystroke in empty file with indicator and softwrap crash on first keystroke in new buffer when using --indicator and --softwrap
    2020-08-04 bens StatusIn Progress Fixed
    2020-08-04 bens StatusConfirmed In Progress
        Summarynano 5.0 crashes on first keystroke with empty file, indicator, softwrap crash on first keystroke in empty file with indicator and softwrap
    2020-08-03 bens Severity3 - Normal 5 - Blocker
        StatusNone Confirmed
        Assigned toNone bens
    2020-08-03 kindall Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code