[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Unexpected return from subscripts
From: |
Zhong Wang |
Subject: |
[Help-bash] Unexpected return from subscripts |
Date: |
Fri, 27 Jul 2012 12:08:00 +0800 |
Hi all,
We met a very weird problem with bash "version
3.00.15(1)-release" running on a RedHat server. We are using a hadoop-test script to test whether a
file exists on HDFS. But we observed several times that the hadoop-test
script, which is a subscript in a control-flow script, returned
unexpectly. It seems the subscript was put in *background*, and the
main-control script just go on and got a wrong return value. We added
some debug log in the hadoop-test script, and it looks like this:
============== sh -x DEBUG LOG ==============
+ /home/work/hadoop-client/hadoop/bin/hadoop dfs -test -e xxxFile
+ '[' 0 -ne 0 ']' # this is unexpected, the real return value is 1.
+ some other things...
+ ...
+ ...
+ test: File does not exists: xxxFile # this is unexpeted, should
be printed before the condition statement. Looks like test script goes
to *background*
+ ...
=============================================
The scripts are simple enough and we could make sure this is not a programming problem. It looks like subscripts are put to *background* unexpectly. We are not sure this is whether a kernel bug or bash bug.
This problem bothered us for several months because we have a large
cluster with thousands of nodes running the hadoop-test script. We met
this case every month. Anybody ever met the same problem?
Thanks,
Zhong
- [Help-bash] Unexpected return from subscripts,
Zhong Wang <=