All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] svn-fe: incorrect handling of files with newlines in them
@ 2012-04-13 22:13 Andrew Sayers
  2012-04-13 22:22 ` Jonathan Nieder
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Sayers @ 2012-04-13 22:13 UTC (permalink / raw)
  To: Git Mailing List, David Barr

[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]

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

[-- Attachment #2: newline-in-file.dump --]
[-- Type: text/plain, Size: 651 bytes --]

SVN-fs-dump-format-version: 2

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

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

K 8
svn:date
V 27
2012-04-13T21:05:24.866169Z
PROPS-END

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

K 7
svn:log
V 29
File with newline in its name
K 10
svn:author
V 6
andrew
K 8
svn:date
V 27
2012-04-13T21:05:26.548735Z
PROPS-END

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

PROPS-END



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] svn-fe: incorrect handling of files with newlines in them
  2012-04-13 22:13 [BUG] svn-fe: incorrect handling of files with newlines in them Andrew Sayers
@ 2012-04-13 22:22 ` Jonathan Nieder
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Nieder @ 2012-04-13 22:22 UTC (permalink / raw)
  To: Andrew Sayers; +Cc: Git Mailing List, David Barr, Ramkumar Ramachandra

(+cc: Ram)
Hey,

Andrew Sayers wrote:

> 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.

Yep, sounds like a dump-load-format design bug.

> 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".

Makes sense.  Please make it so.

Thanks much,
Jonathan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-13 22:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 22:13 [BUG] svn-fe: incorrect handling of files with newlines in them Andrew Sayers
2012-04-13 22:22 ` Jonathan Nieder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.