[BUG] svn-fe: incorrect handling of files with newlines in them
From: Andrew Sayers <hidden>
Date: 2016-06-15 22:53:35
This issue arguably isn't that important - I'm raising it to see whether
people think it's an edge case worth bothering with.
Before version 1.2.0, SVN allowed you to create files and directories
with newlines in them. So far as I can tell, directories with newlines
are still technically allowed to this day, it's just that the interface
doesn't let you create new ones. svn-fe silently ignores anything after
the newline (at least in the test I ran).
You will need to install SVN 1.1.4 or below to fully replicate the
issue. Full instructions at the end, but I've attached a dump file in
case you have better things to do with your time. To replicate the
svn-fe part of the issue:
# Directory containing your git.git:
GIT_GIT="$HOME/git/git"
mkdir newline-in-file.git
cd newline-in-file.git
$GIT_GIT/git init
# (now save the dump to this directory)
mkfifo backchannel
$GIT_GIT/contrib/svn-fe/svn-fe < newline-in-file.dump 3<backchannel | \
$GIT_GIT/git fast-import --cat-blob-fd=3 3>backchannel
$GIT_GIT/git log -p
Expected: `git log -p` tells you about "readme.txt
Node-kind: dir" (with a newline in the filename)
Observed: `git log -p` tells you about "readme.txt" (with no newline in
the filename)
Note that I've used the intentionally provocative filename
$'readme.txt\nNode-kind: dir', but svn-fe doesn't fall for the trick.
The dump format doesn't escape the filename at all, so it would probably
fall for something cleverer like a 'copyfrom' line. To be honest I'm
not sure how you'd even detect such a filename.
If the consensus is that this bug isn't fixable, I'd recommend putting a
note to that effect in "contrib/svn-fe/svn-fe.txt".
Steps to create the SVN dump (assuming a bash shell):
DOWNLOADS_DIRECTORY="$HOME/some_directory"
mkdir "$DOWNLOADS_DIRECTORY"
cd "$DOWNLOADS_DIRECTORY"
wget http://archive.apache.org/dist/subversion/subversion-1.1.4.tar.gz
tar zxf subversion-1.1.4.tar.gz
cd subversion-1.1.4/
./configure
make
cd "$DOWNLOADS_DIRECTORY"
SVN_DIR="$DOWNLOADS_DIRECTORY/subversion-1.1.4/subversion"
"$SVN_DIR/svnadmin/svnadmin" create repo
"$SVN_DIR/clients/cmdline/svn" co "file://$PWD/repo/" checkout
cd checkout/
touch $'readme.txt\nNode-kind: dir'
"$SVN_DIR/clients/cmdline/svn" add *
"$SVN_DIR/clients/cmdline/svn" ci -m "File with newline in its name"
cd -
"$SVN_DIR/svnadmin/svnadmin" dump repo > newline-in-file.dump
- Andrew