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

svn (un)lock commands succeed when pre-(un)lock hooks fail on svn 1.9

From: Gustavo Chaves <gustavo_at_gnustavo.com>
Date: Sat, 22 Aug 2015 17:02:15 -0300

Hi there,

It seems that svn 1.9 changed the behaviour of the "svn lock" and the "svn
unlock" commands with regards to the fate of the corresponding
pre-lock/pre-unlock hooks.

Up to svn 1.8, when those hooks failed (exit code != 0) the commands (svn
lock/unlock) failed too.

Now, on svn 1.9, the commands always succeed.

To reproduce you can execute the atached script, which creates a temporary
directory, cd to it, creates a repository and a working copy, commits a
file and then tries to lock the file, before and after installing a hook
that always fail. With svn 1.8 in you path the results would be like this:

$ ./repro-lock.sh
The files will be left in the /tmp/tmp.xoidDWLkub directory
+ cd /tmp/tmp.xoidDWLkub
+ svnadmin create repo
+ svn --version
+ head -1
svn, version 1.8.10 (r1615264)
+ svn co file:///tmp/tmp.xoidDWLkub/repo wc
Checked out revision 0.
+ cd wc
+ touch file.txt
+ svn add file.txt
A file.txt
+ svn ci -mx
Adding file.txt
Transmitting file data .
Committed revision 1.
+ svn up
Updating '.':
At revision 1.
+ svn lock file.txt
'file.txt' locked by user 'gustavo'.
+ echo lock succeeded without a hook
lock succeeded without a hook
+ cat
+ chmod +x ../repo/hooks/pre-lock
+ svn lock file.txt
svn: E165001: Lock blocked by pre-lock hook (exit code 1) with no output.
+ echo lock failed with a failing hook
lock failed with a failing hook

Now, with svn 1.9 in your path the results are like this:

$ ./repro-lock.sh
The files will be left in the /tmp/tmp.qGx4oqIlNo directory
+ cd /tmp/tmp.qGx4oqIlNo
+ svnadmin create repo
+ svn --version
+ head -1
svn, version 1.9.0 (r1692801)
+ svn co file:///tmp/tmp.qGx4oqIlNo/repo wc
Checked out revision 0.
+ cd wc
+ touch file.txt
+ svn add file.txt
A file.txt
+ svn ci -mx
Adding file.txt
Transmitting file data .done
Committing transaction...
Committed revision 1.
+ svn up
Updating '.':
At revision 1.
+ svn lock file.txt
'file.txt' locked by user 'gustavo'.
+ echo lock succeeded without a hook
lock succeeded without a hook
+ cat
+ chmod +x ../repo/hooks/pre-lock
+ svn lock file.txt
svn: warning: W165001: Lock blocked by pre-lock hook (exit code 1) with no
output.
+ echo lock succeeded with a failing hook
lock succeeded with a failing hook

The problem was reported to me by the Debian maintainers of my SVN::Hooks
Perl module at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=795756.

-- 
Gustavo.

Received on 2015-08-22 22:02:53 CEST

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

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