nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] File size problem in the status bar


From: Benno Schulenberg
Subject: Re: [Nano-devel] File size problem in the status bar
Date: Sat, 21 Jul 2018 08:45:38 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hello Liu,

Op 20-07-18 om 16:48 schreef Liu Hao:
> 1) With auto indent turned on, on a line with two-TAB indention for example, 
> when
> I press Enter, nano inserts a new line with two TAB characters in the front, 
> so
> the file size gets increased by 3. This is the correct behavior. However, if I
> undo this operation using Alt-U, the new line is deleted and the file size is
> only decreased by 1, so the size displayed will be larger than the actual 
> size by 2.

Thanks for reporting.  Confirmed.  I have rereported the issue on Savannah:
https://savannah.gnu.org/bugs/?54344.  That is the place for bug reports.

> 2) I intermittently get garbage file size values on the status bar. I don't 
> know
> how to reproduce this. Eventually I had Valgrind attached to nano and it 
> caught
> use of an uninitialized value in winio.c on the following line:
> 
> ```
> charpct = (openfile->totsize == 0) ? 0 : 100 * sum / openfile->totsize;
> ```
> , where `openfile->totsize` seemed uninitialized, as `sum` looked normal.

It seems impossible that openfile->totsize is ever uninitialized, because
it gets set to zero as soon as a buffer is created -- and you cannot do
anything without having a buffer.

> I have had Valgrind log attached. Hope it helps.

> ==6968==    by 0x1235AD: parse_rcfile (rcfile.c:999)
> ==6968==    by 0x123B6C: do_rcfiles (rcfile.c:1239)
> ==6968==    by 0x10DA2A: main (nano.c:2369

It seems you are running a modified nano, because current git (nor the
commit that you referred to, c46696d4) has a call to parse_rcfile() on
line 1239 -- it has it on line 1200.

So... I am guessing your bogus file sizes are caused by the changes
you made to nano.  If you post the full patch of your changes...

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]