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

Re: svn:executable can corrupt binaries (revert fixes it)

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-10-06 23:08:12 CEST

Craig Peterein <craig@peterein.org> writes:

> This is using svn built from 3312. All tests pass over ra_local.
>
> Changing svn:executable in one wc and updating in another wc results in a
> locally modified (and corrupted) binary. The text base is ok, so a revert
> works fine.
>
> Craig
>
> #!/bin/bash
> export REPO=file://`pwd`/repo
> svnadmin create repo
> svn mkdir $REPO/trunk -m ""
> svn co $REPO/trunk wc
> cp /bin/bash wc
> # 'svn add' will automatically set svn:executable, but the result below doesn't
> # matter if you do a 'chmod -x wc/bash' first
> svn add wc/bash
> svn ci wc -m "commit in wc"
> svn co $REPO/trunk wc2
> svn ps svn:executable "anything, really" wc2/bash
> svn ci wc2 -m "change svn:executable"
> svn up wc2
> md5sum wc*/bash /bin/bash
> # all the same
> svn up wc
> md5sum wc*/bash /bin/bash
> # wc/bash is corrupt
> svn st wc
> # wc/bash is locally modified
> svn revert wc/bash
> md5sum wc*/bash /bin/bash
> # all ok now

Yes, it's a bug, here's a marginally simpler test case

export REPO=file:///`pwd`/repo
svnadmin create repo
svn co $REPO wc1
printf \\r > wc1/foo
svn add wc1/foo
svn ps svn:mime-type application/binary wc1/foo
svn ci -m "" wc1
svn up wc1
svn co $REPO wc2
svn ps svn:executable bar wc2/foo
svn ci -m "" wc2
svn up wc1

Now look at

$ od -c wc1/foo
0000000 \n
0000001

$ svn revert wc1/foo
$ od -c wc1/foo
0000000 \r
0000001

The working copy is getting corrupted, the text-base appears to be OK.

I think the bug is in libsvn_wc/update_editor.c:svn_wc_install_file
around line 1454. The DETRANSLATE/TRANSLATE cycle looks suspicious, I
don't think it should happen if the file is binary. I haven't thought
about the edge cases changing binary-to-non-binary, and vice versa, to
determine exactly when it should happen.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Oct 6 23:08:50 2002

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.