Can you confirm that the file is locked after the command? (E.g. by running svn
status on the target)
Does it lock the file when the hook blocks it… or does ‘svn lock’ return
success?
At the api level the lock command performs a callback per target to return the
failure/success of each target, and it is not clear which part you call
succeeded?
The number of regression test of this operation was increased significantly for
1.9, as the behavior was made more consistent over the different ra layers and
atomicity was improved.
Bert
Sent from Mail for Windows 10
From: Gustavo Chaves
Sent: zaterdag 22 augustus 2015 22:02
To: [email protected]
Subject: svn (un)lock commands succeed when pre-(un)lock hooks fail on svn 1.9
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.