Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] oe-buildenv-internal: Preserve/Unset and Restore TERM
@ 2013-06-14 20:48 Saul Wold
  2013-06-14 21:08 ` Richard Purdie
  2013-06-16 19:12 ` Otavio Salvador
  0 siblings, 2 replies; 4+ messages in thread
From: Saul Wold @ 2013-06-14 20:48 UTC (permalink / raw)
  To: openembedded-core

Having a value in TERM that is not recognized by the nativesdk can cause
potential escape sequences appearing in the output stream, the can be seen
on Ubuntu with TERM=xterm-256color. Unsetting TERM allows for consistent
results in the python output.

Also, don't exit, use return, otherwise the shell exits and get no error information.

[YOCTO #4732]

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 scripts/oe-buildenv-internal | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal
index 40d95b7..9be034b 100755
--- a/scripts/oe-buildenv-internal
+++ b/scripts/oe-buildenv-internal
@@ -29,6 +29,8 @@ if [ ! -z "$OECORE_SDK_VERSION" ]; then
     return 1
 fi
 
+TERM_save=$TERM
+unset TERM
 # Make sure we're not using python v3.x. This check can't go into
 # sanity.bbclass because bitbake's source code doesn't even pass
 # parsing stage when used with python v3, so we catch it here so we
@@ -37,7 +39,7 @@ py_v3_check=`/usr/bin/env python --version 2>&1 | grep "Python 3"`
 if [ "$py_v3_check" != "" ]; then
 	echo "Bitbake is not compatible with python v3"
 	echo "Please set up python v2 as your default python interpreter"
-	exit 1
+	return 1
 fi
 
 # Similarly, we now have code that doesn't parse correctly with older
@@ -46,7 +48,7 @@ fi
 py_v26_check=`python -c 'import sys; print sys.version_info >= (2,7,3)'`
 if [ "$py_v26_check" != "True" ]; then
 	echo "BitBake requires Python 2.7.3 or later"
-	exit 1
+	return 1
 fi
 
 if [ "x$BDIR" = "x" ]; then
@@ -107,3 +109,5 @@ HTTPS_PROXY https_proxy FTP_PROXY ftp_proxy FTPS_PROXY ftps_proxy ALL_PROXY \
 all_proxy NO_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY \
 SDKMACHINE BB_NUMBER_THREADS BB_NO_NETWORK PARALLEL_MAKE GIT_PROXY_COMMAND \
 SOCKS5_PASSWD SOCKS5_USER SCREENDIR STAMPS_DIR"
+
+export TERM=$TERM_save
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] oe-buildenv-internal: Preserve/Unset and Restore TERM
  2013-06-14 20:48 [PATCH] oe-buildenv-internal: Preserve/Unset and Restore TERM Saul Wold
@ 2013-06-14 21:08 ` Richard Purdie
  2013-06-14 21:21   ` Saul Wold
  2013-06-16 19:12 ` Otavio Salvador
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2013-06-14 21:08 UTC (permalink / raw)
  To: Saul Wold; +Cc: openembedded-core

On Fri, 2013-06-14 at 13:48 -0700, Saul Wold wrote:
> Having a value in TERM that is not recognized by the nativesdk can cause
> potential escape sequences appearing in the output stream, the can be seen
> on Ubuntu with TERM=xterm-256color. Unsetting TERM allows for consistent
> results in the python output.
> 
> Also, don't exit, use return, otherwise the shell exits and get no error information.
> 
> [YOCTO #4732]
> 
> Signed-off-by: Saul Wold <sgw@linux.intel.com>
> ---
>  scripts/oe-buildenv-internal | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal
> index 40d95b7..9be034b 100755
> --- a/scripts/oe-buildenv-internal
> +++ b/scripts/oe-buildenv-internal
> @@ -29,6 +29,8 @@ if [ ! -z "$OECORE_SDK_VERSION" ]; then
>      return 1
>  fi
>  
> +TERM_save=$TERM
> +unset TERM
>  # Make sure we're not using python v3.x. This check can't go into
>  # sanity.bbclass because bitbake's source code doesn't even pass
>  # parsing stage when used with python v3, so we catch it here so we
> @@ -37,7 +39,7 @@ py_v3_check=`/usr/bin/env python --version 2>&1 | grep "Python 3"`
>  if [ "$py_v3_check" != "" ]; then
>  	echo "Bitbake is not compatible with python v3"
>  	echo "Please set up python v2 as your default python interpreter"
> -	exit 1
> +	return 1
>  fi
>  
>  # Similarly, we now have code that doesn't parse correctly with older
> @@ -46,7 +48,7 @@ fi
>  py_v26_check=`python -c 'import sys; print sys.version_info >= (2,7,3)'`
>  if [ "$py_v26_check" != "True" ]; then
>  	echo "BitBake requires Python 2.7.3 or later"
> -	exit 1
> +	return 1
>  fi
>  
>  if [ "x$BDIR" = "x" ]; then
> @@ -107,3 +109,5 @@ HTTPS_PROXY https_proxy FTP_PROXY ftp_proxy FTPS_PROXY ftps_proxy ALL_PROXY \
>  all_proxy NO_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY \
>  SDKMACHINE BB_NUMBER_THREADS BB_NO_NETWORK PARALLEL_MAKE GIT_PROXY_COMMAND \
>  SOCKS5_PASSWD SOCKS5_USER SCREENDIR STAMPS_DIR"
> +
> +export TERM=$TERM_save

No. This is just wrong in so many ways. I commented on the bug.

This also means any command you run after sourcing the script gets a
broken TERM value.

Cheers,

Richard



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] oe-buildenv-internal: Preserve/Unset and Restore TERM
  2013-06-14 21:08 ` Richard Purdie
@ 2013-06-14 21:21   ` Saul Wold
  0 siblings, 0 replies; 4+ messages in thread
From: Saul Wold @ 2013-06-14 21:21 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core

On 06/14/2013 02:08 PM, Richard Purdie wrote:
> On Fri, 2013-06-14 at 13:48 -0700, Saul Wold wrote:
>> Having a value in TERM that is not recognized by the nativesdk can cause
>> potential escape sequences appearing in the output stream, the can be seen
>> on Ubuntu with TERM=xterm-256color. Unsetting TERM allows for consistent
>> results in the python output.
>>
>> Also, don't exit, use return, otherwise the shell exits and get no error information.
>>
>> [YOCTO #4732]
>>
>> Signed-off-by: Saul Wold <sgw@linux.intel.com>
>> ---
>>   scripts/oe-buildenv-internal | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal
>> index 40d95b7..9be034b 100755
>> --- a/scripts/oe-buildenv-internal
>> +++ b/scripts/oe-buildenv-internal
>> @@ -29,6 +29,8 @@ if [ ! -z "$OECORE_SDK_VERSION" ]; then
>>       return 1
>>   fi
>>
>> +TERM_save=$TERM
>> +unset TERM
>>   # Make sure we're not using python v3.x. This check can't go into
>>   # sanity.bbclass because bitbake's source code doesn't even pass
>>   # parsing stage when used with python v3, so we catch it here so we
>> @@ -37,7 +39,7 @@ py_v3_check=`/usr/bin/env python --version 2>&1 | grep "Python 3"`
>>   if [ "$py_v3_check" != "" ]; then
>>   	echo "Bitbake is not compatible with python v3"
>>   	echo "Please set up python v2 as your default python interpreter"
>> -	exit 1
>> +	return 1
>>   fi
>>
>>   # Similarly, we now have code that doesn't parse correctly with older
>> @@ -46,7 +48,7 @@ fi
>>   py_v26_check=`python -c 'import sys; print sys.version_info >= (2,7,3)'`
>>   if [ "$py_v26_check" != "True" ]; then
>>   	echo "BitBake requires Python 2.7.3 or later"
>> -	exit 1
>> +	return 1
>>   fi
>>
>>   if [ "x$BDIR" = "x" ]; then
>> @@ -107,3 +109,5 @@ HTTPS_PROXY https_proxy FTP_PROXY ftp_proxy FTPS_PROXY ftps_proxy ALL_PROXY \
>>   all_proxy NO_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY \
>>   SDKMACHINE BB_NUMBER_THREADS BB_NO_NETWORK PARALLEL_MAKE GIT_PROXY_COMMAND \
>>   SOCKS5_PASSWD SOCKS5_USER SCREENDIR STAMPS_DIR"
>> +
>> +export TERM=$TERM_save
>
> No. This is just wrong in so many ways. I commented on the bug.
>
> This also means any command you run after sourcing the script gets a
> broken TERM value.
>
It's not a broken TERM value from the Distro's standpoint, only from our 
nativesdk python's standpoint, the value is correct for the distro,
devshell and visual tools all work correctly.

We need to at least fix the exit vs return.

Sau!

> Cheers,
>
> Richard
>
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] oe-buildenv-internal: Preserve/Unset and Restore TERM
  2013-06-14 20:48 [PATCH] oe-buildenv-internal: Preserve/Unset and Restore TERM Saul Wold
  2013-06-14 21:08 ` Richard Purdie
@ 2013-06-16 19:12 ` Otavio Salvador
  1 sibling, 0 replies; 4+ messages in thread
From: Otavio Salvador @ 2013-06-16 19:12 UTC (permalink / raw)
  To: Saul Wold; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]

On Fri, Jun 14, 2013 at 5:48 PM, Saul Wold <sgw@linux.intel.com> wrote:

> Having a value in TERM that is not recognized by the nativesdk can cause
> potential escape sequences appearing in the output stream, the can be seen
> on Ubuntu with TERM=xterm-256color. Unsetting TERM allows for consistent
> results in the python output.
>
> Also, don't exit, use return, otherwise the shell exits and get no error
> information.
>
> [YOCTO #4732]
>
> Signed-off-by: Saul Wold <sgw@linux.intel.com>
>

Please split the fix and get the exit/return fix applied. While on that,
ensure the errors are send to >&2 as done in other error messages.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

[-- Attachment #2: Type: text/html, Size: 1401 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-16 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-14 20:48 [PATCH] oe-buildenv-internal: Preserve/Unset and Restore TERM Saul Wold
2013-06-14 21:08 ` Richard Purdie
2013-06-14 21:21   ` Saul Wold
2013-06-16 19:12 ` Otavio Salvador

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox