[oe-commits] [openembedded-core] 05/32: base-files: fix profile error under < /dev/null

git at git.openembedded.org git at git.openembedded.org
Sat Oct 15 09:05:50 UTC 2016


rpurdie pushed a commit to branch master
in repository openembedded-core.

commit e67637e4472ff3a1e2801b84ee3d69d4e14b9efc
Author: Richard Tollerton <rich.tollerton at ni.com>
AuthorDate: Tue Oct 11 20:08:15 2016 -0500

    base-files: fix profile error under < /dev/null
    
    Previous attempts to constrain execution of `resize` to only TTYs did
    not properly handle situations when `tty` would return the string "not a
    tty". The symptom is "/etc/profile: line 34: test: too many arguments".
    Fix this by utilizing the exit code of `tty`. Also use `case` instead of
    `cut` to eliminate a subshell.
    
    Signed-off-by: Richard Tollerton <rich.tollerton at ni.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/recipes-core/base-files/base-files/profile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile
index 0a05e45..7367fd1 100644
--- a/meta/recipes-core/base-files/base-files/profile
+++ b/meta/recipes-core/base-files/base-files/profile
@@ -22,10 +22,12 @@ if [ -d /etc/profile.d ]; then
   unset i
 fi
 
-if [ -x /usr/bin/resize ];then
+if [ -x /usr/bin/resize ] && termpath="`tty`"; then
   # Make sure we are on a serial console (i.e. the device used starts with /dev/tty),
   # otherwise we confuse e.g. the eclipse launcher which tries do use ssh
-  test "`tty | cut -c1-8`" = "/dev/tty" && resize >/dev/null
+  case "$termpath" in
+  /dev/tty*) resize >/dev/null
+  esac
 fi
 
 export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list