monotone

monotone Commit Details

Date:2012-04-28 16:55:36 (7 years 1 month ago)
Author:Francis Russell
Branch:org.debian.monotone
Commit:9794e4ce37b213e56537447010e9e15f04da8539
Parents: cbec1fc23a5070e7dc18d7204badf30b7533db4a
Message:Backport upstream fix for non-escaped URLs being passed to monotone in

its test suite.
Changes:
Apatches/03-url_escaping.diff (full)
Mchangelog (1 diff)
Mpatches/series (1 diff)

File differences

changelog
88
99
1010
11
12
1113
12
14
1315
1416
1517
* patches/02-file_handle.diff: Backport upstream fix for name clash
between monotone's "file_handle" struct and the one defined in
"fcntl.h" from (e)glibc >=2.14.
* patches/03-url_escaping.diff: Backport upstream fix for non-escaped URLs
being passed to monotone in its test suite.
-- Francis Russell <francis@unchartedbackwaters.co.uk> Tue, 27 Mar 2012 12:36:29 +0100
-- Francis Russell <francis@unchartedbackwaters.co.uk> Sat, 28 Apr 2012 15:48:34 +0100
monotone (1.0-4) unstable; urgency=low
patches/03-url_escaping.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
Description: Escape characters in URLs used by test suite.
Bug-Debian: http://bugs.debian.org/668457
Origin: upstream, commit: a0ed177b60caee5cf304c01d83e75812af1225e1
Index: monotone-1.0/test/func/attr_mtn_execute/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/attr_mtn_execute/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/attr_mtn_execute/__driver__.lua2012-04-28 15:43:21.839400322 +0100
@@ -30,7 +30,7 @@
-- test clone with mtn:execute
copy("test.db", "test-clone.db")
-testURI="file://" .. test.root .. "/test-clone.db?testbranch"
+test_uri="file://" .. url_encode_path(test.root .. "/test-clone.db") .. "?testbranch"
-check(nodb_mtn("clone", testURI, "clone"), 0, false, true)
+check(nodb_mtn("clone", test_uri, "clone"), 0, false, true)
check(indir("clone", {"test", "-x","foo"}, 0, false, false))
Index: monotone-1.0/test/func/branch_leaves_sync_bug/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/branch_leaves_sync_bug/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/branch_leaves_sync_bug/__driver__.lua2012-04-28 15:43:21.839400322 +0100
@@ -46,7 +46,9 @@
-- Create Beth's workspace via checkout, so 'update' works
chdir(test.root)
-check(abe_mtn("sync", "file://" .. test.root .. "/beth.db?*"), 0, false, false)
+
+test_uri="file://" .. url_encode_path(test.root .. "/beth.db") .. "?*"
+check(abe_mtn("sync", test_uri), 0, false, false)
check(beth_mtn("checkout", "--branch", "testbranch", "Beth"), 0, false, false)
chdir("Beth")
check(beth_mtn("genkey", "beth@test.net"), 0, false, false, string.rep("beth@test.net\n", 2))
@@ -64,7 +66,7 @@
rev_b = base_revision()
-- Sync dbs
-check(abe_mtn("sync", "file://" .. test.root .. "/beth.db?*"), 0, false, false)
+check(abe_mtn("sync", test_uri), 0, false, false)
-- Abe merges
chdir("Abe")
@@ -80,7 +82,8 @@
rev_d = base_revision()
-- Sync dbs (not clear if direction of sync matters)
-check(beth_mtn("sync", "file://" .. test.root .. "/abe.db?*"), 0, false, false)
+test_uri="file://" .. url_encode_path(test.root .. "/abe.db") .. "?*"
+check(beth_mtn("sync", test_uri), 0, false, false)
-- bug; rev_d and rev_c are both heads according to branch_leaves table.
check(beth_mtn("db", "check"), 0, false, false)
Index: monotone-1.0/test/func/clone_aborts_on_branch_pattern_in_uri/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/clone_aborts_on_branch_pattern_in_uri/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/clone_aborts_on_branch_pattern_in_uri/__driver__.lua2012-04-28 15:43:21.839400322 +0100
@@ -6,9 +6,9 @@
commit("mybranch")
copy("test.db", "test-clone.db")
-testURI="file://" .. test.root .. "/test-clone.db?mybranch*"
-check(nodb_mtn("clone", testURI), 1, false, true)
+test_uri="file://" .. url_encode_path(test.root .. "/test-clone.db") .. "?mybranch*"
+check(nodb_mtn("clone", test_uri), 1, false, true)
check(qgrep("you must specify an unambiguous branch to clone", "stderr"))
-- the branch option is invalid in non-URI mode
@@ -16,7 +16,7 @@
check(qgrep("the '--branch' option is only valid with an URI to clone", "stderr"))
-- finally, this should succeed
-check(nodb_mtn("clone", testURI, "--branch=mybranch"), 0, false, false)
+check(nodb_mtn("clone", test_uri, "--branch=mybranch"), 0, false, false)
check(exists("mybranch"))
check(readfile("foo") == readfile("mybranch/foo"))
Index: monotone-1.0/test/func/clone_branch_no_dir/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/clone_branch_no_dir/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/clone_branch_no_dir/__driver__.lua2012-04-28 15:43:21.839400322 +0100
@@ -6,18 +6,18 @@
commit("mybranch")
copy("test.db", "test-clone.db")
-testURI="file://" .. test.root .. "/test-clone.db?mybranch"
-check(nodb_mtn("clone", testURI), 0, false, false)
+test_uri="file://" .. url_encode_path(test.root .. "/test-clone.db") .. "?mybranch"
+check(nodb_mtn("clone", test_uri), 0, false, false)
check(exists("mybranch"))
check(readfile("foo") == readfile("mybranch/foo"))
-- but now that that directory exists, this clone should fail
-check(nodb_mtn("clone", testURI), 1, false, false)
+check(nodb_mtn("clone", test_uri), 1, false, false)
-- but succeed if given a specific dir
-check(nodb_mtn("clone", testURI, "otherdir"), 0, false, false)
+check(nodb_mtn("clone", test_uri, "otherdir"), 0, false, false)
-- clone into . should not fail, like checkout
mkdir("test4")
-check(indir("test4", nodb_mtn("clone", testURI, ".")), 0, false, false)
+check(indir("test4", nodb_mtn("clone", test_uri, ".")), 0, false, false)
Index: monotone-1.0/test/func/clone_creates__MTN_log/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/clone_creates__MTN_log/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/clone_creates__MTN_log/__driver__.lua2012-04-28 15:43:21.840400284 +0100
@@ -13,9 +13,9 @@
check(mtn("--branch=testbranch", "--rcfile=commit_log.lua", "commit"), 0, false, false)
copy("test.db", "test-clone.db")
-testURI="file://" .. test.root .. "/test-clone.db?testbranch"
-check(nodb_mtn("clone", testURI, "testbranch"), 0, false, true)
+test_uri="file://" .. url_encode_path(test.root .. "/test-clone.db") .. "?testbranch"
+check(nodb_mtn("clone", test_uri, "testbranch"), 0, false, true)
check(exists("testbranch/_MTN/log"))
check(fsize("_MTN/log") == 0)
Index: monotone-1.0/test/func/clone_creates_right__MTN_options/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/clone_creates_right__MTN_options/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/clone_creates_right__MTN_options/__driver__.lua2012-04-28 15:43:21.840400284 +0100
@@ -10,7 +10,7 @@
writefile("testfile", "blah")
commit()
-testURI="file://" .. test.root .. "/test-clone.db?testbranch"
+test_uri="file://" .. url_encode_path(test.root .. "/test-clone.db") .. "?testbranch"
-- We use RAW_MTN because it used to be that passing --db= (as
-- MTN does) would hide a bug in this functionality...
@@ -18,16 +18,17 @@
-- all of these inherit options settings from the current _MTN dir
-- unless they override them on the command line
-check(nodb_mtn("clone", testURI, "test_dir1"), 0, false, false)
-check(nodb_mtn("clone", "--revision", rev, testURI, "test_dir2"), 0, false, false)
-check(nodb_mtn("--db=" .. test.root .. "/test-new.db", "clone", testURI, "test_dir3"), 0, false, false)
-check(nodb_mtn("--db=" .. test.root .. "/test-new.db", "clone", testURI, "--revision", rev, "test_dir4"), 0, false, false)
+check(nodb_mtn("clone", test_uri, "test_dir1"), 0, false, false)
+check(nodb_mtn("clone", "--revision", rev, test_uri, "test_dir2"), 0, false, false)
+check(nodb_mtn("--db=" .. test.root .. "/test-new.db", "clone", test_uri, "test_dir3"), 0, false, false)
+check(nodb_mtn("--db=" .. test.root .. "/test-new.db", "clone", test_uri, "--revision", rev, "test_dir4"), 0, false, false)
-- checkout fails if the specified revision is not a member of the specified branch
-testURI="file://" .. test.root .. "/test-clone.db?foobar"
-check(nodb_mtn("clone", testURI, "--revision", rev, "test_dir5"), 1, false, false)
+test_uri="file://" .. url_encode_path(test.root .. "/test-clone.db") .. "?foobar"
+
+check(nodb_mtn("clone", test_uri, "--revision", rev, "test_dir5"), 1, false, false)
check(nodb_mtn("cert", rev, "branch", "foobar", "-d", "test-clone.db"), 0, false, false)
-check(nodb_mtn("clone", testURI, "--revision", rev, "test_dir6"), 0, false, false)
+check(nodb_mtn("clone", test_uri, "--revision", rev, "test_dir6"), 0, false, false)
for i = 1,2 do
Index: monotone-1.0/test/func/clone_validates_target_directory/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/clone_validates_target_directory/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/clone_validates_target_directory/__driver__.lua2012-04-28 15:43:21.840400284 +0100
@@ -6,15 +6,15 @@
commit()
copy("test.db", "test-clone.db")
-testURI="file://" .. test.root .. "/test-clone.db?testbranch"
-check(nodb_mtn("clone", testURI, "test_dir1"), 0, false, false)
+test_uri="file://" .. url_encode_path(test.root .. "/test-clone.db") .. "?testbranch"
+check(nodb_mtn("clone", test_uri, "test_dir1"), 0, false, false)
writefile("test_dir2")
-check(nodb_mtn("clone", testURI, "test_dir2"), 1, false, false)
+check(nodb_mtn("clone", test_uri, "test_dir2"), 1, false, false)
mkdir("test_dir3")
-check(nodb_mtn("clone", testURI, "test_dir3"), 1, false, false)
+check(nodb_mtn("clone", test_uri, "test_dir3"), 1, false, false)
if existsonpath("chmod") and existsonpath("test") then
-- skip this part if run as root (hi Gentoo!)
@@ -27,9 +27,9 @@
else
mkdir("test_dir4")
check({"chmod", "444", "test_dir4"}, 0, false)
- check(nodb_mtn("clone", testURI, "test_dir4"),
+ check(nodb_mtn("clone", test_uri, "test_dir4"),
1, false, false)
- check(nodb_mtn("clone", testURI, "test_dir4/subdir"),
+ check(nodb_mtn("clone", test_uri, "test_dir4/subdir"),
1, false, false)
-- Reset the permissions so Autotest can correctly clean up our
-- temporary directory.
Index: monotone-1.0/test/func/clone_warning_with_multiple_heads/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/clone_warning_with_multiple_heads/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/clone_warning_with_multiple_heads/__driver__.lua2012-04-28 15:43:21.840400284 +0100
@@ -16,9 +16,9 @@
REV3=base_revision()
copy("test.db", "test-clone.db")
-testURI="file://" .. test.root .. "/test-clone.db?testbranch"
-check(nodb_mtn("clone", testURI, "test_dirA"),
+test_uri="file://" .. url_encode_path(test.root .. "/test-clone.db") .. "?testbranch"
+check(nodb_mtn("clone", test_uri, "test_dirA"),
1, false, true)
check(qgrep(REV2, "stderr"))
check(qgrep(REV3, "stderr"))
Index: monotone-1.0/test/func/clone_weird_branch_names/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/clone_weird_branch_names/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/clone_weird_branch_names/__driver__.lua2012-04-28 15:43:21.840400284 +0100
@@ -6,10 +6,11 @@
commit("my-branch[1,2]-1^3")
copy("test.db", "test-clone.db")
--- some of the special chars need to get double-escaped to get "through"
-testURI="file://" .. test.root .. "/test-clone.db?my-branch\\\[1,2\\\]-1^3"
-check(nodb_mtn("clone", testURI), 0, false, false)
+-- some of the special chars need to get double-escaped to get "through"
+test_uri="file://" .. url_encode_path(test.root .. "/test-clone.db") ..
+ "?" .. url_encode_query("my-branch\\\[1,2\\\]-1^3")
+check(nodb_mtn("clone", test_uri), 0, false, false)
check(exists("my-branch[1,2]-1^3"))
check(readfile("foo") == readfile("my-branch[1,2]-1^3/foo"))
Index: monotone-1.0/test/func/imp_test_filesync_confdir/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/imp_test_filesync_confdir/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/imp_test_filesync_confdir/__driver__.lua2012-04-28 15:43:21.840400284 +0100
@@ -18,7 +18,8 @@
rcfile:close()
end
-check(mtn("sync", "file://" .. test.root .. "/test2.db?testbranch"), 0, true, false)
+test_uri="file://" .. url_encode_path(test.root .. "/test2.db") .. "?testbranch"
+check(mtn("sync", test_uri), 0, true, false)
n = 0
Index: monotone-1.0/test/func/netsync_over_pipes/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/netsync_over_pipes/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/netsync_over_pipes/__driver__.lua2012-04-28 15:43:21.840400284 +0100
@@ -7,6 +7,7 @@
addfile("testfile", "foo")
commit()
-check(mtn("sync", "file://" .. test.root .. "/test2.db?testbranch"), 0, false, true)
+test_uri="file://" .. url_encode_path(test.root .. "/test2.db") .. "?testbranch"
+check(mtn("sync", test_uri), 0, false, true)
check(not qgrep("error", "stderr"))
check_same_db_contents("test.db", "test2.db")
Index: monotone-1.0/test/func/serve-automate-single-run/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/serve-automate-single-run/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/serve-automate-single-run/__driver__.lua2012-04-28 15:43:21.840400284 +0100
@@ -60,8 +60,9 @@
-- 'file:' not supported on Windows
copy("allow-automate.lua", "custom_test_hooks.lua")
+test_uri="file://" .. url_encode_path(test.root .. "/test.db")
check(mtn2("automate", "remote", "--remote-stdio-host",
- "file://"..test.root.."/test.db",
+ test_uri,
"get_file_of", "--", "-r".. R1, "foo"), 0, true, false)
check(qgrep("bar", "stdout"))
end
Index: monotone-1.0/test/func/serve-automate/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/serve-automate/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/serve-automate/__driver__.lua2012-04-28 15:43:21.840400284 +0100
@@ -56,7 +56,8 @@
if ostype ~= "Windows" then
-- 'file:' not supported on Windows
-check(mtn2("automate", "remote_stdio", "file://" .. test.root .. "/test.db"),
+test_uri="file://" .. url_encode_path(test.root .. "/test.db")
+check(mtn2("automate", "remote_stdio", test_uri),
0, true, false, "l17:interface_versione")
check(parse_stdio(readfile("stdout"), 0, 0, "m") ~= nil)
end
Index: monotone-1.0/test/func/util_mtnopt/__driver__.lua
===================================================================
--- monotone-1.0.orig/test/func/util_mtnopt/__driver__.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/func/util_mtnopt/__driver__.lua2012-04-28 15:43:21.840400284 +0100
@@ -6,6 +6,11 @@
normalized_testroot = normalize_path (test.root)
+-- Escape regexp special characters to form a proper regexp that correctly
+-- checks for the given path.
+escaped_testroot = string.gsub(normalized_testroot, "([*+.()[\\^$|?])",
+ function (x) return "\\" .. x end)
+
-- check default operation
-- MinGW does not process the shebang in mtnopt; must invoke sh directly
@@ -13,7 +18,7 @@
-- Don't pass the full /bin/sh path, it looks like that doesn't always
-- work under mingw.
check({"sh", "./mtnopt"}, 0, true)
-check(qgrep('^MTN_database="' .. normalized_testroot .. '/test.db";$', "stdout"))
+check(qgrep('^MTN_database="' .. escaped_testroot .. '/test.db";$', "stdout"))
check(qgrep('^MTN_branch="testbranch";$', "stdout"))
-- check operation with a specific key and just returning the value
Index: monotone-1.0/test/src/testlib.lua
===================================================================
--- monotone-1.0.orig/test/src/testlib.lua2012-04-28 15:41:51.595817578 +0100
+++ monotone-1.0/test/src/testlib.lua2012-04-28 15:43:21.841400246 +0100
@@ -144,6 +144,22 @@
return n
end
+-- encodes a query by percent escaping reserved characters (as defined
+-- in RFC 3986) - except for the directory separator ('/').
+function url_encode_path(path)
+ path = string.gsub(path, "([!*'();:@&=+$,?#[%]])",
+ function (x) return string.format("%%%02X", string.byte(x)) end)
+ return string.gsub(path, " ", "+")
+end
+
+-- encodes a query by percent escaping reserved characters (as defined
+-- in RFC 3986) - except for the ampersand and equal sign ('&', '=')
+function url_encode_query(path)
+ path = string.gsub(path, "([!*'();:@+$,/?#[%]])",
+ function (x) return string.format("%%%02X", string.byte(x)) end)
+ return string.gsub(path, " ", "+")
+end
+
function open_or_err(filename, mode, depth)
local file, e = io.open(filename, mode)
if file == nil then
patches/series
11
22
33
4
45
56
00-db-extension-bash-completion.diff
01-format-security.diff
02-file_handle.diff
03-url_escaping.diff
10-mtn-ignore-syntax-error-test.diff
90-stacktrace-on-crash.diff

Archive Download the corresponding diff file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status