Bug 7290

Summary: A warning message when installing toolchain sdk if using dash
Product: [Yocto Project Subprojects] ADT Reporter: Yi Zhao <yi.zhao>
Component: adtAssignee: Saul Wold <sgw>
Status: VERIFIED NOTABUG QA Contact: Alexandru Georgescu <alexandru.c.georgescu>
Severity: normal    
Priority: Medium+ CC: alexandru.c.georgescu, hongxu.jia, ke.zou, poky.adt.watcher, poky.watcher, yi.zhao, zhangle.yang
Version: 1.8   
Target Milestone: 1.8 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: New (Never tested)
Verified: Documentation change: No (bug/feature does not impact docs)

Description Yi Zhao 2015-02-05 08:05:30 UTC
Toolchain sdk location: http://autobuilder.yoctoproject.org/pub/nightly/20150202-1/toolchain/

Git rev: master/22c38e2d8a058619e3d05534b5e830b750aa4241

There is a warning message when installing toolchain sdk if using dash:
#################### 
$ sudo sh poky-glibc-x86_64-core-image-sato-armv5te-toolchain-1.7.sh 
poky-glibc-x86_64-core-image-sato-armv5te-toolchain-1.7.sh: 58: read: Illegal option -e
You are about to install the SDK to "/opt/poky/1.7". Proceed[Y/n]?
####################
Comment 1 Saul Wold 2015-02-09 18:37:20 UTC
This causes issue with Dash, the commit in question is back from Dizzy days:

commit b0a9f30e19a2dece5350c4bd9d63355a6bbe214c
Author: Dennis Meier <meier.dennis@siemens.com>
Date:   Tue Jun 17 15:16:53 2014 +0200

    populate_sdk_base: add auto-completion in setup
    
    (From OE-Core rev: d6c55f6910270e395f668c9114ec374b44c57538)
    
    Signed-off-by: Dennis Meier <meier.dennis@siemens.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/meta/classes/populate_sdk_base.bbclass 
b/meta/classes/populate_sdk_base.bbclass
index d3d8422..97cf1fb 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -174,9 +174,8 @@ if [ $verbose = 1 ] ; then
        set -x
 fi
 
-printf "Enter target directory for SDK (default: $DEFAULT_INSTALL_DIR): "
 if [ "$target_sdk_dir" = "" ]; then
-       read target_sdk_dir
+       read -e -p "Enter target directory for SDK (default: 
$DEFAULT_INSTALL_DIR): " target_sdk_dir
        [ "$target_sdk_dir" = "" ] && target_sdk_dir=$DEFAULT_INSTALL_DIR
 else
        echo "$target_sdk_dir"

Reverting this change will fix this issue
Comment 2 Saul Wold 2015-02-11 05:20:51 UTC
The poky-toolchain.sh script has a #!/bin/bash and should be marked as 
executeable so an "sh" should not been needed, and this is in fact what causes 
the problems, because calling it directly with sh will override the #!/bin/bash 
in the file.  I reviewed the test case and it shows just executing the script 
directly, not using sh <script>, can you confirm if the script is correctly 
executable?
Comment 3 Yi Zhao 2015-02-11 05:37:50 UTC
(In reply to comment #2)
> The poky-toolchain.sh script has a #!/bin/bash and should be marked as 
> executeable so an "sh" should not been needed, and this is in fact what
> causes 
> the problems, because calling it directly with sh will override the
> #!/bin/bash 
> in the file.  I reviewed the test case and it shows just executing the
> script 
> directly, not using sh <script>, can you confirm if the script is correctly 
> executable?

Yes, it works well.
Steps:
$ chmod a+x poky-glibc-x86_64-core-image-sato-armv5te-toolchain-1.7.sh
$ ./poky-glibc-x86_64-core-image-sato-armv5te-toolchain-1.7.sh
Comment 4 Saul Wold 2015-02-12 13:18:27 UTC
This is not really a bug as noted above executing a script that has an explicit 
#!/bin/bash will be overridden with which ever shell is added on the command 
line.  There is no definitive way to determine which shell is being executed to 
enable or disable the functionality of command line completion.
Comment 5 Alexandru Georgescu 2015-03-27 06:05:54 UTC
Verified as per above comments.