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

svn cross-repo copy loses svn:executable *and* leaves the working dir inconsistent

From: Mark Eichin <eichin_at_gmail.com>
Date: Tue, 16 Aug 2011 17:54:57 -0400

Ran across this while writing a "populate new repo" script, that used
svn cp to copy a set of svn-hooks in place (by definition from one
repo to another.) What happens is that when a file in the source repo
(called "foreign" here) has svn:executable set, the working dir in the
destination (called "local" here) looks right - ls -l shows the +x
bits, svn proplist -v shows the property, even .svn/props-base
mentions it. The commit, on the other hand, doesn't push it to the
repository. This means that the local checkout is now a "persistent
lie" (in that trying to set it there and commit it does nothing,
because it's "already" set.) A fresh checkout of the result shows the
bits missing, though.

I'm doing copy from url to working dir because in practice, I need to
do some variable substitution before pushing the file to the new repo;
that substitution isn't in the script because without it, the bug
still happens.

I've only tested this on "svn, version 1.6.12 (r955767) - compiled Jun
 5 2011, 14:55:20" which is 1.6.12dfsg-1ubuntu1.3 from Ubuntu 10.10
(maverick.) Also, while the test is between two locally built repos
with file:// urls, I originally saw the problem going between https://
and svn+ssh:// which distracted me :-) So I'd appreciate if people
who can conveniently do so would test this on newer versions. Thanks.

#!/bin/sh -e

################################################
LOCAL_REPO_DIR=/tmp/svn-propcopy-repo-local
FOREIGN_REPO_DIR=/tmp/svn-propcopy-repo-foreign
PREP_FOREIGN_WORKDIR=/tmp/svn-propcopy-work-prep
PERFORM_COPY_WORKDIR=/tmp/svn-propcopy-work-copy
SHOW_FAILURE_WORKDIR=/tmp/svn-propcopy-work-show
rm -rf $LOCAL_REPO_DIR
rm -rf $FOREIGN_REPO_DIR
rm -rf $PREP_FOREIGN_WORKDIR; mkdir -p $PREP_FOREIGN_WORKDIR
rm -rf $PERFORM_COPY_WORKDIR; mkdir -p $PERFORM_COPY_WORKDIR
rm -rf $SHOW_FAILURE_WORKDIR; mkdir -p $SHOW_FAILURE_WORKDIR
################################################
echo ==== create two repos: one local, ====
svnadmin create $LOCAL_REPO_DIR
LOCAL_REPO=file:////$LOCAL_REPO_DIR
svn mkdir -m 'trunk' $LOCAL_REPO/trunk
svn mkdir -m 'branch' $LOCAL_REPO/branch
echo ==== one '"foreign"' ====
svnadmin create $FOREIGN_REPO_DIR
FOREIGN_REPO=file:////$FOREIGN_REPO_DIR
svn mkdir -m 'trunk 2' $FOREIGN_REPO/trunk
svn mkdir -m 'branch 2' $FOREIGN_REPO/branch
################################################
echo ==== Create an executable file in the foreign repo. ====
svn co $FOREIGN_REPO/trunk $PREP_FOREIGN_WORKDIR/trunk
cat > $PREP_FOREIGN_WORKDIR/trunk/program <<EOF
#!/bin/sh
echo running 1
EOF
svn add $PREP_FOREIGN_WORKDIR/trunk/program
svn propset svn:executable '*' $PREP_FOREIGN_WORKDIR/trunk/program
svn commit -m 'committed a file' $PREP_FOREIGN_WORKDIR/trunk
################################################
echo ==== Copy the executable from the foreign repo to the local one. ====
svn co $LOCAL_REPO/branch $PERFORM_COPY_WORKDIR/branch
svn copy $FOREIGN_REPO/trunk/program $PERFORM_COPY_WORKDIR/branch/copied-program
ls -l $PERFORM_COPY_WORKDIR/branch
svn commit -m 'copied program' $PERFORM_COPY_WORKDIR/branch
svn proplist -vR $PERFORM_COPY_WORKDIR/branch
echo ==== Notice that copied-program still has +x set, and the
property set... ====
################################################
echo ==== Now check out the local tree and see that we''ve lost the props. ====
svn co $LOCAL_REPO/branch $SHOW_FAILURE_WORKDIR/branch
ls -l $SHOW_FAILURE_WORKDIR/branch
svn proplist -vR $SHOW_FAILURE_WORKDIR/branch
svn --version

-- 
_Mark_ <eichin_at_thok.org> <eichin_at_gmail.com>
Received on 2011-08-16 23:55:26 CEST

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.