s...@apache.org wrote on Tue, May 31, 2011 at 12:23:05 -0000:
> Author: stsp
> Date: Tue May 31 12:23:05 2011
> New Revision: 1129641
> 
> URL: http://svn.apache.org/viewvc?rev=1129641&view=rev
> Log:
> Make 'svnadmin verify' error out if an invalid path is found in the 
> repository.
> 

Thanks :-)  Reviewing:

> There have been reports of non-UTF-8 paths having entered repositories,
> probably due to buggy third-party clients running against pre-1.6 servers
> (pre-1.6 servers do not verify filename encoding).
> See this thread for one such report, which also mentions that
> 'svnadmin verify' didn't detect this problem:
> http://svn.haxx.se/users/archive-2011-05/0361.shtml
> 
> * subversion/include/private/svn_fs_util.h
>   (svn_fs__path_valid): Declare.
> 

svn_fs_util.h is for the libsvn_fs_util library; I think you want
to move the declaration to svn_fs_private.h.

> +++ subversion/trunk/subversion/libsvn_repos/dump.c Tue May 31 12:23:05 2011
> @@ -36,6 +36,7 @@
>  #include "svn_props.h"
>  
>  #include "private/svn_mergeinfo_private.h"
> +#include "private/svn_fs_util.h"
>  

(here too)

> +++ subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py Tue May 31 
> 12:23:05 2011
> @@ -1315,6 +1315,63 @@ text
>    svntest.actions.load_repo(sbox, dump_str=dump_str,
>                              bypass_prop_validation=True)
>  
> +# This test intentionally corrupts a revision and assumes an FSFS
> +# repository. If you can make it work with BDB please do so.
> +# However, the verification triggered by this test is in the repos layer
> +# so it will trigger with either backend anyway.
> +@SkipUnless(svntest.main.is_fs_type_fsfs)
> +def verify_non_utf8_paths(sbox):
> +  "svadmin verify with non-UTF-8 paths"
> +
> +  dumpfile = clean_dumpfile()
> +  test_create(sbox)
> +
> +  # Load the dumpstream
> +  load_and_verify_dumpstream(sbox, [], [], dumpfile_revisions, dumpfile,
> +                             '--ignore-uuid')
> +
> +  # Replace the path 'A' in revision 1 with a non-UTF-8 sequence.
> +  # This has been observed in repositories in the wild, though Subversion
> +  # 1.6 and greater should prevent such filenames from entering the 
> repository.
> +  path1 = os.path.join(sbox.repo_dir, "db", "revs", "0", "1")

You could use the fsfs_file() helper here.  This will make the test work
correctly when passing FSFS_PACKING=1 FSFS_SHARDING=1 to 'make check'.

(and yes, that is extremely an edge case.  If you don't have time I'll
fix it myself later this week)

Reply via email to