Bug 10114 - Insufficent error-handling in SDK installer
Summary: Insufficent error-handling in SDK installer
Status: RESOLVED FIXED
Alias: None
Product: eSDK
Classification: Yocto Project Subprojects
Component: eSDK (show other bugs)
Version: 2.0.2
Hardware: x86 x86_64
: Medium+ normal
Target Milestone: 2.2 M4
Assignee: Mariano Lopez
QA Contact:
URL:
Whiteboard: Should require backport also
Depends on:
Blocks:
 
Reported: 2016-08-11 14:18 UTC by linus.wallgren
Modified: 2017-12-06 17:07 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description linus.wallgren 2016-08-11 14:18:49 UTC
I don't have a very complete understanding of yocto and its build systems, so hopefully I haven't missed anything obvious.

I'm trying to install an SDK I have created in a docker container but noticed that certain errors weren't properly dealt with by the installer.

I was missing the bzip2 dependency and tried to install and got this:

```
You are about to install the SDK to "/home/user/sdk". Proceed[Y/n]? Y
Extracting SDK...tar (grandchild): bzip2: Cannot exec: No such file or directory
tar (grandchild): Error is not recoverable: exiting now
tar: Child died with signal 13
tar: Error is not recoverable: exiting now
done
Setting it up...ls: cannot access '/home/user/sdk/environment-setup-*': No such file or directory
mv: cannot move '/tmp/tmp.J2J4wgh7z1/relocate_sdk.sh' to '/relocate_sdk.sh': Permission denied
chmod: cannot access '/relocate_sdk.sh': No such file or directory
./toolchain.sh: 208: ./toolchain.sh: /relocate_sdk.sh: not found
SDK could not be set up. Relocate script failed. Abort!
```

Notice how it does not notice the error of a missing bzip2 executable but fails later when files are missing.

After I installed bzip and python (two other dependencies that I had missing), I got the following issue (because I was missing the file binary):

```
You are about to install the SDK to "/home/user/sdk". Proceed[Y/n]? Y
Extracting SDK..........................................done
Setting it up...xargs: file: No such file or directory
sed: no input files
done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /home/user/sdk/environment-setup-cortexa8hf-vfp-neon-poky-linux-gnueabi
```

Notice how it doesn't detect the issue and considers the installation to be successful, despite a big red warning.

The issue is in the toolchain-shar-relocate.sh script:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/files/toolchain-shar-relocate.sh#n48

I see no error-handling in this file whatsoever, perhaps setting the pipefail ( https://www.gnu.org/software/bash/manual/html_node/Pipelines.html ) can be a solution?

Regards
Linus
Comment 1 Leonardo Sandoval Gonzalez 2016-09-08 17:10:01 UTC
Moving to M4 due to time constraints.
Comment 2 Mariano Lopez 2016-09-21 15:59:25 UTC
Sent patch to the mailing list:

http://lists.openembedded.org/pipermail/openembedded-core/2016-September/126761.html
Comment 4 linus.wallgren 2016-10-04 20:53:57 UTC
While I haven't been able to test this yet, it does not seem that your patch addresses the issues of missing dependencies, specifically bzip2 and python. Have you left that out on purpose?
Comment 5 Mariano Lopez 2016-10-04 21:22:51 UTC
(In reply to comment #4)
> While I haven't been able to test this yet, it does not seem that your patch
> addresses the issues of missing dependencies, specifically bzip2 and python.
> Have you left that out on purpose?

bzip2 has been replaced long ago in commit 193086137b899a0a4e774ffc337ed0da9947fd4f

python is checked in relocation script when calling the dynamic generated script. The only thing that I did on that was to change the shebang from bash to sh.