{"thread":{"id":"30234","subject":"[BUG] svn-fe: incorrect handling of files with newlines in them","startedAt":"2012-04-13T22:13:22Z","lastAt":"2012-04-13T22:22:01Z","messageCount":2,"participants":["Andrew Sayers","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"189221","messageId":"4F88A502.9080207@pileofstuff.org","threadId":"30234","inReplyTo":null,"subject":"[BUG] svn-fe: incorrect handling of files with newlines in them","fromName":"Andrew Sayers","fromEmail":"andrew-git@pileofstuff.org","sentAt":"2012-04-13T22:13:22Z","receivedAt":"2012-04-13T22:13:22Z","isPatch":false,"sender":{"key":"andrew-git@pileofstuff.org","avatar":null},"body":"This issue arguably isn't that important - I'm raising it to see whether\npeople think it's an edge case worth bothering with.\n\nBefore version 1.2.0, SVN allowed you to create files and directories\nwith newlines in them.  So far as I can tell, directories with newlines\nare still technically allowed to this day, it's just that the interface\ndoesn't let you create new ones.  svn-fe silently ignores anything after\nthe newline (at least in the test I ran).\n\nYou will need to install SVN 1.1.4 or below to fully replicate the\nissue.  Full instructions at the end, but I've attached a dump file in\ncase you have better things to do with your time.  To replicate the\nsvn-fe part of the issue:\n\n\n# Directory containing your git.git:\nGIT_GIT=\"$HOME/git/git\"\n\nmkdir newline-in-file.git\ncd newline-in-file.git\n$GIT_GIT/git init\n\n# (now save the dump to this directory)\n\nmkfifo backchannel\n$GIT_GIT/contrib/svn-fe/svn-fe < newline-in-file.dump 3<backchannel | \\\n    $GIT_GIT/git fast-import --cat-blob-fd=3 3>backchannel\n$GIT_GIT/git log -p\n\n\nExpected: `git log -p` tells you about \"readme.txt\nNode-kind: dir\" (with a newline in the filename)\n\nObserved: `git log -p` tells you about \"readme.txt\" (with no newline in\nthe filename)\n\nNote that I've used the intentionally provocative filename\n$'readme.txt\\nNode-kind: dir', but svn-fe doesn't fall for the trick.\nThe dump format doesn't escape the filename at all, so it would probably\nfall for something cleverer like a 'copyfrom' line.  To be honest I'm\nnot sure how you'd even detect such a filename.\n\nIf the consensus is that this bug isn't fixable, I'd recommend putting a\nnote to that effect in \"contrib/svn-fe/svn-fe.txt\".\n\n\n\nSteps to create the SVN dump (assuming a bash shell):\n\nDOWNLOADS_DIRECTORY=\"$HOME/some_directory\"\nmkdir \"$DOWNLOADS_DIRECTORY\"\ncd \"$DOWNLOADS_DIRECTORY\"\nwget http://archive.apache.org/dist/subversion/subversion-1.1.4.tar.gz\ntar zxf subversion-1.1.4.tar.gz\ncd subversion-1.1.4/\n./configure\nmake\ncd \"$DOWNLOADS_DIRECTORY\"\nSVN_DIR=\"$DOWNLOADS_DIRECTORY/subversion-1.1.4/subversion\"\n\"$SVN_DIR/svnadmin/svnadmin\" create repo\n\"$SVN_DIR/clients/cmdline/svn\" co \"file://$PWD/repo/\" checkout\ncd checkout/\ntouch $'readme.txt\\nNode-kind: dir'\n\"$SVN_DIR/clients/cmdline/svn\" add *\n\"$SVN_DIR/clients/cmdline/svn\" ci -m \"File with newline in its name\"\ncd -\n\"$SVN_DIR/svnadmin/svnadmin\" dump repo > newline-in-file.dump\n\n\n\t- Andrew\n\n\nSVN-fs-dump-format-version: 2\n\nUUID: 00a1cdd4-95bd-0410-8002-ed56cec4f7c2\n\nRevision-number: 0\nProp-content-length: 56\nContent-length: 56\n\nK 8\nsvn:date\nV 27\n2012-04-13T21:05:24.866169Z\nPROPS-END\n\nRevision-number: 1\nProp-content-length: 130\nContent-length: 130\n\nK 7\nsvn:log\nV 29\nFile with newline in its name\nK 10\nsvn:author\nV 6\nandrew\nK 8\nsvn:date\nV 27\n2012-04-13T21:05:26.548735Z\nPROPS-END\n\nNode-path: readme.txt\nNode-kind: dir\nNode-kind: file\nNode-action: add\nProp-content-length: 10\nText-content-length: 0\nText-content-md5: d41d8cd98f00b204e9800998ecf8427e\nText-content-sha1: da39a3ee5e6b4b0d3255bfef95601890afd80709\nContent-length: 10\n\nPROPS-END\n\n\n"},{"id":"189222","messageId":"20120413222201.GA20197@burratino","threadId":"30234","inReplyTo":"4F88A502.9080207@pileofstuff.org","subject":"Re: [BUG] svn-fe: incorrect handling of files with newlines in them","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-04-13T22:22:01Z","receivedAt":"2012-04-13T22:22:01Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(+cc: Ram)\nHey,\n\nAndrew Sayers wrote:\n\n> Note that I've used the intentionally provocative filename\n> $'readme.txt\\nNode-kind: dir', but svn-fe doesn't fall for the trick.\n> The dump format doesn't escape the filename at all, so it would probably\n> fall for something cleverer like a 'copyfrom' line.  To be honest I'm\n> not sure how you'd even detect such a filename.\n\nYep, sounds like a dump-load-format design bug.\n\n> If the consensus is that this bug isn't fixable, I'd recommend putting a\n> note to that effect in \"contrib/svn-fe/svn-fe.txt\".\n\nMakes sense.  Please make it so.\n\nThanks much,\nJonathan\n"}]}