Missing files declared in filesets should result in an error

Bug #1524846 reported by XiaoGuo, Liu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Status tracked in Trunk
1.x
Won't Fix
Undecided
Unassigned
Trunk
Fix Released
Medium
Sergio Schvezov

Bug Description

I have a basic project at https://github.com/liu-xiao-guo/null

When I build in different ways, it shows me different results.

1) http://paste.ubuntu.com/13894098/
2) http://paste.ubuntu.com/13893962/

For the same project, I used different commands, I got different results.

Also, I used the same project from different repository at https://github.com/dholbach/null

I got different result too when I tried to build the same project. The build sequence is at http://paste.ubuntu.com/13894397/

Thanks & best regards,
XiaoGuo

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

I believe the problem here is the presence of "test/bin/test_app" within the `stage` map. That file doesn't exist within the built part, so staging actually fails complaining about the fact that the file isn't present. Here's the key though: the order in which items in the `stage` map are processed isn't deterministic. They can be processed in any order, and the stage STOPS when it hits a file it can't stage[1]. Similarly, since `$binaries` are defined as everything within bin/* and usr/bin/*, `snap` tries to pull those files out of the staged package, but since `stage` failed at some point (again, a different place every time), usually SOME files were missing (which `snap` complained about). This was confusing simply because the stage failed at a different point every time, changing the error message and the final .snap every time as well.

The simple fix is to remove the "test/bin/test_app" string from the stage[2]. In the future, a good way to debug this would have been to walk through the lifecycle manually rather than running `snapcraft`. You would have noticed:

1. `snapcraft pull`: Okay, everything looks good.
2. `snapcraft build`: Okay, still good.
3. `snapcraft stage`: Wait... it couldn't stage something.

You would have stopped there and investigated, whereas running through the whole lifecycle the error message that jumps out is the one from `snap`, which was different every time.

[1]: https://github.com/ubuntu-core/snapcraft/blob/master/snapcraft/lifecycle.py#L206
[2]: http://pastebin.ubuntu.com/13894721/

Revision history for this message
XiaoGuo, Liu (liu-xiao-guo) wrote :

Hi Kyle,

Thanks for your investigation. I just tried, and it worked. I am thinking whether it would be better to stop the process and print some red color text, and in the meantime, the lifecycle stops half way. In this case, there will be no .snap file generated, and there is no confusion by this.

Best regards,
XiaoGuo

Changed in snapcraft:
importance: Undecided → Medium
summary: - Different results obtained when building the same project
+ Missing files declared in filesets should result in an error
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.