Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 329537 - sys-libs/ncurses-5.7 inverse leak checking logic in ebuild
Summary: sys-libs/ncurses-5.7 inverse leak checking logic in ebuild
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-23 07:17 UTC by Markus Duft (RETIRED)
Modified: 2015-03-31 04:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Duft (RETIRED) gentoo-dev 2010-07-23 07:17:39 UTC
Hey!

Investigating ncurses a little (the leak checking code doesn't build for me on interix-prefix), i stumbled over a seemingly inverse logic. the --enable-leaks switch enables leak checking, which i'd expect to be there in the debug-build only, not the !debug one. changing this solves it for me:

-		$(use_enable !debug leaks) \
+		$(use_enable debug leaks) \

is this really a bug, or is it intended?
Comment 1 Harald van Dijk (RETIRED) gentoo-dev 2010-07-23 16:31:32 UTC
It doesn't really make any difference since the configure script has a bug and treats --disable-leaks the same way as --enable-leaks...
Comment 2 SpanKY gentoo-dev 2010-07-25 14:27:53 UTC
that's why i fix it in the ebuild:
    sed -i '/with_no_leaks=yes/s:=.*:=$enableval:' configure #305889

i imagine the negative variable naming messed up my head.  "--disable-leaks" really means "disable leak checking".
Comment 3 Markus Duft (RETIRED) gentoo-dev 2010-10-28 08:35:48 UTC
what about this bug? anybody removing the '!', so leak checking is enabled in debug builds only? it's not so much of a problem for me, because i disabled it in the prefix copy of the ebuild for interix completely, but still... i think it is wrong as it is.
Comment 4 SpanKY gentoo-dev 2010-11-15 12:00:04 UTC
should be included with 5.7-r6
Comment 5 Arthur Taylor 2015-03-30 22:36:23 UTC
Just ran across this today, it appears it is still backwards.

According to curs_memleaks(3x) the _nc_freeall() and _nc_free_and_exit() are normally not available non-standard functions and that they should only be available if ncurses is configured at build time with --disable-leaks.

Currently the ebuild has:

		$(use_enable debug leaks)

Which has the effect that if ncurses is built without the debug use flags (most builds), --disable-leaks is passed and the functions are included.

If you build with the debug use flag, --enable-leaks is passed and the functions aren't included.

This still seems backwards to me.
Comment 6 Arthur Taylor 2015-03-30 22:52:54 UTC
I Should add that the symbols _nc_free_and_exit and _nc_freeall are present regardless of whether --disable-leaks or --enable-leaks is passed.

However, currently only if ncurses is built with --disable-links do the functions actually work as advertised.

With USE=debug emerge -1 sys-libs/ncurses:

$ valgrind ./eltest
==10886== Memcheck, a memory error detector
==10886== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==10886== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==10886== Command: ./eltest
==10886== 
?quit
0 "quit" 
==10886== 
==10886== HEAP SUMMARY:
==10886==     in use at exit: 14,784 bytes in 13 blocks
==10886==   total heap usage: 187 allocs, 174 frees, 86,785 bytes allocated
==10886== 
==10886== LEAK SUMMARY:
==10886==    definitely lost: 0 bytes in 0 blocks
==10886==    indirectly lost: 0 bytes in 0 blocks
==10886==      possibly lost: 0 bytes in 0 blocks
==10886==    still reachable: 14,784 bytes in 13 blocks
==10886==         suppressed: 0 bytes in 0 blocks
==10886== Rerun with --leak-check=full to see details of leaked memory
==10886== 
==10886== For counts of detected and suppressed errors, rerun with: -v
==10886== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

With USE=-debug emerge -1 sys-libs/ncurses:

$ valgrind ./eltest
==4238== Memcheck, a memory error detector
==4238== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==4238== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==4238== Command: ./eltest
==4238== 
?quit
0 "quit" 
==4238== 
==4238== HEAP SUMMARY:
==4238==     in use at exit: 0 bytes in 0 blocks
==4238==   total heap usage: 188 allocs, 188 frees, 90,455 bytes allocated
==4238== 
==4238== All heap blocks were freed -- no leaks are possible
==4238== 
==4238== For counts of detected and suppressed errors, rerun with: -v
==4238== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Comment 7 SpanKY gentoo-dev 2015-03-31 04:10:24 UTC
(In reply to Arthur Taylor from comment #5)

not exactly.  it was fixed in 5.7-r6 as i claimed, but then it was rebroken in the 5.8 ebuild as the sed line was dropped:
        sed -i '/with_no_leaks=yes/s:=.*:=$enableval:' configure #305889
but the configure flag wasn't re-inverted to match the sed.
Comment 8 SpanKY gentoo-dev 2015-03-31 04:53:06 UTC
Commit message: Fix the inverted leak flag
http://sources.gentoo.org/sys-libs/ncurses/ncurses-5.9-r4.ebuild?rev=1.1