portage icon indicating copy to clipboard operation
portage copied to clipboard

Print a QA warning if nonfatal is used without dying

Open mgorny opened this issue 3 years ago • 2 comments

Signed-off-by: Michał Górny [email protected]

mgorny avatar Sep 25 '22 09:09 mgorny

I guess technically the code is fine, but I wonder if there aren't legitimate uses of nonfatal without die.

Especially, ebuilds seem to make use of the feature in src_test. See for example toolchain.eclass which ignores return status but compares with reference output instead.

Edit: In fact, the devmanual has a legitimate example:

src_test() {
	if nonfatal emake check -n &> /dev/null; then
		emake check
	elif nonfatal emake test -n &> /dev/null; then
		emake test
	fi
}

ulm avatar Sep 25 '22 09:09 ulm

I agree with @ulm on this; it's not terribly difficult to come up with a use case where using nonfatal without calling die makes sense.

floppym avatar Sep 30 '22 16:09 floppym