Import fails with svn: E160005: Cannot replace a directory from within

Configure is OK.
Other repos were imported OK (so, I guess my system conf is OK). I just need a one-time import.

Error occurs when processing the latest revisions (1065/1128) :

======
r1066
A Tags/Plugin OL 1&2 1.2.0 (from Trunk:1065)
======

[2021-01-12 14:39:50.935][subgit-import][1] svn: E160005: Cannot replace a directory from within
svn: E175002: REPORT of '/svn/LDM3000/!svn/vcc/default': 500 Internal Server Error (http://lmn-s-elara:81)
com.syntevo.svngitkit.core.b.i: svn: E160005: Cannot replace a directory from within
svn: E175002: REPORT of '/svn/LDM3000/!svn/vcc/default': 500 Internal Server Error (http://lmn-s-elara:81)
	at com.syntevo.svngitkit.core.b.i.a(SourceFile:29)
	at com.syntevo.svngitkit.core.c.C.b(SourceFile:738)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:436)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:396)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:342)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:169)
	at com.syntevo.svngitkit.core.c.O.c(SourceFile:43)
	at com.syntevo.svngitkit.core.c.O.b(SourceFile:36)
	at org.tmatesoft.translator.k.aj.a(SourceFile:1464)
	at org.tmatesoft.translator.k.aj.c(SourceFile:997)
	at org.tmatesoft.translator.k.aj.a(SourceFile:1020)
	at org.tmatesoft.translator.k.aj.b(SourceFile:1078)
	at org.tmatesoft.translator.k.aj.a(SourceFile:682)
	at org.tmatesoft.translator.k.aj.a(SourceFile:651)
	at org.tmatesoft.translator.k.d.g.a(SourceFile:244)
	at org.tmatesoft.translator.k.d.f.d(SourceFile:47)
	at org.tmatesoft.translator.a.I.b(SourceFile:136)
	at org.tmatesoft.translator.a.t.c(SourceFile:23)
	at org.tmatesoft.translator.b.a(SourceFile:193)
	at org.tmatesoft.translator.b.a(SourceFile:144)
	at org.tmatesoft.translator.b.a(SourceFile:54)
	at org.tmatesoft.translator.process.f.d(SourceFile:136)
	at org.tmatesoft.translator.process.f.c(SourceFile:106)
	at org.tmatesoft.translator.b.a(SourceFile:79)
	at org.tmatesoft.translator.b.a(SourceFile:70)
	at org.tmatesoft.translator.SubGit.main(SourceFile:10)
Caused by: org.tmatesoft.svn.core.SVNException: svn: E160005: Cannot replace a directory from within
svn: E175002: REPORT of '/svn/LDM3000/!svn/vcc/default': 500 Internal Server Error (http://lmn-s-elara:81)
	at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:70)
	at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:57)
	at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.runReport(DAVRepository.java:1363)
	at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.update(DAVRepository.java:853)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:1893)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:1046)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:782)
	at com.syntevo.svngitkit.core.c.C.b(SourceFile:700)
	... 24 more
[2021-01-12 14:39:52.250][subgit-import][1] Restoring refs to reflect SVN state.
[2021-01-12 14:39:53.834][subgit-import][1] Refs were successfully updated
[2021-01-12 14:39:53.836][subgit-import][1] svn: E160005: Cannot replace a directory from within
svn: E175002: REPORT of '/svn/LDM3000/!svn/vcc/default': 500 Internal Server Error (http://lmn-s-elara:81)
org.tmatesoft.translator.util.f: svn: E160005: Cannot replace a directory from within
svn: E175002: REPORT of '/svn/LDM3000/!svn/vcc/default': 500 Internal Server Error (http://lmn-s-elara:81)
	at org.tmatesoft.translator.util.f.c(SourceFile:109)
	at org.tmatesoft.translator.util.f.b(SourceFile:75)
	at org.tmatesoft.translator.k.aj.c(SourceFile:1000)
	at org.tmatesoft.translator.k.aj.a(SourceFile:1020)
	at org.tmatesoft.translator.k.aj.b(SourceFile:1078)
	at org.tmatesoft.translator.k.aj.a(SourceFile:682)
	at org.tmatesoft.translator.k.aj.a(SourceFile:651)
	at org.tmatesoft.translator.k.d.g.a(SourceFile:244)
	at org.tmatesoft.translator.k.d.f.d(SourceFile:47)
	at org.tmatesoft.translator.a.I.b(SourceFile:136)
	at org.tmatesoft.translator.a.t.c(SourceFile:23)
	at org.tmatesoft.translator.b.a(SourceFile:193)
	at org.tmatesoft.translator.b.a(SourceFile:144)
	at org.tmatesoft.translator.b.a(SourceFile:54)
	at org.tmatesoft.translator.process.f.d(SourceFile:136)
	at org.tmatesoft.translator.process.f.c(SourceFile:106)
	at org.tmatesoft.translator.b.a(SourceFile:79)
	at org.tmatesoft.translator.b.a(SourceFile:70)
	at org.tmatesoft.translator.SubGit.main(SourceFile:10)
Caused by: com.syntevo.svngitkit.core.b.i: svn: E160005: Cannot replace a directory from within
svn: E175002: REPORT of '/svn/LDM3000/!svn/vcc/default': 500 Internal Server Error (http://lmn-s-elara:81)
	at com.syntevo.svngitkit.core.b.i.a(SourceFile:29)
	at com.syntevo.svngitkit.core.c.C.b(SourceFile:738)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:436)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:396)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:342)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:169)
	at com.syntevo.svngitkit.core.c.O.c(SourceFile:43)
	at com.syntevo.svngitkit.core.c.O.b(SourceFile:36)
	at org.tmatesoft.translator.k.aj.a(SourceFile:1464)
	at org.tmatesoft.translator.k.aj.c(SourceFile:997)
	... 16 more
Caused by: org.tmatesoft.svn.core.SVNException: svn: E160005: Cannot replace a directory from within
svn: E175002: REPORT of '/svn/LDM3000/!svn/vcc/default': 500 Internal Server Error (http://lmn-s-elara:81)
	at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:70)
	at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:57)
	at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.runReport(DAVRepository.java:1363)
	at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.update(DAVRepository.java:853)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:1893)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:1046)
	at com.syntevo.svngitkit.core.c.C.a(SourceFile:782)
	at com.syntevo.svngitkit.core.c.C.b(SourceFile:700)
	... 24 more

Hello!

The error E160005 usually points to problems in the SVN repository. Could you please advise does ‘svn log -v’ shows the history normally for that repository, especially for the revision 1066? Does ‘svn log --diff -c 1066’ work well in this repository?

Hi Ildar, and thanks for your quick answer !
I’ve tried “svn log --diff -c 1066’” which seems to work fine, but the output is really big: it generates a 11MB file !

Hi!
Thank you for the confirmation! Looks like the repository is in good state, so we would need to investigate the issue further. May I ask you to share the ‘svn log -v’ output with us along with SubGit logs from the affected repository? I mean, the failed import log.

additionally, could you please advise what is the operating system on the SVN server and what is OS on the SubGit machine?

Hi,
The svn log -v gives this on revision 1066:

D:\Dev\LDM3000>svn log -v -c 1066
------------------------------------------------------------------------
r1066 | switz | 2019-07-30 09:07:12 +0200 (mar. 30 juil. 2019) | 1 ligne
Chemins modifi'sÿ:
   A /Tags/Plugin OL 1&2 1.2.0 (de /Trunk:1065)

Tag Pligin OL 1&2 1.2.0
------------------------------------------------------------------------

It seems to be the addition of a new tag, so I guess that’s why the svn diff command is so big ! I cannot provide you the full diff command.

SVN server runs on a 2008R2 Windows, SVN server version is 1.1.2
Subgit runs on WSL2 (Debian) over Win10

Hi,

actually, I didn’t mean the “svn log --diff -c 1066’” output, I meant the ‘svn log -v’ output, without diffs, it would give us a glue about what could be the cause of the issue. Could you please share it with us?

Hi Ildar, it’s 10 years of history and 16k lines !
svnlogvuser.lst (943.8 KB)

subgit error is :

SubGit version 3.3.10 ('Bobique') build #4368

Translating Subversion revisions to Git commits...

IMPORT FAILED

error: svn: E160005: Cannot replace a directory from within
error: svn: E175002: REPORT of '/svn/LDM3000/!svn/vcc/default': 500 Internal Server Error (http://lmn-s-elara:81)
error: Unexpected error has occurred; please report along with the logs ('/mnt/c/Dev/gitlab/svn-import/subgit-import-20210112-172744.zip')
error:   to http://issues.tmatesoft.com/, thank you!

and here is the log
subgit-import-20210112-172744.zip (345.7 KB)

Hello,
thanks for the logs. I couldn’t find any explanation why this problem could happen except maybe SVN being too old and thus containing bugs that could be fixed in subsequent versions.

Internally SubGit tries SVN API analogs of these commands to get changes between 1065 and 1066:

svn checkout http://lmn-s-elara:81/svn/LDM3000/Trunk@1065
svn switch "http://lmn-s-elara:81/svn/LDM3000/Tags/Plugin%20OL%201&2%201.2.0"@1066

Could you try these commands to see if they work?

In the history you provided, there was a similar situation at r46 -> r47 update. Again a tag was created from Trunk using the same SVN API queries, but that time without any issue, so I don’t see any reason why this could fail for r1065-> r1066 update except maybe corrupted SVN repository or outdated (potentially buggy) SVN server software.

I have several recommendations/suggestions/work-arounds for this issue.

  1. Try to repair your SVN repository. To do that run on the server with SVN:
svnadmin dump path/to/svn/repository > repo.dump
svnadmin create path/for/recovered/repository
svnadmin load path/for/recovered/repository < repo.dump
#
# replace path/to/svn/repository with path/for/recovered/repository
# and don't forget to create a backup

It could sound strange but ‘svnadmin dump/load’ cycle repairs some problems in the SVN repositories. If the problem was caused by SVN repository corruption, this could help.

  1. Upgrade your SVN server software version if possible.
  2. If possible send an obfuscated SVN dump to us. To do that use this script:
    https://github.com/dmit10/destroycontents
    It uses Perl and libsvn-dump-perl package and as one can see from its code, it replaces every byte of every file (except symlinks) with a dot (’.’) character. So the original content is obfuscated, but the repository structure is preserved.
    You can get the first 1066 revisions of your repository and obfuscate and compress it:
svnadmin dump -r 1:1066 path/to/svn/repository > repo.dump
./destroycontents.pl repo.dump > repo-obfuscated.dump
gzip repo-obfuscated.dump

As every byte is replaced with ‘.’, the dump becomes highly compressible, so you can attach it here. We hope to be able to reproduce the problem then.
4. If you can’t upgrade your SVN server software version, you can use either ‘file://’ protocol or another (newer) SVN server software for initial conversion of the SVN repository and then switch back to your current SVN server software when initial conversion is over.

I hope some of the work-arounds helps.

Dear Dmitry,

Thanks for your help, I’ve tried your 1st recommendation, and it seems that the SVN repository is indeed containing bugs :

C:\temp>svn checkout http://lmn-s-elara:81/svn/LDM3000/Trunk@1065
A    [...many files appear here...]
 U   Trunk
Checked out revision 1065.
C:\temp>cd Trunk
C:\temp\Trunk>svn switch "http://lmn-s-elara:81/svn/LDM3000/Tags/Plugin%20OL%201&2%201.2.0"@1066
svn: E160005: Cannot replace a directory from within

I’m going to try to repair the SVN repo with the dump/load procedure you provided, and I’ll keep you posted of the status.

Again, thanks for your help.

Dear Dmitry,
The dump/reload worked but I had the same error with subgit import. So I (hardly) managed to set up a local server with latest SVN version, and I could dump the repo from the old SVN server. Now the import process is fine.
Many thanks for your help !
I have another SVN repo whose import fails with the same error. I’ll apply the same treatment, and I hope it will give the same result :)
Have a nice day,
Antoine