[BUG] svn-fe: incorrect handling of files with newlines in them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:

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):

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/
"$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
SVN-fs-dump-format-version: 2

UUID: 00a1cdd4-95bd-0410-8002-ed56cec4f7c2

Revision-number: 0
Prop-content-length: 56
Content-length: 56

K 8
V 27

Revision-number: 1
Prop-content-length: 130
Content-length: 130

K 7
V 29
File with newline in its name
K 10
V 6
K 8
V 27

Node-path: readme.txt
Node-kind: dir
Node-kind: file
Node-action: add
Prop-content-length: 10
Text-content-length: 0
Text-content-md5: d41d8cd98f00b204e9800998ecf8427e
Text-content-sha1: da39a3ee5e6b4b0d3255bfef95601890afd80709
Content-length: 10


[Newbies FAQ]     [Linux Kernel Development]     [Free Online Dating]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Free Online Dating]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]     [Linux Resources]

Add to Google