[Top][All Lists]

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

Re: [Nano-devel] Patch for bug #44950

From: Benno Schulenberg
Subject: Re: [Nano-devel] Patch for bug #44950
Date: Tue, 29 Dec 2015 11:35:53 +0100

Hello Rishabh,

On Thu, Dec 24, 2015, at 20:00, Rishabh Dave wrote:
> I worked on your idea to use stat(). Thanks a lot. That was really helpful.

Thanks for the patch.

However... it failed for me immediately:

    src/nano doc/what


This is because I run with 'export MALLOC_CHECK_=2'.

So... something is going wrong with your memory allocations.

When you do 'x = charalloc(sizeof(a))', I think you want to do
'x = charalloc(strlen(a) * sizeof(char))'.

Also, you've added a function called strcpyfu(a, b, c, d) that
does the equivalent of strncpy(a, b+c, d-c).  Why not use the
latter?  Furthermore, you only ever call strcpyfu() with c=0,
so it is in fact identical to strncpy().  :|  (Apart from the
zero termination, but the main routine does that anyhow, so...)

The comment of the determine() routine mentions values of
-1 and -2, but the code only ever returns values of zero or
higher.  So... I don't know what was the intention there.

After making the above mentioned changes to your patch,
and adjusting it for whitespace too, it no longer aborts
when I use MALLOC_CHECK_=2 with 'src/nano doc/what'.
However, it still does not do the expected thing when giving
it a nonexistent dir: 'src/nano none/what' still tries to write
a lockfile into 'none/' -- it should not, it should just mention
on the statusbar that 'none' does not exist and skip trying
to write a lockfile.

> valgrind --leak-check=yes ./nano dir/dir2/new_file
> There were 73 bytes were reported as 'definitely lost'. Could this be
> troublesome?

Unlikely.  Although the file-opening and file-locking code hasn't
been thoroughly debugged and washed and combed yet, any memory leaks
that it contains should not cause any failures -- they just waste
a little memory.


-- - Faster than the air-speed velocity of an
                          unladen european swallow

Attachment: probing-the-path-components.patch
Description: Text Data

reply via email to

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