]> code.ossystems Code Review - openembedded-core.git/commitdiff
base-files: fix profile error under < /dev/null
authorRichard Tollerton <rich.tollerton@ni.com>
Wed, 12 Oct 2016 01:08:15 +0000 (20:08 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 15 Oct 2016 08:49:18 +0000 (09:49 +0100)
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@ni.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-core/base-files/base-files/profile

index 0a05e455ffded3060c0ca5e7804f093830d576ec..7367fd1e2986a202de6c3d65e9bb5793c60d5b48 100644 (file)
@@ -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