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

Re: Cannot get info for a file that was inside of file-replaced directory

From: Nathan Hartman <hartman.nathan_at_gmail.com>
Date: Tue, 26 Nov 2019 17:03:39 -0500

On Tue, Nov 26, 2019 at 12:21 PM Nathan Hartman
<hartman.nathan_at_gmail.com> wrote:
> On Mon, Nov 25, 2019 at 12:03 PM Julian Foad <julianfoad_at_apache.org> wrote:
> > Yes, (2): it already checks for two error codes:
> >
> > ((err->apr_err == SVN_ERR_CLIENT_UNRELATED_RESOURCES) ||
> > (err->apr_err == SVN_ERR_FS_NOT_FOUND)))
> >
> > we need to add:
> >
> > (err->apr_err == SVN_ERR_FS_NOT_DIRECTORY) ||
> >
> > Fixed: http://svn.apache.org/r1870395
> >
> > This does beg the question of what is the total set of possible failure
> > modes that should be handled the same way.
>
> I went through the list of error in svn_error_codes.h one by one and
> two possibilities came to mind:
>
> The first is SVN_ERR_FS_NOT_FILE. I wonder if this code would appear
> and cause a failure if a similar test is run, but replacing a file
> with a directory instead of replacing a directory with a file... I'll
> test that scenario a little later...

Nope. Replacing a file with a dir does not appear to trigger an error
here. I tested with r1870266 (before the fix) and r1870479 (after the
fix). I guess the only way to know whether there are additional
failure modes is with random testing as you suggested previously.

For the record, I tested with (excuse the hard-coded paths, again):

[[[

#!/bin/bash

SVN=/home/nate/ramdrive/svn-trunk/subversion/svn/svn
SVNADMIN=/home/nate/ramdrive/svn-trunk/subversion/svnadmin/svnadmin

REPO="/home/nate/ramdrive/repo"
WC="/home/nate/ramdrive/wc"

rm -rf "$REPO"
rm -rf "$WC"

echo "Running test with this version of Subversion:"
svnversion /home/nate/ramdrive/svn-trunk

set -x

"$SVNADMIN" create "$REPO"
"$SVN" checkout "file://$REPO" "$WC"
cd "$WC"

# Revision 1 will create a file called dir

echo "to be replaced" > dir
"$SVN" add dir
"$SVN" ci -m 'Add a file called dir'

# Revision 2 will replace the file called dir with an actual dir

"$SVN" mkdir temp

if [ "$1" == "move" ]; then
    # Move
    "$SVN" mv dir temp/file
elif [ "$1" == "copy" ]; then
    # Copy and remove
    "$SVN" cp dir temp/file
    "$SVN" rm dir
else
    # Remove first and then copy
    "$SVN" rm dir
    "$SVN" cp dir_at_BASE temp/file
fi

"$SVN" mv temp dir

# Commit r2
"$SVN" ci -m 'Replace file called dir with an actual dir called dir'

"$SVN" up

"$SVN" info "file://$REPO/dir"@1 # File cannot be info-ed

]]]

Nathan
Received on 2019-11-26 23:04:00 CET

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