From b2f8624c6ccb7240948d0cd158773232013d1d64 Mon Sep 17 00:00:00 2001
From: andrug <andrug@localhost>
Date: Fri, 04 Apr 2008 09:00:02 +0000
Subject: [PATCH] Major Problem: issue when using NFS path value for TMPDIR variable (staf copy loops for ever  when trying to copy a folder to itself)

---
 opends/tests/system-tests/phases/shared/functions/stafcmd.xml |   58 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/opends/tests/system-tests/phases/shared/functions/stafcmd.xml b/opends/tests/system-tests/phases/shared/functions/stafcmd.xml
index 0992780..f79d6e3 100755
--- a/opends/tests/system-tests/phases/shared/functions/stafcmd.xml
+++ b/opends/tests/system-tests/phases/shared/functions/stafcmd.xml
@@ -195,7 +195,8 @@
         'fileFd'  : fileFd }
       </call>
       <call function="'writeMessage'">
-        { 'content'  : 'Copy directory %s FROM machine %s TO machine %s into %s' % (fromDirectory,location,remoteHost,toDirectory),
+        { 'content'  : 'Copy directory %s FROM machine %s TO machine %s into %s' %\
+                       (fromDirectory,location,remoteHost,toDirectory),
           'fileFd'   : fileFd }
       </call>
       
@@ -204,29 +205,52 @@
           <call function="'writeMessage'">
           {
             'content' : 'SKIP : same directory %s, same host %s' % \
-                        (remoteHost,remoteHost),
+                        (fromDirectory,remoteHost),
             'fileFd'  : fileFd 
           }
           </call>
         </sequence>
       <else>
         <sequence>
-          <stafcmd name="'STAF Command: copy directory'">
-            <location>'%s' % location</location>
-            <service>'fs'</service>
-            <request>
-                'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s RECURSE CASEINSENSITIVE' % (fromDirectory,toDirectory,remoteHost)
-            </request>
-          </stafcmd>
-          <script>
-            cmdRC=RC
-            cmdResult=STAFResult
-          </script>
-          <call function="'checkRC'">
-            { 'returncode' : cmdRC ,
-              'result'     : cmdResult,
-              'fileFd'     : fileFd }
+          
+          <call function="'isFile'">
+          {
+            'location' : remoteHost,
+            'fileName' : toDirectory
+          }
           </call>
+          <script>
+            fileExist = STAXResult
+          </script>
+          <if expr="fileExist == TRUE">
+            <call function="'writeMessage'">
+            {
+              'content' : 'SKIP: remote folder %s exists (NFS?) on %s' % \
+                          (toDirectory,remoteHost),
+              'fileFd'  : fileFd 
+            }
+            </call>
+          <else>
+            <sequence>
+              <stafcmd name="'STAF Command: copy directory'">
+                <location>'%s' % location</location>
+                <service>'fs'</service>
+                <request>
+                    'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s RECURSE CASEINSENSITIVE' % (fromDirectory,toDirectory,remoteHost)
+                </request>
+              </stafcmd>
+              <script>
+                cmdRC=RC
+                cmdResult=STAFResult
+              </script>
+              <call function="'checkRC'">
+                { 'returncode' : cmdRC ,
+                  'result'     : cmdResult,
+                  'fileFd'     : fileFd }
+              </call>
+            </sequence>
+          </else>
+          </if>
         </sequence>
       </else>
       </if>

--
Gitblit v1.10.0