Hi all,

I am facing problem in bash 4.4 . In a function if first line is ‘If
condition‘ and the function is called in background then the bash does not
evaluate it properly

Following are the cross compiled machine details.

MACHINE="arm"
OS="linux-gnueabi"
CC="arm-cortex_a9_v004-linux-gnueabi-gcc"
CFLAGS=" -DPROGRAM='bash' -DCONF_HOSTTYPE='arm'
-DCONF_OSTYPE='linux-gnueabi'
-DCONF_MACHTYPE='arm-cortex_a9_v004-linux-gnuea
bi' -DCONF_VENDOR='cortex_a9_v004' -DLOCALEDIR='/usr/local/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I.
-I./include -I./lib   -O2 -Wno-parentheses -Wno-format-security"
RELEASE="4.4"
PATCHLEVEL="19"
RELSTATUS="release"
MACHTYPE="arm-cortex_a9_v004-linux-gnueabi"

file bash
=========
bash: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked
(uses shared libs), for GNU/Linux 3.4.0, not stripped

bash --version
===============
GNU bash, version 4.4.19(1)-release (arm-cortex_a9_v004-linux-gnueabi)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law


The following snippet is working fine in x86 processor machine not working
in arm processor machine from bash 4.3 version onwards.

test.sh
=====
#!/bin/bash
rm out.txt
function abc() {
  if [ 2 -eq 1 ]; then
    echo "TRUE"
  else
    echo "FALSE"
  fi
}
abc &

bash -x test.sh
===========
+ rm -f out.txt
+ abc
+ '[' 2 -eq 1 ']'
+ echo TRUE  <---- Here we are expecting FALSE
TRUE

please provide some guidance on how to resolve the problem, let me know if
problem statement is not clear.

-- 
Lakshman

Reply via email to