summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-09-12 22:51:39 -0400
committerMike Frysinger <vapier@gentoo.org>2015-09-12 22:52:22 -0400
commitdc985c3cb2c8094313f60553c2a488f9bd39002d (patch)
treefc2d6b78cbfa7fae2077027ac2692463988bfb00 /net-p2p/ctorrent/files
parentnet-misc/openssh: revert improper 4411ff42539dc7917a8db314327c6fbe699a616f (diff)
downloadgentoo-dc985c3cb2c8094313f60553c2a488f9bd39002d.tar.gz
gentoo-dc985c3cb2c8094313f60553c2a488f9bd39002d.tar.bz2
gentoo-dc985c3cb2c8094313f60553c2a488f9bd39002d.zip
net-p2p/ctorrent: workaround broken rTorrent files
Diffstat (limited to 'net-p2p/ctorrent/files')
-rw-r--r--net-p2p/ctorrent/files/ctorrent-3.3.2-empty-path-components.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/net-p2p/ctorrent/files/ctorrent-3.3.2-empty-path-components.patch b/net-p2p/ctorrent/files/ctorrent-3.3.2-empty-path-components.patch
new file mode 100644
index 000000000000..fce41d4feff5
--- /dev/null
+++ b/net-p2p/ctorrent/files/ctorrent-3.3.2-empty-path-components.patch
@@ -0,0 +1,38 @@
+rTorrent sometimes creates invalid torrents which has empty path components.
+the bitorrent spec allows for "" strings, but they make no sense in paths.
+so instead of always adding a / in between, skip them. ugh.
+
+for example:
+dict {
+ 'info' => dict {
+ 'name' => str = "some dir" (len = 8)
+ 'files' => list [
+ dict {
+ 'length' => int = 12345567
+ 'path' => list [
+ str = "" (len = 0)
+ str = "foo.bin" (len = 7)
+ ]
+ }
+ ...
+ ]
+ ...
+ }
+ ...
+}
+
+ctorrent will then try to fetch the file "/some dir/foo.bin" instead of
+"some dir/foo.bin" (relative to $PWD).
+
+--- a/bencode.cpp
++++ b/bencode.cpp
+@@ -258,7 +258,8 @@
+ n -= r;
+ if( 'e' == *pb ) break;
+ if( pathname >= endmax ) return 0;
+- *pathname++ = PATH_SP;
++ if (q)
++ *pathname++ = PATH_SP;
+ }
+ *pathname = '\0';
+ return (pb - b + 1);