There are possibly two bugs here, one of them supremely weird.  The attached 
script shows the recipe, with commentary.

(This is all with svn version 1.10.2 (r1835932) as packaged in Debian GNU/Linux 
for x86_64-pc-linux-gnu.)

The rest of this mail will assume you've run, or at least examined, the 
reproduction script.

I looked in the bug tracker and https://issues.apache.org/jira/browse/SVN-2622 
shows another way to reach the first (and less serious) of the two bugs 
demonstrated in the attached script.  No other tickets seem to be related.

I'll tentatively propose the following new behavior:

When someone does

  $ svn propdel svn:special some_version_controlled_symlink

maybe Subversion should not only delete the property, but also replace the 
symlink with a regular file containing "link <destination_text>" (i.e., the 
file-content portion of the repository's representation of a symlink).  The 
user should be able to commit at this point and everything would Just Work.

If the person doesn't commit, and instead does

  $ svn propset svn:special '*' some_version_controlled_symlink

then it would go back to being a symlink as before (and would appear 
unmodified).

This implies that if one creates a regular file containing just the text "link 
<destination_text>", commits it, and then does

  $ svn propset svn:special '*' that_file

then the working file should transform into the appropriate symlink 
automagically, which could then be committed as a symlink (whether a broken 
link or not doesn't matter).

You may agree or disagree with the above-proposed new behavior -- I'm still a 
bit tentative about it myself!  But I think the current behavior, as 
demonstrated in the attached script, cannot be right.  I haven't filed an 
issue, though, because I wanted to discuss here first and make sure.

Please keep me CC'd, as I'm not on the mailing list.

Best regards,
-Karl

#!/bin/sh

if [ -e foo -o -e new-foo ]; then
  echo "ERROR: To run this recipe, you must be have neither" >&2
  echo "       'foo' nor 'new-foo' present in the working copy." >&2
  exit 1
fi

echo ""
echo "### Reproduction recipe setup -- you'll see a bunch of svn output:"
svn update  # get a single-rev working directory, just for cleanliness
echo "Hello, world." > foo
svn add foo
svn commit -m "Adding regular file foo, with classic content."
svn status -v foo 
ln -s foo new-foo
svn add new-foo 
svn status -q
svn commit -m "Add symbolic link 'new-foo'."
echo ""
echo "### Okay, done with setup."

echo ""
echo "### Now let's try to replace 'new-foo' with its non-special contents."
echo "### First we delete the 'svn:special' property."
echo ""
svn propdel svn:special new-foo 
echo ""
echo "### The 'new-foo' file now has an interesting status.  It shows '~'"
echo "### in the first column, to indicate obstructed-by-different-kind,"
echo "### and 'M' in the property-change column:"
echo ""
svn status new-foo 
echo ""
echo "### 'new-foo' is still a symlink, by the way:"
echo ""
ls -l new-foo
echo ""
echo "### Next, try to commit 'new-foo'.  It will fail because Subversion"
echo "### now thinks it's the wrong kind of file (I guess because the"
echo "### svn:special property is gone?):"
echo ""
svn commit -m "Try to commit 'new-foo', watch it fail."
echo ""
echo "### In fact, Subversion makes this decision even before log message"
echo "### handling happens.  Here we try to commit again, this time without"
echo "### passing any log message on the command line.  No editor pops up;"
echo "### instead, Subversion immediately shows the same error as before:"
echo ""
svn commit
echo ""
echo "### Okay, ready for the *real* weirdness?  Good.  Let's first do"
echo "### an 'svn status -q' just to see things are:"
echo ""
svn status -q
echo ""
echo "### Now try manually replacing 'new-foo' with its non-special"
echo "### content.  I tried this thinking it might achieve my goal"
echo "### of having a regular file containing the text 'link foo'."
echo "### In other words, I did 'svn cat new-foo > new-foo', and..."
svn cat new-foo > new-foo 
echo ""
echo "### ...now the original regular 'foo' has the non-special content!"
echo "### Yes, you read that right.  Here's an 'svn status -q' now:"
echo ""
svn status -q
echo ""
echo "### And here's 'cat foo' (with an extra echo to append a newline"
echo "### to the output so that this transcript is more readable):"
echo ""
cat foo; echo ""
echo ""
echo "### So now not only can I not commit 'new-foo', 'foo' is"
echo "### affected as well.  Here's the output of 'svn diff':"
echo ""
svn diff
echo ""
echo "### That's just messed up."
echo ""
echo "### You can run 'svn rm --force new-foo foo; svn commit' if you"
echo "### want to clean up the working copy to re-run this script."

Reply via email to