You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Philip Martin <ph...@codematters.co.uk> on 2003/04/07 20:36:24 UTC

Re: svn commit: rev 5577 - in trunk/subversion: libsvn_client tests/clients/cmdline

philip@tigris.org writes:

> Log:
> Fix a crash caused by 'svn rm URL' closing an invalid access baton.
[...]
> Modified: trunk/subversion/tests/clients/cmdline/basic_tests.py
> ==============================================================================
> --- trunk/subversion/tests/clients/cmdline/basic_tests.py	(original)
> +++ trunk/subversion/tests/clients/cmdline/basic_tests.py	Mon Apr  7 15:07:24 2003
> @@ -1017,6 +1017,16 @@
>    svntest.actions.run_and_verify_svn(None, None, [],
>                                       'rm', '--force', foo_path)
>  
> +  # At one stage deleting an URL dumped core
> +  iota_URL = svntest.main.current_repo_url + '/iota'
> +
> +  svntest.actions.run_and_verify_svn(None,
> +                                     ["\n", "Committed revision 2.\n"], None,
> +                                     'rm', '-m', 'delete iota URL',
> +                                     '--username', svntest.main.wc_author,
> +                                     '--password', svntest.main.wc_passwd,
> +                                     iota_URL)

Strictly speaking all I wanted to test was that the client didn't
crash, but I had to explicitly check the output because the
run_and_verify_svn function didn't raise an error when svn dumped
core.  Is run_and_verify_svn supposed to ignore a client that crashes?

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 5577 - in trunk/subversion: libsvn_client tests/clients/cmdline

Posted by Philip Martin <ph...@codematters.co.uk>.
Branko Čibej <br...@xbc.nu> writes:

> Philip Martin wrote:
> 
> >Strictly speaking all I wanted to test was that the client didn't
> >crash, but I had to explicitly check the output because the
> >run_and_verify_svn function didn't raise an error when svn dumped
> >core.  Is run_and_verify_svn supposed to ignore a client that crashes?
> 
> It can't detect a crash, thanks to the way Python does os.popen. It
> can't even detect a non-zero return value from a spawned program.

After that hint I found this patch

http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgId=182328

which adds platform specific code that uses Popen3() to get additional
error checking.  The patch may be out of date by now but the approach
looks reasonable to me, although I don't know much about Python.
There don't appear to have been any substantial comments on the
original patch.  Are there any objections to the approach in the
patch, which in essence is

-  infile, outfile, errfile = os.popen3(command)
-  stdout_lines = outfile.readlines()
-  stderr_lines = errfile.readlines()
-
-  outfile.close()
-  infile.close()
-  errfile.close()
-
+  if windows:
+    infile, outfile, errfile = os.popen3(command)
+    stdout_lines = outfile.readlines()
+    stderr_lines = errfile.readlines()
+    outfile.close()
+    infile.close()
+    errfile.close()
+  else:
+    child = popen2.Popen3(command, 1)
+    stdout_lines = child.fromchild.readlines()
+    stderr_lines = child.childerr.readlines()
+    result = child.wait();
+    if os.WIFSIGNALED(result):
+      print "svn got signal: " + str(os.WTERMSIG(result))
+      raise SVNUnexpectedError
+    if (not error_expected) and os.WIFEXITED(result) and os.WEXITSTATUS(result):
+      map(sys.stdout.write, stderr_lines)
+      print "svn exit status: " + str(os.WEXITSTATUS(result))
+      raise SVNUnexpectedError

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 5577 - in trunk/subversion: libsvn_client tests/clients/cmdline

Posted by Branko Čibej <br...@xbc.nu>.
Philip Martin wrote:

>Strictly speaking all I wanted to test was that the client didn't
>crash, but I had to explicitly check the output because the
>run_and_verify_svn function didn't raise an error when svn dumped
>core.  Is run_and_verify_svn supposed to ignore a client that crashes?
>  
>

It can't detect a crash, thanks to the way Python does os.popen. It
can't even detect a non-zero return value from a spawned program.


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org