Hi,

`svn update` aborts with an assertion when it creates a conflict on the working 
copy root itself plus at least one other conflict, and the command runs from 
inside the working copy root.

    svn: subversion/libsvn_subr/path.c:427: svn_path_compare_paths: Assertion 
`is_canonical(path2, path2_len)' failed.
    Aborted

Seen with svn 1.14.5 on Linux. We first hit it on a real working copy after a 
conflicting change to `svn:externals` on the root directory.

Reproduction script (no network needed):

    #!/bin/sh
    set -e
    T=$(mktemp -d); cd "$T"
    svnadmin create r; R="file://$T/r"
    svn co -q "$R" a; cd a
    echo base > f; svn add -q f; svn ps -q p base .; svn ci -q -m base; cd ..
    svn co -q "$R" b
    cd a; echo theirs > f; svn ps -q p theirs .; svn ci -q -m theirs; cd ..
    cd b; echo mine > f; svn ps -q p mine .
    svn up --accept postpone   # aborts here

Output:

    Updating '.':
    C    f
     C   .
    Updated to revision 2.
    svn: subversion/libsvn_subr/path.c:427: svn_path_compare_paths: Assertion 
`is_canonical(path2, path2_len)' failed.
    Aborted

Running the update from the parent directory (`svn up --accept postpone b`) 
works and prints the conflict summary normally. With only one conflict, the 
update also works.

Root cause (as far as I can tell):

1. notify_body() in subversion/svn/notify.c stores each conflicted path in 
display form, relative to the current directory, via 
svn_cl__local_style_skip_ancestor(). For the working copy root this gives ".".
2. svn_cl__conflict_stats_get_paths() sorts these paths with 
svn_sort__array(*conflicted_paths, svn_sort_compare_paths).
3. svn_sort_compare_paths() calls svn_path_compare_paths(), which asserts 
is_canonical(). is_canonical() in libsvn_subr/path.c rejects "." 
(SVN_PATH_IS_PLATFORM_EMPTY), so the assertion fails as soon as "." is compared 
with another path.

switch-cmd.c and merge-cmd.c call svn_cl__conflict_stats_get_paths() too, so 
svn switch and svn merge are probably affected as well. I have not tested them.

The code looks the same on trunk.

I am happy to test a patch if anyone would be so kind to fix this.

Thanks,
Henrik Holst

Reply via email to