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

Re: Possible bug: when deleting a file scheduled for addition with some property modifications subversion leaves a .svn-work property file

From: David Glasser <glasser_at_davidglasser.net>
Date: 2007-11-01 20:09:08 CET

On 11/1/07, Alexander Sinyushkin <Alexander.Sinyushkin@svnkit.com> wrote:
> Hello, devs! I don't know whether it's a bug or not, but it looks like a
> bug. And I am also not aware of whether it has already been published,
> sorry if so.
>
> Now about the problem itself. I have noticed that if I add a file, then
> set some properties on it and then delete it after all, subversion does
> not erase a working property file though. Here is a little script to
> reproduce the problem (I remember Karl Fogel once asked me to send some
> script in such cases, I modified his one):
>
> #!/bin/sh
>
> SVNDIR=/home/alex/workspace/svn_trunk_latest
>
> SVN=${SVNDIR}/subversion/svn/svn
> SVNSERVE=${SVNDIR}/subversion/svnserve/svnserve
> SVNADMIN=${SVNDIR}/subversion/svnadmin/svnadmin
>
> URL=file://`pwd`/repos
>
> rm -rf repos wc wc2 import-me
>
> ${SVNADMIN} create repos
>
> echo "### Making a Greek Tree for import..."
> mkdir import-me
> mkdir import-me/trunk
> mkdir import-me/tags
> mkdir import-me/branches
> mkdir import-me/trunk/A
> mkdir import-me/trunk/A/B/
> mkdir import-me/trunk/A/C/
> mkdir import-me/trunk/A/D/
> mkdir import-me/trunk/A/B/E/
> mkdir import-me/trunk/A/B/F/
> mkdir import-me/trunk/A/D/G/
> mkdir import-me/trunk/A/D/H/
> echo "This is the file 'iota'." > import-me/trunk/iota
> echo "This is the file 'A/mu'." > import-me/trunk/A/mu
> echo "This is the file 'A/B/lambda'." > import-me/trunk/A/B/lambda
> echo "This is the file 'A/B/E/alpha'." > import-me/trunk/A/B/E/alpha
> echo "This is the file 'A/B/E/beta'." > import-me/trunk/A/B/E/beta
> echo "This is the file 'A/D/gamma'." > import-me/trunk/A/D/gamma
> echo "This is the file 'A/D/G/pi'." > import-me/trunk/A/D/G/pi
> echo "This is the file 'A/D/G/rho'." > import-me/trunk/A/D/G/rho
> echo "This is the file 'A/D/G/tau'." > import-me/trunk/A/D/G/tau
> echo "This is the file 'A/D/H/chi'." > import-me/trunk/A/D/H/chi
> echo "This is the file 'A/D/H/omega'." > import-me/trunk/A/D/H/omega
> echo "This is the file 'A/D/H/psi'." > import-me/trunk/A/D/H/psi
>
> echo "### Done."
> echo ""
> echo "### Importing it..."
> (cd import-me; ${SVN} import -q -m "Initial import." ${URL})
> echo "### Done."
> echo ""
>
> echo "### Check out:"
> ${SVN} co -q ${URL}/trunk wc
> echo "### Done."
> echo ""
>
> echo "### Create a file theta and schedule it for addition:"
> cd wc
> echo "This is the file 'theta'." > theta
> ${SVN} add -q theta
> echo "### Done."
> echo ""
>
> echo "### Set a foo=bar prop on theta:"
> ${SVN} ps -q foo bar theta
> echo "### Done."
> echo ""
>
> echo "### Now force deletion of theta:"
> ${SVN} delete -q --force theta
> echo "### Done."
> echo ""
>
> echo "### Now check if ./svn/props/theta.svn-work exists (it should not):"
> cd .svn/props
> if ls | grep --silent theta.svn-work; then
> echo ' *** PROBLEM: wc props file for a deleted file still
> presents, though it should not; look into wc/.svn/props'
> else
> echo ' *** all is just fine, no bugs :)'
> fi
> echo "### Done."
> echo ""
> cd ..
> cd ..
> cd ..
>
>
> I think the problem is that in the svn_wc_delete3 function (adm_ops.c) a
> base prop file is removed instead of a working one:
>
> --- adm_ops.c 2007-11-01 22:49:36.000000000 +0600
> +++ adm_ops.c.modified 2007-11-01 22:51:29.000000000 +0600
> @@ -1292,7 +1292,7 @@
> }
> if (was_schedule == svn_wc_schedule_add)
> SVN_ERR(svn_wc__loggy_props_delete(&log_accum, path,
> - svn_wc__props_base,
> + svn_wc__props_working,
> adm_access, pool));
>
> SVN_ERR(svn_wc__write_log(adm_access, 0, log_accum, pool));

Good point.

That patch isn't the complete answer though --- if the file was
copied, we really do need to delete the base props. On the other
hand, we're currently dangling both the working props (as you point
out) *and* the text-base (for copies).

What is the behavior of "svn add foo; svn rm foo" supposed to be
anyway? I always just use revert.

--dave

-- 
David Glasser | glasser_at_davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 1 20:09:19 2007

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