From: Andrew Vagin <[email protected]>
1. don't redirect all output to /dev/null. It's bad idea, because we can't
investigate bugs without error messages.
2. check exit code of command "zip". If it failed, we get error during
make install that can't found a zip file.
version 2: fixed conflicts with Jiri Palecek´s patch.
---
testcases/commands/unzip/unzip_genfile.sh | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/testcases/commands/unzip/unzip_genfile.sh
b/testcases/commands/unzip/unzip_genfile.sh
index 7159573..81ce4ed 100755
--- a/testcases/commands/unzip/unzip_genfile.sh
+++ b/testcases/commands/unzip/unzip_genfile.sh
@@ -41,10 +41,10 @@ RC=0 # return value from commands
while [ $dircnt -lt $numdirs ]
do
dirname=$dirname/d.$dircnt
- mkdir -p $dirname >/dev/null 2>&1 || RC=$?
+ mkdir -p $dirname || RC=$?
if [ $RC -ne 0 ]
then
- echo "unzip_genfile.sh: ERROR: while creating $numdirs dirs."
+ echo "unzip_genfile.sh: ERROR: while creating $numdirs dirs."
1>&2
exit $RC
fi
fcnt=0
@@ -53,7 +53,7 @@ do
touch $dirname/f.$fcnt
if [ $RC -ne 0 ]
then
- echo "unzip_genfile.sh: ERROR: creating $numdirs dirs."
+ echo "unzip_genfile.sh: ERROR: creating $numdirs dirs."
1>&2
exit $RC
fi
fcnt=$(($fcnt+1))
@@ -63,8 +63,18 @@ done
# Create ZIP file.
-zip -r tst_unzip_file.zip /tmp/tst_unzip.dir >/dev/null 2>&1
+zip -r tst_unzip_file.zip /tmp/tst_unzip.dir || RC=$?
+if [ $RC -ne 0 ]
+then
+ echo "unzip_genfile.sh: ERROR: creating tst_unzip_file.zip archive."
1>&2
+ exit $RC
+fi
-rm -fr /tmp/tst_unzip.* >/dev/null 2>&1
+rm -fr /tmp/tst_unzip.* || RC=$?
+if [ $RC -ne 0 ]
+then
+ echo "unzip_genfile.sh: ERROR: deleting tempory files." 1>&2
+ exit $RC
+fi
exit $RC
--
1.5.6.4
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list