Tomas M:
> Unionctl has 2 bugs.
        :::
> Third thing is not a bug but a feature request, if ./file doesn't exist, 
> unionctl should return non-zero exit code (now it just prints empty 
> string and exits with zero).

Ouch!
Thank you for your report.
Will you test this patch?

Junjiro Okajima

----------------------------------------------------------------------

Index: unionctl
===================================================================
RCS file: /cvsroot/aufs/aufs/util/unionctl,v
retrieving revision 1.16
diff -u -p -r1.16 unionctl
--- unionctl    5 Feb 2007 01:44:49 -0000       1.16
+++ unionctl    8 Feb 2007 12:38:30 -0000
@@ -87,7 +87,7 @@ shift 2
 
 tgt=`grep -w "$e_mntpnt aufs" $f | tail -1 | rev | cut -f3- -d' ' | rev`
 test "$tgt" = "" && eecho "${me}: no such mntpnt $mntpnt" && exit 1
-dev=`echo "$tgt" | sed -e 's: '"$mntpnt aufs"' .*$::`
+dev=`echo "$tgt" | sed -e 's: '"$mntpnt aufs"' .*$::'`
 branches > $tmp
 #cat $tmp | while read i; do echo $i; done; exit
 
@@ -179,20 +179,26 @@ do_list()
 
 do_query1()
 {
-       local path i f
-       cat $tmp | rev | cut -f2- -d' ' | rev |
-       while read path
+       local path i f noexist
+       cat $tmp | rev | cut -f2- -d' ' | rev > $tmp.path
+       for i
        do
-               for i
+               while read path
                do
-                       i=`echo "$i" | sed -e 's:^/::'`
-                       test -e "$mntpnt/$i" || continue
-                       f="$path/$i"
-                       test -e "$f" && if [ $# -eq 1 ]
-                       then echo "$path"
-                       else echo "$f"
-                       fi || :
-               done
+                       set +e
+                       f=`readlink -f "$path/$i"`
+                       noexist=$?
+                       set -e
+                       test ! $noexist -eq 0 && continue
+                       if [ $# -eq 1 ]
+                       then
+                               echo "$path"
+                       else
+                               echo "$f"
+                       fi
+                       break
+               done < $tmp.path
+               test $noexist -eq 0
        done
 }
 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Reply via email to