Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 905838 - mail-client/neomutt: add USE=-asan
Summary: mail-client/neomutt: add USE=-asan
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Nicolas Bock
URL: https://neomutt.org/dev/analysis/asan
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2023-05-06 18:25 UTC by Marc Schiffbauer
Modified: 2023-11-14 12:19 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 Marc Schiffbauer gentoo-dev 2023-05-06 18:25:39 UTC
Hi,

to debug neomutt it would be useful to have a useflag "asan" which will enable --asan configure option or add

export EXTRA_CFLAGS="-fsanitize=address"
export EXTRA_LDFLAGS="-fsanitize=address"

What do you think?

-Marc
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-07 11:44:21 UTC
We don't tend to add USE flags for things where they purely add a *FLAG.

Is there a reason you can't do this via /etc/portage/env?
Comment 2 Marc Schiffbauer gentoo-dev 2023-05-07 12:15:25 UTC
(In reply to Sam James from comment #1)
> We don't tend to add USE flags for things where they purely add a *FLAG.
> 
> Is there a reason you can't do this via /etc/portage/env?

You mean setting 

EXTRA_CFLAGS="-fsanitize=address"
EXTRA_LDFLAGS="-fsanitize=address"

there? Sure this might work, but having a USE flag will also document this debugging feature that has to be enabled at compile time.

I dont see a reason why this should not be a use flag, as it changes aspects of the build adding debugging capabilities.

But in the end its maybe just a matter of taste...
Comment 3 Marc Schiffbauer gentoo-dev 2023-05-07 16:16:12 UTC
Update: the ENV alone is not enough. You need -DUSE_ASAN in CFLAGS as well.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-07 16:19:43 UTC
ASAN is something you can build anything with so documenting it just for that isn't useful but...

(In reply to Marc Schiffbauer from comment #3)
> Update: the ENV alone is not enough. You need -DUSE_ASAN in CFLAGS as well.

this is good justification for it (as it requires package specific knowledge)
Comment 5 Nicolas Bock gentoo-dev 2023-05-22 22:22:07 UTC
The configure script also has

--ubsan Enable the Undefined Behaviour Sanitizer

Would that be useful too?

If so I am wondering whether the USE flag should not be names something more generic such as "sanitize" or something similar.
Comment 6 Marc Schiffbauer gentoo-dev 2023-05-28 19:24:39 UTC
(In reply to Nicolas Bock from comment #5)
> The configure script also has
> 
> --ubsan Enable the Undefined Behaviour Sanitizer
> 
> Would that be useful too?
> 
> If so I am wondering whether the USE flag should not be names something more
> generic such as "sanitize" or something similar.


These flags have a huge impact on performance. At least asan, I donot know about ubsan. But I would add both asan and ubsan as local use flags and maybe add another like you suggested like "sanitize" which then has a USEDEP on asan and ubsan?

I asked the developer about enabling both ubsan and asan at the same time and will uddate the bug when I have more information about it.
Comment 7 Nicolas Bock gentoo-dev 2023-06-12 14:15:07 UTC
Thanks Marc
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-03 15:08:02 UTC
Done by nicolas in

commit 77c0c87ee152193d718dfcf2869ca8c817e18b47 (origin/master, origin/HEAD)
Author: Nicolas Bock <nicolasbock@gentoo.org>
Date:   Fri Nov 3 09:05:05 2023 -0600

    mail-client/neomutt: Add debugging flags

    This change adds `asan` and `ubsan` USE flags for debugging.

    Signed-off-by: Nicolas Bock <nicolasbock@gentoo.org>

I still think the better way here is to just check is-flagq for -fsanitize=address and enable the corresponding configure option, ditto ubsan.

(See e.g. botan and elfutils).

That's what we do in other packages where the configure option is actually useful (not simply setting -fsanitize=x for you, but somehow doing an additional thing).
Comment 9 Larry the Git Cow gentoo-dev 2023-11-14 04:32:54 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4de47c94f583d30b2cbb6325dc695c4184d04f2f

commit 4de47c94f583d30b2cbb6325dc695c4184d04f2f
Author:     Nicolas Bock <nicolasbock@gentoo.org>
AuthorDate: 2023-11-06 13:00:12 +0000
Commit:     Nicolas Bock <nicolasbock@gentoo.org>
CommitDate: 2023-11-14 04:32:18 +0000

    mail-client/neomutt: Version bump 20231103
    
    This change also addresses Sam James' suggestion regarding the two
    sanitize compile flags. They are now activated via CFLAGS and not USE
    flags.
    
    Bug: https://bugs.gentoo.org/905838
    Signed-off-by: Nicolas Bock <nicolasbock@gentoo.org>

 mail-client/neomutt/Manifest                |   1 +
 mail-client/neomutt/neomutt-20231103.ebuild | 174 ++++++++++++++++++++++++++++
 2 files changed, 175 insertions(+)
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-14 12:19:02 UTC
Thanks!