Bug 8907

Summary: do_package can show errors but succeed
Product: [Build System, Metadata & Runtime] BitBake Reporter: Igor Stoppa <igor.stoppa>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: VERIFIED FIXED QA Contact: Bogdan Alexandru Voiculescu <bogdanx.a.voiculescu>
Severity: normal    
Priority: High CC: bogdanx.a.voiculescu, patrick.ohly, poky.bs.watcher, poky.watcher
Version: unspecified   
Target Milestone: 2.1 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Igor Stoppa 2016-01-11 14:39:54 UTC
Premise
-------

I have a - broken - package which installs some files, but these files are not stored in the corresponding package.


The check 'installed-vs-shipped' QA test is labeled as an ERROR in WARN_TO_ERROR_QA .


An, as expected, building the recipe triggers the message:

"ERROR: QA Issue: recipe-name: Files/directories were installed but not shipped in any package:"

and the build stops.



Triggering action
-----------------

Then I try again to build the package.


Expected Outcome
----------------

The build should fail in the same way it already failed.


Actual Outcome
--------------

The build "succeeds".

I'm speculating on this, but I think the reason why it succeeds is that the broken package (broken because it is missing files that were installed) is still present in the SSTATE, so the second attempt re-uses it, failing to notice that files are missing from it.

The simpler (and probably also the more correct) solution would be to remove the broken package from the SSTATE.
Comment 1 Igor Stoppa 2016-01-11 14:40:49 UTC
In the premise, replace the first occurrence of "package" with "recipe".
Comment 2 Richard Purdie 2016-01-12 18:01:03 UTC
Issue root caused, patch sent to the list (http://git.yoctoproject.org/cgit.cgi/poky-contrib/commit/?h=rpurdie/wip&id=bc6d92fbf8ee60dcb6e05c7845a4ffdceeda98ad)
Comment 3 Richard Purdie 2016-01-13 10:24:27 UTC
The bug mentioned here is valid, the explanation of what is happening is not correct though, this has nothing to do with sstate.

The problem was that do_package and show ERROR messages but then the task can succeed rather than fail. That means the build continues without failing but due to the ERROR messages, bitbake sets a failure exit code.

Upon a subsequent build, things work fine since the task succeeded and since the task isn't rerun, no ERROR messages are shown.

What would have been useful here was a reproducer for the bug. I created one by adding:

do_install_append () {
       touch ${D}/dummy
}

to the bash recipe and then building bash. After the proposed patch, this fails every time and the do_package task never succeeds.
Comment 5 Bogdan Alexandru Voiculescu 2016-02-24 13:44:58 UTC
Verified on master: 
Build Configuration:
BB_VERSION        = "1.29.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
TARGET_SYS        = "aarch64-poky-linux"
MACHINE           = "qemuarm64"
DISTRO            = "poky"
DISTRO_VERSION    = "2.0+snapshot-20160224"
TUNE_FEATURES     = "aarch64"
TARGET_FPU        = ""
meta
meta-yocto
meta-yocto-bsp    = "master:36b43b233c841b3c09fc17e04686b4b758780963"

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: QA Issue: bash: Files/directories were installed but not shipped in any package:
  /dummy
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
bash: 1 installed and not shipped files. [installed-vs-shipped]
ERROR: Fatal QA errors found, failing task.
ERROR: Function failed: do_package
ERROR: Logfile of failure stored in: /home/yocto/yocto/poky-test/8891/build/tmp/work/aarch64-poky-linux/bash/4.3.30-r0/temp/log.do_package.5110
ERROR: Task 14 (/home/yocto/yocto/poky-test/poky/meta/recipes-extended/bash/bash_4.3.30.bb, do_package) failed with exit code '1'
NOTE: Tasks Summary: Attempted 677 tasks of which 676 didn't need to be rerun and 1 failed.
No currently running tasks (568 of 682)

Summary: 1 task failed:
  /home/yocto/yocto/poky-test/poky/meta/recipes-extended/bash/bash_4.3.30.bb, do_package