Why won't the package bypass the QA notice

From Funtoo
Jump to navigation Jump to search

This is an issue encountered by jeanfrancis. He wrote in a forum topic that he was having a package abort merging because of a QA warning. The result of his build was this:

 * 
 * QA Notice: Package has poor programming practices which may compile
 *            but will almost certainly crash on 64bit architectures.
 * 
 * Function `gtk_layout_get_hadjustment' implicitly converted to pointer at testgtk.c:9779
 * Function `gtk_layout_get_vadjustment' implicitly converted to pointer at testgtk.c:9780
 * Function `gtk_layout_get_hadjustment' implicitly converted to pointer at testoffscreen.c:65
 * Function `gtk_layout_get_vadjustment' implicitly converted to pointer at testoffscreen.c:100
 * 
 *  Please file a bug about this at http://bugs.gentoo.org/
 *  with the maintaining herd of the package.
 * 
 * ERROR: x11-libs/gtk+-2.91.2 failed:
 *   install aborted due to poor programming practices shown above
 * 
 * Call stack:
 *   misc-functions.sh, line 817:  Called install_qa_check
 *   misc-functions.sh, line 492:  Called die
 * The specific snippet of code:
 *   				die "install aborted due to" \

He knew that the stricter feature of Portage could cause behaviour like this, but despite trying again with FEATURES="-stricter", he ran into the issue again. This is when he brought it to the forum.

brantgurga took a look and noticed the call stack portion of the output:

 * Call stack:
 *   misc-functions.sh, line 817:  Called install_qa_check
 *   misc-functions.sh, line 492:  Called die

He found misc-functions.sh on his system by calling locate misc-functions.sh. With that file open, he searched for the install_qa_check function and then searched for the die messages within it and found this:

                if [[ ${abort} == "yes" ]] ; then
                        if [[ $gentoo_bug = yes || $always_overflow = yes ]] ; $
                                die "install aborted due to" \
                                        "poor programming practices shown above"

It was clear from this that the abort variable was getting set to "yes" as were one of gentoo_bug or always_overflow. He skimmed the preceding code and found this:

                        # In the future this will be a forced "die". In preparation,
                        # increase the log level from "qa" to "eerror" so that people
                        # are aware this is a problem that must be fixed asap.

                        # just warn on 32bit hosts but bail on 64bit hosts
                        case ${CHOST} in
                                alpha*|hppa64*|ia64*|powerpc64*|mips64*|sparc64*|sparcv9*|x86_64*) gentoo_bug=yes ;;
                        esac

                        abort=yes

Because jeanfrancis was on a 64-bit machine, gentoo_bug was getting set to "yes". Shortly after, it was clear that abort was getting set to "yes" as well.

It seems that this had been changed to a forced die without updating the comment. The reasoning is that the QA check caught warnings about a pointer being assigned to an int. This happens to accidentally work on 32-bit machines where pointers and ints are both 32-bit. However, on 64-bit machines, the pointer is 64-bit and the int is 32-bit. This causes the pointer to truncate and very likely cause a crash.

With that investigation, jeanfrancis worked around the issue by creating a patch for the missing declarations and editing the ebuild to apply his patch.