[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Unlocking a file and pre-unlock hook failure

From: vijay <vijay_at_collab.net>
Date: Wed, 01 Jun 2011 20:45:00 +0530

Hi,

Last week, I was working on this issue: "Whenever the pre-unlock hook
fails, Subversion server sends the error message "Unlock blocked by
pre-unlock hook (exit code 1)...." to Apache. But Apache's mod_dav is
not handling the error and it is not sending any error messages to
client side, instead "500 Internal Server Error" is displayed to the user."

Actually, that is not a bug with subversion. Apache's mod_dav have to
handle the error properly and send it to the user. I have filed one
issue in issues.apache.org and uploaded my patch there.[1]

While working on this issue, I came across another bug: "whenever the
pre-unlock hook exits with non-zero return code and if the connection is
made via ra_neon, the unlock operation ends with "<filename> unlocked.\n
Aborted". The file is actually unlocked in the working copy not in the
repository". The repository is still having the lock due to pre-unlock
blocking the unlock action. Here, Working copy should not lose the lock
on the file, right?

If the connection is made via ra_serf, then the error message is "svn:
E020014: Unspecified error message: 500 Internal Server Error". (It
should not display Internal server error. The mod_dav patch at [1] will
fix it.)

I have attached a testcase and fix for this issue.

ra_neon:

This testcase aborts with the following exception as there are unhandled
errors(error with 500 http status code) during unlock operation and they
didn't get cleared from the pool.

<snip>
EXCEPTION: SVNProcessTerminatedBySignal
Traceback (most recent call last):
   File
"/home/vijayaguru/svn-sandbox/svn-trunk/subversion/tests/cmdline/svntest/main.py",
line 1288, in run
     rc = self.pred.run(sandbox)
   File
"/home/vijayaguru/svn-sandbox/svn-trunk/subversion/tests/cmdline/svntest/testcase.py",
line 176, in run
     return self.func(sandbox)
   File
"/home/vijayaguru/svn-sandbox/svn-trunk/subversion/tests/cmdline/lock_tests.py",
line 1718, in block_unlock_if_pre_unlock_hook_fails
     svntest.actions.run_and_verify_svn2(None, None, "", 1, 'unlock',
pi_path)
   File
"/home/vijayaguru/svn-sandbox/svn-trunk/subversion/tests/cmdline/svntest/actions.py",
line 306, in run_and_verify_svn2
     exit_code, out, err = main.run_svn(want_err, *varargs)
   File
"/home/vijayaguru/svn-sandbox/svn-trunk/subversion/tests/cmdline/svntest/main.py",
line 591, in run_svn
     *(_with_auth(_with_config_dir(varargs))))
   File
"/home/vijayaguru/svn-sandbox/svn-trunk/subversion/tests/cmdline/svntest/main.py",
line 347, in run_command
     None, *varargs)
   File
"/home/vijayaguru/svn-sandbox/svn-trunk/subversion/tests/cmdline/svntest/main.py",
line 509, in run_command_stdin
     *varargs)
   File
"/home/vijayaguru/svn-sandbox/svn-trunk/subversion/tests/cmdline/svntest/main.py",
line 479, in spawn_process
     stdout_lines, stderr_lines, exit_code = wait_on_pipe(kid, binary_mode)
   File
"/home/vijayaguru/svn-sandbox/svn-trunk/subversion/tests/cmdline/svntest/main.py",
line 445, in wait_on_pipe
     raise SVNProcessTerminatedBySignal
SVNProcessTerminatedBySignal
</snip>

At the end of the testcase, I thought of checking the status of the
working copy with expected status as "writelocked=K". But I couldn't do
it as the test raises exception in between, i.e., during unlock
operation itself.

ra_serf:

The test passes with ra_serf as all kind of errors has been handled here.

Please review the patch and respond.

Thanks & Regards,
Vijayaguru

[1] https://issues.apache.org/bugzilla/show_bug.cgi?id=51297

P.S: I will be very happy if someone from Apache's mod_dav development
team can take a look at the patch in [1]. Please let me know if we can
handle it in some other way. Eagerly awaiting for your response.

Received on 2011-06-01 17:15:34 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.