Modified: subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/merge_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/merge_tests.py?rev=1645439&r1=1645438&r2=1645439&view=diff ============================================================================== --- subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/merge_tests.py (original) +++ subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/merge_tests.py Sun Dec 14 11:44:03 2014 @@ -17492,6 +17492,122 @@ def merge_with_externals_with_mergeinfo( [], 'merge', '--reintegrate', sbox.repo_url + '/A_COPY', A_path) +@SkipUnless(server_has_mergeinfo) +@Issue(4306) +# Test for issue #4306 'multiple editor drive file merges record wrong +# mergeinfo during conflicts' +def conflict_aborted_mergeinfo_described_partial_merge(sbox): + "conflicted split merge can be repeated" + + sbox.build() + + trunk = 'A' + branch = 'A2' + file = 'mu' + trunk_file = 'A/mu' + + # r2: initial state + file_text = 'line 1\n' + for i in range(2, 22): + file_text += 'line ' + str(i) + '.\n' + svntest.main.file_write(sbox.ospath('A/mu'), file_text) + sbox.simple_commit() + + # r3: branch + svntest.actions.run_and_verify_svn(None, None, [], 'up', sbox.wc_dir) + sbox.simple_copy(trunk, branch) + sbox.simple_commit() + + # r4 through r13: simple edits + for r in range (1, 11): + file_text = file_text.replace('line ' + str(r*2) + '.', 'line ' + + str(r*2) + ' Edited in r' + str(r+3) + '.') + svntest.main.file_write(sbox.ospath('A/mu'), file_text) + sbox.simple_commit() + + # r14: merge some changes to the branch so that later merges will be split + svntest.actions.run_and_verify_svn(None, None, [], 'merge', '-c5,9', + '^/' + trunk, sbox.ospath(branch), + '--accept', 'theirs-conflict') + sbox.simple_commit() + svntest.actions.run_and_verify_svn(None, None, [], 'up', sbox.wc_dir) + + def try_merge(target, conflict_rev, rev_ranges, mergeinfo, expect_error=True): + """Revert TARGET_PATH in the branch; merge TARGET_PATH in the trunk + to TARGET_PATH in the branch; expect to find MERGEINFO. + """ + src_url = '^/' + trunk + '/' + target + src_path = trunk + '/' + target + tgt_path = branch + '/' + target + svntest.actions.run_and_verify_svn(None, None, [], 'revert', '-R', + sbox.ospath(tgt_path)) + file_text = open(sbox.ospath(tgt_path), 'r').read() + r = conflict_rev - 3 + file_text = file_text.replace('line ' + str(r*2) + '.', 'line ' + + str(r*2) + ' Conflicted.') + svntest.main.file_write(sbox.ospath('A2/mu'), file_text) + + if expect_error: + expected_error = ('^svn: E155015: .* conflicts were produced .* into$' + "|^'.*" + sbox.ospath(tgt_path) + "' --$" + '|^resolve all conflicts .* remaining$' + '|^unmerged revisions$') + else: + expected_error = [] + svntest.actions.run_and_verify_svn(None, None, expected_error, + 'merge', + src_url, sbox.ospath(tgt_path), + '--accept', 'postpone', + *rev_ranges) + expected_out = ['/' + src_path + ':' + mergeinfo + '\n'] + svntest.actions.run_and_verify_svn( + "Incorrect mergeinfo set during conflict aborted merge", + expected_out, [], 'pg', SVN_PROP_MERGEINFO, sbox.ospath(tgt_path)) + + # In a mergeinfo-aware merge, each specified revision range is split + # internally into sub-ranges, to avoid any already-merged revisions. + # + # From white-box inspection, we see there are code paths that treat + # the last specified range and the last sub-range specially. The + # first specified range or sub-range is not treated specially in terms + # of the code paths, although it might be in terms of data flow. + # + # We test merges that raise a conflict in the first and last sub-range + # of the first and last specified range. + + # First test: Merge "everything" to the branch. + # + # This merge is split into three sub-ranges: r3-4, r6-8, r10-head. + # We have arranged that the merge will raise a conflict in the first + # sub-range. Since we are postponing conflict resolution, the merge + # should stop after the first sub-range, allowing us to resolve and + # repeat the merge at which point the next sub-range(s) can be merged. + # The mergeinfo on the target then should only reflect that the first + # sub-range (r3-4) has been merged. + # + # Previously the merge failed after merging only r3-4 (as it should) + # but mergeinfo for the whole range was recorded, preventing subsequent + # repeat merges from applying the rest of the source changes. + try_merge(file, 4, [], '3-5,9') + + # Try a multiple-range merge that raises a conflict in the + # first sub-range in the first specified range. + try_merge(file, 4, ['-r1:6', '-r7:10'], '3-5,9') + + # Try a multiple-range merge that raises a conflict in the + # last sub-range in the first specified range. + try_merge(file, 6, ['-r1:6', '-r7:10'], '3-6,9') + + # Try a multiple-range merge that raises a conflict in the + # first sub-range in the last specified range. + try_merge(file, 8, ['-r1:6', '-r7:10'], '3-6,8-9') + + # Try a multiple-range merge that raises a conflict in the + # last sub-range in the last specified range. + # (Expect no error, because 'svn merge' does not throw an error if + # there is no more merging to do when a conflict occurs.) + try_merge(file, 10, ['-r1:6', '-r7:10'], '3-6,8-10', expect_error=False) + ######################################################################## # Run the tests @@ -17624,6 +17740,7 @@ test_list = [ None, merge_adds_then_deletes_subtree, merge_with_added_subtrees_with_mergeinfo, merge_with_externals_with_mergeinfo, + conflict_aborted_mergeinfo_described_partial_merge, ] if __name__ == '__main__':
Modified: subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/revert_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/revert_tests.py?rev=1645439&r1=1645438&r2=1645439&view=diff ============================================================================== --- subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/revert_tests.py (original) +++ subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/revert_tests.py Sun Dec 14 11:44:03 2014 @@ -1585,6 +1585,52 @@ def revert_with_unversioned_targets(sbox actual_disk = svntest.tree.build_tree_from_wc(wc_dir, 1) svntest.tree.compare_trees("disk", actual_disk, expected_disk.old_tree()) +@Issue(4168) +def revert_obstructing_wc(sbox): + "revert with an obstructing working copy" + + sbox.build(create_wc=False, read_only=True) + wc_dir = sbox.wc_dir + + expected_output = svntest.wc.State(wc_dir, {}) + expected_disk = svntest.wc.State(wc_dir, {}) + + # Checkout wc as depth empty + svntest.actions.run_and_verify_checkout(sbox.repo_url, wc_dir, + expected_output, expected_disk, + None, None, None, None, + '--depth', 'empty') + + # And create an obstructing working copy as A + svntest.actions.run_and_verify_checkout(sbox.repo_url, wc_dir + '/A', + expected_output, expected_disk, + None, None, None, None, + '--depth', 'empty') + + # Now try to fetch the entire wc, which will find an obstruction + expected_output = svntest.wc.State(wc_dir, { + 'A' : Item(verb='Skipped'), + 'iota' : Item(status='A '), + }) + expected_status = svntest.wc.State(wc_dir, { + '' : Item(status=' ', wc_rev='1'), + 'iota' : Item(status=' ', wc_rev='1'), + # A is not versioned but exists + }) + + svntest.actions.run_and_verify_update(wc_dir, + expected_output, None, expected_status, + None, None, None, + None, None, None, + wc_dir, '--set-depth', 'infinity') + + # Revert should do nothing (no local changes), and report the obstruction + # (reporting the obstruction is nice for debuging, but not really required + # in this specific case, as the node was not modified) + svntest.actions.run_and_verify_svn(None, "Skipped '.*A' -- .*obstruct.*", [], + 'revert', '-R', wc_dir) + + ######################################################################## # Run the tests @@ -1623,6 +1669,7 @@ test_list = [ None, revert_no_text_change_conflict, revert_no_text_change_conflict_recursive, revert_with_unversioned_targets, + revert_obstructing_wc ] if __name__ == '__main__': Propchange: subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/svntest/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Dec 14 11:44:03 2014 @@ -1,6 +1,8 @@ /subversion/1.7.x-issue4059/subversion/tests/cmdline/svntest:1239661-1239744 /subversion/branches/1.5.x-r30215/subversion/tests/cmdline/svntest:870312 +/subversion/branches/1.7.x/subversion/tests/cmdline/svntest:1480943-1645438 /subversion/branches/1.7.x-JavaHL-pools/subversion/tests/cmdline/svntest:1158684-1158722 +/subversion/branches/1.7.x-gssapi-solaris10/subversion/tests/cmdline/svntest:1453164-1515067 /subversion/branches/1.7.x-issue3888/subversion/tests/cmdline/svntest:1148937-1149162 /subversion/branches/1.7.x-issue3975/subversion/tests/cmdline/svntest:1160761-1161546 /subversion/branches/1.7.x-issue3976/subversion/tests/cmdline/svntest:1161731-1165397 @@ -13,12 +15,21 @@ /subversion/branches/1.7.x-issue4102/subversion/tests/cmdline/svntest:1292401-1295402 /subversion/branches/1.7.x-issue4123/subversion/tests/cmdline/svntest:1293358-1293812 /subversion/branches/1.7.x-issue4144/subversion/tests/cmdline/svntest:1305854-1306143 +/subversion/branches/1.7.x-issue4153/subversion/tests/cmdline/svntest:1309894-1539233 /subversion/branches/1.7.x-issue4161/subversion/tests/cmdline/svntest:1330697-1331209 /subversion/branches/1.7.x-issue4166/subversion/tests/cmdline/svntest:1330474-1336071 /subversion/branches/1.7.x-issue4169/subversion/tests/cmdline/svntest:1330537-1336116 +/subversion/branches/1.7.x-issue4257/subversion/tests/cmdline/svntest:1454456-1461404 +/subversion/branches/1.7.x-issue4263/subversion/tests/cmdline/svntest:1423588-1434547 +/subversion/branches/1.7.x-issue4270/subversion/tests/cmdline/svntest:1433737-1485341 +/subversion/branches/1.7.x-issue4306/subversion/tests/cmdline/svntest:1438872-1514941 +/subversion/branches/1.7.x-issue4332/subversion/tests/cmdline/svntest:1453478-1460963 +/subversion/branches/1.7.x-issue4340/subversion/tests/cmdline/svntest:1461589-1485180 +/subversion/branches/1.7.x-issue4408/subversion/tests/cmdline/svntest:1512143-1514943 /subversion/branches/1.7.x-issue4k/subversion/tests/cmdline/svntest:1166502-1167193 /subversion/branches/1.7.x-log-diff/subversion/tests/cmdline/svntest:1295670-1295699 /subversion/branches/1.7.x-neon-default/subversion/tests/cmdline/svntest:1148803-1158680 +/subversion/branches/1.7.x-neon-properr/subversion/tests/cmdline/svntest:1440619-1461944 /subversion/branches/1.7.x-r1152189/subversion/tests/cmdline/svntest:1152759-1154249 /subversion/branches/1.7.x-r1155160/subversion/tests/cmdline/svntest:1158704-1159223 /subversion/branches/1.7.x-r1159093/subversion/tests/cmdline/svntest:1159097-1159230 @@ -34,6 +45,7 @@ /subversion/branches/1.7.x-r1306111/subversion/tests/cmdline/svntest:1306301-1331207 /subversion/branches/1.7.x-r1341012/subversion/tests/cmdline/svntest:1341013-1355629 /subversion/branches/1.7.x-r1348822/subversion/tests/cmdline/svntest:1348878-1355700 +/subversion/branches/1.7.x-r1352031/subversion/tests/cmdline/svntest:1431725-1435017 /subversion/branches/1.7.x-r1352068/subversion/tests/cmdline/svntest:1352087-1364232 /subversion/branches/1.7.x-r1361007/subversion/tests/cmdline/svntest:1361110-1367853 /subversion/branches/1.7.x-r1361341/subversion/tests/cmdline/svntest:1361342-1367855 @@ -49,6 +61,13 @@ /subversion/branches/1.7.x-r1401915/subversion/tests/cmdline/svntest:1401934-1407349 /subversion/branches/1.7.x-r1407131/subversion/tests/cmdline/svntest:1407164-1419607 /subversion/branches/1.7.x-r1423646/subversion/tests/cmdline/svntest:1423647-1424282 +/subversion/branches/1.7.x-r1426752/subversion/tests/cmdline/svntest:1426753-1485335 +/subversion/branches/1.7.x-r1427278/subversion/tests/cmdline/svntest:1433724-1485338 +/subversion/branches/1.7.x-r1461743/subversion/tests/cmdline/svntest:1461745-1482189 +/subversion/branches/1.7.x-r1475724/subversion/tests/cmdline/svntest:1475743-1482192 +/subversion/branches/1.7.x-r1481010/subversion/tests/cmdline/svntest:1481034-1482194 +/subversion/branches/1.7.x-r1482759/subversion/tests/cmdline/svntest:1483584-1485046 +/subversion/branches/1.7.x-r1507044/subversion/tests/cmdline/svntest:1507300-1511568 /subversion/branches/1.7.x-serf-server-root-segfaults/subversion/tests/cmdline/svntest:1383952-1392726 /subversion/branches/1.7.x-svn-patch-eol-fixes/subversion/tests/cmdline/svntest:1207511-1235924 /subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest:965046-1000689 @@ -105,4 +124,4 @@ /subversion/branches/tree-conflicts/subversion/tests/cmdline/svntest:868291-873154 /subversion/branches/tree-conflicts-notify/subversion/tests/cmdline/svntest:873926-874008 /subversion/branches/uris-as-urls/subversion/tests/cmdline/svntest:1060426-1064427 -/subversion/trunk/subversion/tests/cmdline/svntest:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146762,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147299,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148652,1148662,1148699,1148853,1148877,1148882,1148936,1149103,1149105,1149135,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150344,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151854,1151906,1151911,1152129,1152140,1152189-1152190,1152267,1152282,1152286,1152726,1152809,1153138,1153141,1153416,1153540,1153566,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154278,1154379,1154382,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160,11 55313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,1158187,1158193-1158194,1158196,1158201,1158207,1158209-1158210,1158217,1158285,1158288,1158303,1158309,1158407,1158419,1158421,1158436,1158455,1158616-1158617,1158634,1158854,1158875,1158886,1158893,1158896,1158919,1158923-1158924,1158929,1158963,1159093,1159098,1159101,1159132,1159136,1159148,1159230,1159275,1159400,1159686,1159760,1159772,1160605,1160671,1160682,1160704-1160705,1160756,1161063,1161080,1161185,1161210,1161683,1161721,1162024,1162033,1162201,1162516,1162880,1162974,1162995,1163243,1163372,1163383,1163557,1163792,1163953,1164027,1164386,1164426,1164517,1164535,1164554,1164580,1164614,1164645,1164760,1164765,1164929,1166267,1166500,1166555,1166678,1167062,1167173,1167209,1167269,1167503,1167659,1167681,1169524,1169531,1169650,1171708,1173111,1173425,1173639,1174051,1174060,1174342,1174652,1174761,1174797-1174798,1174806,1175888,1176915,1176949 ,1177001,1177492,1177732,1178280,1178282,1178942,1179680,1179767,1179776,1180154,1181090,1181110,1181155,1181215,1181609,1181666,1182115,1182527,1182771,1182904,1182909,1183054,1183263,1183347,1185222,1185242,1185280,1185282,1185730,1185738,1185746,1185763,1185768,1185886,1185911,1185918,1186059,1186092,1186101,1186107,1186109,1186121,1186231,1186240,1186422,1186434,1186732,1186755,1186784,1186815,1186928,1186944,1186981,1186983,1187311,1187676,1187695,1188609,1188652,1188677,1188762,1188774,1189190,1189261,1189395,1189580,1189665,1190463,1195480,1197135,1197998,1199876,1199950,1200277,1200837,1200896,1201002,1201072,1201419,1201824,1202132,1202135,1202187,1202333,1202630,1202807,1203546,1203651,1203653,1203977,1204167,1204478,1204610,1204673,1205188,1205193,1205209,1205726,1205839,1205848,1205968,1206523,1206533,1206576,1206718-1206719,1206724,1206741,1206748,1207555,1207656,1207663,1207808,1207823,1207858,1207949,1208840,1209631,1209654,1210147,1210195,1210913,1211048,1211483,1211 859,1211885,1212476,1212482,1212484,1213331,1213673,1213681,1213690,1213711,1213716,1214139,1215260,1215288,1215374-1215375,1215379,1220740,1220742,1220750,1220861,1221178,1221303,1221767,1221780,1221793,1222521,1222628,1222644,1222693,1222699,1225491,1226597,1227146,1227237,1227250,1227352,1227372,1227384-1227385,1227900,1228340,1229252,1229303,1229677,1229833,1229980,1230212,1230714,1231029,1231944-1231945,1232202,1232207,1232221-1232222,1232267,1232413,1233292,1235264,1235296,1235302,1235736,1236163,1236173,1236283,1236343,1237720,1237779,1238121,1239382,1239596,1239631,1239655,1239747,1240314,1240485,1240619,1240752,1241530,1241553,1241599,1241626,1241713,1241726,1242116,1242537,1242607,1242759,1242770,1242794,1243694,1243840,1243920,1243976,1244303,1244317,1244466,1244551,1245284-1245285,1245711,1245738,1245746,1245764,1245809,1245817,1245929,1245935,1291429,1291446,1291520,1291594,1291680,1291685,1291700,1291704,1291726,1291729,1291797,1291810,1291941,1292090,1292248,1292255,1 292260,1292296,1292322,1292507,1292516,1292768,1292827,1292926,1293229,1293577,1293945,1293972,1293976,1293998,1294134,1294136,1294147,1294236,1294470,1294586,1295007,1295303,1295372,1295418,1296251,1296303,1296369,1296691,1297522,1298343,1300265,1302399,1302417,1302539,1302588,1302591,1302613,1305853,1306111,1306334,1307177,1309992,1310378,1310428,1310535,1310594,1311702,1311935,1325361,1327474,1327490,1327495,1327979,1328002,1328038,1328144,1328267-1328268,1328353,1328846-1328847,1328852,1328878,1329388,1329417,1329876,1330258,1330382,1330444,1330520,1335104,1335555,1337441,1338810,1339164,1340556,1341012,1341031,1341034,1341076,1342984,1344864-1344865,1344869,1345482,1345740,1346765,1348822,1349215,1349367,1349371,1349380,1349778,1351117,1351772,1352068,1353572,1354626,1354652,1354876,1354907,1355340,1361007,1361019,1361341,1362508,1365519,1365549,1365554,1365556,1365592,1367498,1368065,1368128,1368197-1368198,1371282,1374198,1374800,1374802,1375052,1375089,1376414,1378847,138017 5,1380295,1380697,1382843,1383029,1383466,1383483,1383946,1387226,1387943,1388975,1389364,1389499,1389658,1389851,1389878,1389928,1390653,1390965,1391020,1391022,1391641,1391935,1392502,1392599,1393061,1393156,1393165,1393542,1393551,1393598,1394519,1396285,1398100,1399174,1401915,1402417,1402421,1403258,1403583,1403588,1403691,1403964,1403982,1407035,1407075,1407131,1407812,1408650,1409146,1410106,1410203,1423646 +/subversion/trunk/subversion/tests/cmdline/svntest:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146762,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147299,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148652,1148662,1148699,1148853,1148877,1148882,1148936,1149103,1149105,1149135,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150344,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151854,1151906,1151911,1152129,1152140,1152189-1152190,1152267,1152282,1152286,1152726,1152809,1153138,1153141,1153416,1153540,1153566,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154278,1154379,1154382,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160,11 55313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,1158187,1158193-1158194,1158196,1158201,1158207,1158209-1158210,1158217,1158285,1158288,1158303,1158309,1158407,1158419,1158421,1158436,1158455,1158616-1158617,1158634,1158854,1158875,1158886,1158893,1158896,1158919,1158923-1158924,1158929,1158963,1159093,1159098,1159101,1159132,1159136,1159148,1159230,1159275,1159400,1159686,1159760,1159772,1160605,1160671,1160682,1160704-1160705,1160756,1161063,1161080,1161185,1161210,1161683,1161721,1162024,1162033,1162201,1162516,1162880,1162974,1162995,1163243,1163372,1163383,1163557,1163792,1163953,1164027,1164116,1164386,1164426,1164517,1164535,1164554,1164580,1164614,1164645,1164760,1164765,1164929,1166267,1166500,1166555,1166678,1167062,1167173,1167209,1167269,1167503,1167659,1167681,1169524,1169531,1169650,1171708,1173111,1173425,1173639,1174051,1174060,1174342,1174652,1174761,1174797-1174798,1174806,1175888,1176915 ,1176949,1177001,1177492,1177732,1178280,1178282,1178942,1179680,1179767,1179776,1180154,1181090,1181110,1181155,1181215,1181609,1181666,1182115,1182527,1182771,1182904,1182909,1183054,1183263,1183347,1185222,1185242,1185280,1185282,1185730,1185738,1185746,1185763,1185768,1185886,1185911,1185918,1186059,1186092,1186101,1186107,1186109,1186121,1186231,1186240,1186422,1186434,1186732,1186755,1186784,1186815,1186928,1186944,1186981,1186983,1187311,1187676,1187695,1188609,1188652,1188677,1188762,1188774,1189190,1189261,1189395,1189580,1189665,1190463,1195480,1197135,1197998,1199876,1199950,1200277,1200837,1200896,1201002,1201072,1201419,1201824,1202132,1202135,1202187,1202333,1202630,1202807,1203546,1203651,1203653,1203977,1204167,1204478,1204610,1204673,1205188,1205193,1205209,1205726,1205839,1205848,1205968,1206523,1206533,1206576,1206718-1206719,1206724,1206741,1206748,1207555,1207656,1207663,1207808,1207823,1207858,1207949,1208840,1209631,1209654,1210147,1210195,1210913,1211048,1211 483,1211859,1211885,1212476,1212482,1212484,1213331,1213673,1213681,1213690,1213711,1213716,1214139,1215260,1215288,1215374-1215375,1215379,1220740,1220742,1220750,1220861,1221178,1221303,1221767,1221780,1221793,1222521,1222628,1222644,1222693,1222699,1225491,1226597,1227146,1227237,1227250,1227352,1227372,1227384-1227385,1227900,1228340,1229252,1229303,1229677,1229833,1229980,1230212,1230714,1230798,1231029,1231944-1231945,1232202,1232207,1232221-1232222,1232267,1232413,1233292,1235264,1235296,1235302,1235736,1236163,1236173,1236283,1236343,1237720,1237779,1238121,1239382,1239596,1239631,1239655,1239747,1240314,1240485,1240619,1240752,1241530,1241553,1241599,1241626,1241713,1241726,1242116,1242537,1242607,1242759,1242770,1242794,1243694,1243840,1243920,1243976,1244303,1244317,1244466,1244551,1245284-1245285,1245711,1245738,1245746,1245764,1245809,1245817,1245929,1245935,1291429,1291446,1291520,1291594,1291680,1291685,1291700,1291704,1291726,1291729,1291797,1291810,1291941,1292090,1 292248,1292255,1292260,1292296,1292322,1292507,1292516,1292768,1292827,1292926,1293229,1293577,1293945,1293972,1293976,1293998,1294134,1294136,1294147,1294236,1294470,1294586,1295007,1295303,1295372,1295418,1296251,1296303,1296369,1296691,1297522,1298343,1300265,1302399,1302417,1302539,1302588,1302591,1302613,1305853,1306111,1306275,1306334,1307177,1309865,1309992,1310378,1310428,1310535,1310594,1311702,1311935,1325361,1327474,1327490,1327495,1327979,1328002,1328038,1328144,1328267-1328268,1328353,1328846-1328847,1328852,1328878,1329388,1329417,1329876,1330258,1330382,1330444,1330520,1335104,1335555,1337441,1338291,1338297,1338314,1338688,1338708,1338713,1338739,1338748,1338810,1339159,1339164,1340556,1341012,1341031,1341034,1341076,1341544,1341560,1342984,1344864-1344865,1344869,1345482,1345740,1346765,1348822,1349215,1349367,1349371,1349380,1349778,1351117,1351772,1352031,1352068,1353572,1354626,1354652,1354876,1354907,1355340,1361007,1361019,1361341,1362508,1365519,1365549,136555 4,1365556,1365592,1367498,1368065,1368128,1368197-1368198,1371282,1374198,1374800,1374802,1375052,1375089,1376414,1378847,1380175,1380295,1380697,1382843,1383029,1383466,1383483,1383946,1387226,1387943,1388975,1389364,1389499,1389658,1389851,1389878,1389928,1390653,1390965,1391020,1391022,1391641,1391935,1392502,1392599,1393061,1393156,1393165,1393542,1393551,1393598,1394519,1396285,1398100,1399174,1401915,1402417,1402421,1403258,1403583,1403588,1403691,1403964,1403982,1405922,1407035,1407075,1407131,1407812,1408650,1409146,1409939,1410106,1410203,1419670-1419681,1421011,1421103,1421380,1421541,1422053,1422100,1423585,1423646,1423837,1423840,1423848,1424977,1425368,1426138,1426264,1426752,1426830,1427197,1427210,1427278,1429201,1434128,1434405,1434414,1434418,1434435,1434476,1434750,1435361,1438602,1438683,1441810,1443763,1443929,1445753,1451678,1452617,1452780,1452967,1453780,1454088,1454217,1455352,1458341,1459599,1461278,1461562,1461580,1461701,1461743,1462293,1462300,1462302,146 2321,1462334,1465975,1476359,1477730,1481010,1481627,1482282,1483781,1485350,1490684,1503528,1507044,1512432,1512471-1512472,1513463,1513472,1514763,1515119,1515237,1515992,1515997,1516023-1516024,1516051-1516052,1516565 Modified: subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/upgrade_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/upgrade_tests.py?rev=1645439&r1=1645438&r2=1645439&view=diff ============================================================================== --- subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/upgrade_tests.py (original) +++ subversion/branches/1.7.x-issue4340-repos/subversion/tests/cmdline/upgrade_tests.py Sun Dec 14 11:44:03 2014 @@ -426,7 +426,10 @@ def basic_upgrade_1_0(sbox): url = sbox.repo_url - xml_entries_relocate(sbox.wc_dir, 'file:///1.0.0/repos', url) + # This is non-canonical by the rules of svn_uri_canonicalize, it gets + # written into the entries file and upgrade has to canonicalize. + non_canonical_url = url[:-1] + '%%%02x' % ord(url[-1]) + xml_entries_relocate(sbox.wc_dir, 'file:///1.0.0/repos', non_canonical_url) # Attempt to use the working copy, this should give an error expected_stderr = wc_is_too_old_regex Modified: subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_diff/diff-diff3-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_diff/diff-diff3-test.c?rev=1645439&r1=1645438&r2=1645439&view=diff ============================================================================== --- subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_diff/diff-diff3-test.c (original) +++ subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_diff/diff-diff3-test.c Sun Dec 14 11:44:03 2014 @@ -2394,7 +2394,254 @@ merge_adjacent_changes(apr_pool_t *pool) return SVN_NO_ERROR; } +/* Issue #4133, 'When sequences of whitespace characters at head of line + strides chunk boundary, "diff -x -w" showing wrong change'. + The magic number used in this test, 1<<17, is + CHUNK_SIZE from ../../libsvn_diff/diff_file.c + */ +static svn_error_t * +test_norm_offset(apr_pool_t *pool) +{ + apr_size_t chunk_size = 1 << 17; + const char *pattern1 = " \n"; + const char *pattern2 = "\n\n\n\n\n\n\n\n"; + const char *pattern3 = " @@@@@@@\n"; + const char *pattern4 = " \n"; + svn_stringbuf_t *original, *modified; + svn_diff_file_options_t *diff_opts = svn_diff_file_options_create(pool); + /* The original contents become like this + + $ hexdump -C norm-offset-original + 00000000 20 20 20 20 20 20 20 0a 0a 0a 0a 0a 0a 0a 0a 0a | .........| + 00000010 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a |................| + * + 0001fff0 0a 0a 0a 0a 0a 0a 0a 0a 20 20 20 20 20 20 20 20 |........ | + 00020000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | + 00020010 40 40 40 40 40 40 40 0a 0a 0a 0a 0a 0a 0a 0a 0a |@@@@@@@.........| + 00020020 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a |................| + * + 000203f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0a | .| + 00020400 + */ + original = svn_stringbuf_create_ensure(chunk_size + 1024, pool); + svn_stringbuf_appendcstr(original, pattern1); + while (original->len < chunk_size - 8) + { + svn_stringbuf_appendcstr(original, pattern2); + } + svn_stringbuf_appendcstr(original, pattern3); + while (original->len < chunk_size +1024 - 16) + { + svn_stringbuf_appendcstr(original, pattern2); + } + svn_stringbuf_appendcstr(original, pattern4); + + /* The modified contents become like this. + + $ hexdump -C norm-offset-modified + 00000000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0a | .| + 00000010 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a |................| + * + 00020000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | + 00020010 20 20 20 20 20 20 20 20 40 40 40 40 40 40 40 0a | @@@@@@@.| + 00020020 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a |................| + * + 000203f0 0a 0a 0a 0a 0a 0a 0a 0a 20 20 20 20 20 20 20 0a |........ .| + 00020400 + */ + modified = svn_stringbuf_create_ensure(chunk_size + 1024, pool); + svn_stringbuf_appendcstr(modified, pattern4); + while (modified->len < chunk_size) + { + svn_stringbuf_appendcstr(modified, pattern2); + } + svn_stringbuf_appendcstr(modified, pattern3); + while (modified->len < chunk_size +1024 - 8) + { + svn_stringbuf_appendcstr(modified, pattern2); + } + svn_stringbuf_appendcstr(modified, pattern1); + + /* Diff them. Modulo whitespace, they are identical. */ + diff_opts->ignore_space = svn_diff_file_ignore_space_all; + SVN_ERR(two_way_diff("norm-offset-original", "norm-offset-modified", + original->data, modified->data, "", + diff_opts, pool)); + + return SVN_NO_ERROR; +} + +/* The magic number used in this test, 1<<17, is + CHUNK_SIZE from ../../libsvn_diff/diff_file.c + */ +static svn_error_t * +test_token_compare(apr_pool_t *pool) +{ + apr_size_t chunk_size = 1 << 17; + const char *pattern = "\n\n\n\n\n\n\n\n"; + svn_stringbuf_t *original, *modified; + svn_diff_file_options_t *diff_opts = svn_diff_file_options_create(pool); + + diff_opts->ignore_space = svn_diff_file_ignore_space_all; + + original = svn_stringbuf_create_ensure(chunk_size, pool); + while (original->len < chunk_size - 8) + { + svn_stringbuf_appendcstr(original, pattern); + } + svn_stringbuf_appendcstr(original, " @@@\n"); + + modified = svn_stringbuf_create_ensure(chunk_size, pool); + while (modified->len < chunk_size - 8) + { + svn_stringbuf_appendcstr(modified, pattern); + } + svn_stringbuf_appendcstr(modified, " @@@\n"); + + /* regression test for reading exceeding the file size */ + SVN_ERR(two_way_diff("token-compare-original1", "token-compare-modified1", + original->data, modified->data, "", + diff_opts, pool)); + + svn_stringbuf_appendcstr(original, "aaaaaaa\n"); + svn_stringbuf_appendcstr(modified, "bbbbbbb\n"); + + /* regression test for comparison beyond the end-of-line */ + SVN_ERR(two_way_diff("token-compare-original2", "token-compare-modified2", + original->data, modified->data, + apr_psprintf(pool, + "--- token-compare-original2" NL + "+++ token-compare-modified2" NL + "@@ -%u,4 +%u,4 @@" NL + " \n" + " \n" + " @@@\n" + "-aaaaaaa\n" + "+bbbbbbb\n", + 1 +(unsigned int)chunk_size - 8 + 1 - 3, + 1 +(unsigned int)chunk_size - 8 + 1 - 3), + diff_opts, pool)); + + return SVN_NO_ERROR; +} + +/* A back-ported copy of the 1.8 public function of the same name. */ +static void +svn_stringbuf_insert(svn_stringbuf_t *str, + apr_size_t pos, + const char *bytes, + apr_size_t count) +{ + if (bytes + count > str->data && bytes < str->data + str->blocksize) + { + /* special case: BYTES overlaps with this string -> copy the source */ + const char *temp = apr_pstrndup(str->pool, bytes, count); + svn_stringbuf_insert(str, pos, temp, count); + } + else + { + if (pos > str->len) + pos = str->len; + + svn_stringbuf_ensure(str, str->len + count); + memmove(str->data + pos + count, str->data + pos, str->len - pos + 1); + memcpy(str->data + pos, bytes, count); + + str->len += count; + } +} + +/* Issue #4283, 'When identical suffix started at a chunk boundary, + incorrect diff was generated'. + The magic number used in this test, (1<<17) and 50 are CHUNK_SIZE + and SUFFIX_LINES_TO_KEEP from ../../libsvn_diff/diff_file.c, respectively. + */ +#define ORIGINAL_CONTENTS_PATTERN "0123456789abcde\n" +#define INSERTED_LINE "0123456789ABCDE\n" +static svn_error_t * +test_identical_suffix(apr_pool_t *pool) +{ + apr_size_t lines_in_chunk = (1 << 17) + / (sizeof(ORIGINAL_CONTENTS_PATTERN) - 1); + /* To let identical suffix start at a chunk boundary, + insert a line at before (SUFFIX_LINES_TO_KEEP + 1) lines + from tail of the previous chunk. */ + apr_size_t insert_pos = lines_in_chunk +#ifdef SUFFIX_LINES_TO_KEEP + - SUFFIX_LINES_TO_KEEP +#else + - 50 +#endif + - 1; + apr_size_t i; + svn_stringbuf_t *original, *modified; + + /* The original contents become like this. + + $ hexdump -C identical-suffix-original + 00000000 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 0a |0123456789abcde.| + * + 00020400 + */ + original = svn_stringbuf_create_ensure((1 << 17) + 1024, pool); + for (i = 0; i < lines_in_chunk + 64; i++) + { + svn_stringbuf_appendbytes(original, ORIGINAL_CONTENTS_PATTERN, + sizeof(ORIGINAL_CONTENTS_PATTERN) - 1); + } + + /* The modified contents become like this. + + $ hexdump -C identical-suffix-modified + 00000000 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 0a |0123456789abcde.| + * + 00000400 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 0a |0123456789ABCDE.| + 00000410 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 0a |0123456789abcde.| + * + 0001fcd0 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 0a |0123456789ABCDE.| + 0001fce0 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 0a |0123456789abcde.| + * + 00020420 + */ + modified = svn_stringbuf_dup(original, pool); + svn_stringbuf_insert(modified, + 64 * (sizeof(ORIGINAL_CONTENTS_PATTERN) - 1), + INSERTED_LINE, sizeof(INSERTED_LINE) - 1); + svn_stringbuf_insert(modified, + insert_pos * (sizeof(ORIGINAL_CONTENTS_PATTERN) - 1), + INSERTED_LINE, sizeof(INSERTED_LINE) - 1); + + SVN_ERR(two_way_diff("identical-suffix-original", + "identical-suffix-modified", + original->data, modified->data, + apr_psprintf(pool, + "--- identical-suffix-original" NL + "+++ identical-suffix-modified" NL + "@@ -62,6 +62,7 @@" NL + " " ORIGINAL_CONTENTS_PATTERN + " " ORIGINAL_CONTENTS_PATTERN + " " ORIGINAL_CONTENTS_PATTERN + "+" INSERTED_LINE + " " ORIGINAL_CONTENTS_PATTERN + " " ORIGINAL_CONTENTS_PATTERN + " " ORIGINAL_CONTENTS_PATTERN + "@@ -%u,6 +%u,7 @@" NL + " " ORIGINAL_CONTENTS_PATTERN + " " ORIGINAL_CONTENTS_PATTERN + " " ORIGINAL_CONTENTS_PATTERN + "+" INSERTED_LINE + " " ORIGINAL_CONTENTS_PATTERN + " " ORIGINAL_CONTENTS_PATTERN + " " ORIGINAL_CONTENTS_PATTERN, + 1 + (unsigned int)insert_pos - 3 - 1, + 1 + (unsigned int)insert_pos - 3), + NULL, pool)); + + return SVN_NO_ERROR; +} +#undef ORIGINAL_CONTENTS_PATTERN +#undef INSERTED_LINE /* ========================================================================== */ @@ -2425,5 +2672,11 @@ struct svn_test_descriptor_t test_funcs[ "3-way merge with conflict styles"), SVN_TEST_PASS2(test_diff4, "4-way merge; see variance-adjusted-patching.html"), + SVN_TEST_PASS2(test_norm_offset, + "offset of the normalized token"), + SVN_TEST_PASS2(test_token_compare, + "compare tokes at the chunk boundary"), + SVN_TEST_PASS2(test_identical_suffix, + "identical suffix starts at the boundary of a chunk"), SVN_TEST_NULL }; Modified: subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_fs/fs-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_fs/fs-test.c?rev=1645439&r1=1645438&r2=1645439&view=diff ============================================================================== --- subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_fs/fs-test.c (original) +++ subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_fs/fs-test.c Sun Dec 14 11:44:03 2014 @@ -4799,6 +4799,62 @@ node_origin_rev(const svn_test_opts_t *o return SVN_NO_ERROR; } +/* Issue 4340, "fs layer should reject filenames with trailing \n" */ +static svn_error_t * +filename_trailing_newline(const svn_test_opts_t *opts, + apr_pool_t *pool) +{ + apr_pool_t *subpool = svn_pool_create(pool); + svn_fs_t *fs; + svn_fs_txn_t *txn; + svn_fs_root_t *txn_root, *root; + svn_revnum_t youngest_rev = 0; + svn_error_t *err; + svn_boolean_t allow_newlines; + + /* Some filesystem implementations can handle newlines in filenames + * and can be white-listed here. + * Currently, only BDB supports \n in filenames. */ + allow_newlines = (strcmp(opts->fs_type, "bdb") == 0); + + SVN_ERR(svn_test__create_fs(&fs, "test-filename-trailing-newline", + opts, pool)); + + /* Revision 1: Add a directory /foo */ + SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, subpool)); + SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool)); + SVN_ERR(svn_fs_make_dir(txn_root, "/foo", subpool)); + SVN_ERR(svn_fs_commit_txn(NULL, &youngest_rev, txn, subpool)); + SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev)); + svn_pool_clear(subpool); + + /* Attempt to copy /foo to "/bar\n". This should fail on FSFS. */ + SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, subpool)); + SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool)); + SVN_ERR(svn_fs_revision_root(&root, fs, youngest_rev, subpool)); + err = svn_fs_copy(root, "/foo", txn_root, "/bar\n", subpool); + if (allow_newlines) + SVN_TEST_ASSERT(err == SVN_NO_ERROR); + else + { + SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_FS_PATH_SYNTAX); + svn_error_clear(err); + } + + /* Attempt to create a file /foo/baz\n. This should fail on FSFS. */ + err = svn_fs_make_file(txn_root, "/foo/baz\n", subpool); + if (allow_newlines) + SVN_TEST_ASSERT(err == SVN_NO_ERROR); + else + { + SVN_TEST_ASSERT(err && err->apr_err == SVN_ERR_FS_PATH_SYNTAX); + svn_error_clear(err); + } + + return SVN_NO_ERROR; +} + + /* ------------------------------------------------------------------------ */ /* The test table. */ @@ -4878,5 +4934,7 @@ struct svn_test_descriptor_t test_funcs[ "test svn_fs_node_origin_rev"), SVN_TEST_OPTS_PASS(small_file_integrity, "create and modify small file"), + SVN_TEST_OPTS_PASS(filename_trailing_newline, + "filenames with trailing \\n might be rejected"), SVN_TEST_NULL }; Modified: subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_repos/repos-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_repos/repos-test.c?rev=1645439&r1=1645438&r2=1645439&view=diff ============================================================================== --- subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_repos/repos-test.c (original) +++ subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_repos/repos-test.c Sun Dec 14 11:44:03 2014 @@ -2625,6 +2625,65 @@ filename_with_control_chars(const svn_te return SVN_NO_ERROR; } +/* Notification receiver for test_dump_bad_mergeinfo(). This does not + need to do anything, it just needs to exist. + */ +static void +dump_r0_mergeinfo_notifier(void *baton, + const svn_repos_notify_t *notify, + apr_pool_t *scratch_pool) +{ +} + +/* Regression test for part the 'dump' part of issue #4476 "Mergeinfo + containing r0 makes svnsync and svnadmin dump fail". */ +static svn_error_t * +test_dump_r0_mergeinfo(const svn_test_opts_t *opts, + apr_pool_t *pool) +{ + svn_repos_t *repos; + svn_fs_t *fs; + svn_fs_txn_t *txn; + svn_fs_root_t *txn_root; + svn_revnum_t youngest_rev = 0; + const svn_string_t *bad_mergeinfo = svn_string_create("/foo:0", pool); + + SVN_ERR(svn_test__create_repos(&repos, "test-repo-dump-r0-mergeinfo", + opts, pool)); + fs = svn_repos_fs(repos); + + /* Revision 1: Any commit will do, here */ + SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, pool)); + SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool)); + SVN_ERR(svn_fs_make_dir(txn_root, "/bar", pool)); + SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool)); + SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev)); + + /* Revision 2: Add bad mergeinfo */ + SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, pool)); + SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool)); + SVN_ERR(svn_fs_change_node_prop(txn_root, "/bar", "svn:mergeinfo", bad_mergeinfo, pool)); + SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool)); + SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev)); + + /* Test that a dump completes without error. In order to exercise the + functionality under test -- that is, in order for the dump to try to + parse the mergeinfo it is dumping -- the dump must start from a + revision greater than 1 and must take a notification callback. */ + { + svn_stringbuf_t *stringbuf = svn_stringbuf_create("", pool); + svn_stream_t *stream = svn_stream_from_stringbuf(stringbuf, pool); + + SVN_ERR(svn_repos_dump_fs3(repos, stream, 2, SVN_INVALID_REVNUM, + FALSE, FALSE, + dump_r0_mergeinfo_notifier, NULL, + NULL, NULL, + pool)); + } + + return SVN_NO_ERROR; +} + /* The test table. */ struct svn_test_descriptor_t test_funcs[] = @@ -2660,6 +2719,8 @@ struct svn_test_descriptor_t test_funcs[ "test svn_repos_get_file_revsN"), SVN_TEST_OPTS_PASS(issue_4060, "test issue 4060"), + SVN_TEST_OPTS_PASS(test_dump_r0_mergeinfo, + "test dumping with r0 mergeinfo"), SVN_TEST_OPTS_PASS(filename_with_control_chars, "test filenames with control characters"), SVN_TEST_NULL Modified: subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_subr/dirent_uri-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1645439&r1=1645438&r2=1645439&view=diff ============================================================================== --- subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_subr/dirent_uri-test.c (original) +++ subversion/branches/1.7.x-issue4340-repos/subversion/tests/libsvn_subr/dirent_uri-test.c Sun Dec 14 11:44:03 2014 @@ -37,6 +37,7 @@ #include "svn_pools.h" #include "svn_dirent_uri.h" #include "private/svn_fspath.h" +#include "private/svn_cert.h" #include "../svn_test.h" @@ -891,6 +892,9 @@ static const testcase_canonicalize_t uri { "file:///c:/temp/REPOS", "file:///c:/temp/REPOS" }, { "file:///C:/temp/REPOS", "file:///C:/temp/REPOS" }, #endif /* SVN_USE_DOS_PATHS */ + /* Hostnames that look like non-canonical paths */ + { "file://./foo", "file://./foo" }, + { "http://./foo", "http://./foo" }, /* svn_uri_is_canonical() was a private function in the 1.6 API, and has since taken a MAJOR change of direction, namely that only absolute URLs are considered canonical uris now. */ @@ -2818,6 +2822,145 @@ test_fspath_get_longest_ancestor(apr_poo return SVN_NO_ERROR; } +struct cert_match_dns_test { + const char *pattern; + const char *hostname; + svn_boolean_t expected; +}; + +static svn_error_t * +run_cert_match_dns_tests(struct cert_match_dns_test *tests, apr_pool_t *pool) +{ + struct cert_match_dns_test *ct; + apr_pool_t *iterpool = svn_pool_create(pool); + + for (ct = tests; ct->pattern; ct++) + { + svn_boolean_t result; + svn_string_t *pattern, *hostname; + + svn_pool_clear(iterpool); + + pattern = svn_string_create(ct->pattern, iterpool); + hostname = svn_string_create(ct->hostname, iterpool); + + result = svn_cert__match_dns_identity(pattern, hostname); + if (result != ct->expected) + return svn_error_createf(SVN_ERR_TEST_FAILED, NULL, + "Expected %s but got %s for pattern '%s' on " + "hostname '%s'", + ct->expected ? "match" : "no match", + result ? "match" : "no match", + pattern->data, hostname->data); + + } + + svn_pool_destroy(iterpool); + + return SVN_NO_ERROR; +} + +static struct cert_match_dns_test cert_match_dns_tests[] = { + { "foo.example.com", "foo.example.com", TRUE }, /* exact match */ + { "foo.example.com", "FOO.EXAMPLE.COM", TRUE }, /* case differences */ + { "FOO.EXAMPLE.COM", "foo.example.com", TRUE }, + { "*.example.com", "FoO.ExAmPlE.CoM", TRUE }, + { "*.ExAmPlE.CoM", "foo.example.com", TRUE }, + { "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz", TRUE }, + { "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", TRUE }, + { "foo.example.com", "bar.example.com", FALSE }, /* difference at start */ + { "foo.example.com", "foo.example.net", FALSE }, /* difference at end */ + { "foo.example.com", "foo.example.commercial", FALSE }, /* hostname longer */ + { "foo.example.commercial", "foo.example.com", FALSE }, /* pattern longer */ + { "foo.example.comcom", "foo.example.com", FALSE }, /* repeated suffix */ + { "foo.example.com", "foo.example.comcom", FALSE }, + { "foo.example.com.com", "foo.example.com", FALSE }, + { "foo.example.com", "foo.example.com.com", FALSE }, + { "foofoo.example.com", "foo.example.com", FALSE }, /* repeated prefix */ + { "foo.example.com", "foofoo.example.com", FALSE }, + { "foo.foo.example.com", "foo.example.com", FALSE }, + { "foo.example.com", "foo.foo.example.com", FALSE }, + { "foo.*.example.com", "foo.bar.example.com", FALSE }, /* RFC 6125 s. 6.4.3 + Rule 1 */ + { "*.example.com", "foo.example.com", TRUE }, /* RFC 6125 s. 6.4.3 Rule 2 */ + { "*.example.com", "bar.foo.example.com", FALSE }, /* Rule 2 */ + { "*.example.com", "example.com", FALSE }, /* Rule 2 */ + { "*.example.com", ".example.com", FALSE }, /* RFC doesn't say what to do + here and a leading period on + a hostname doesn't make sense + so we'll just reject this. */ + { "*", "foo.example.com", FALSE }, /* wildcard must be left-most label, + implies that there must be more than + one label. */ + { "*", "example.com", FALSE }, + { "*", "com", FALSE }, + { "*.example.com", "foo.example.net", FALSE }, /* difference in literal text + with a wildcard. */ + { "*.com", "example.com", TRUE }, /* See Errata ID 3090 for RFC 6125, + probably shouldn't allow this but + we do for now. */ + { "*.", "example.com", FALSE }, /* test some dubious 2 character wildcard + patterns */ + { "*.", "example.", TRUE }, /* This one feels questionable */ + { "*.", "example", FALSE }, + { "*.", ".", FALSE }, + { "a", "a", TRUE }, /* check that single letter exact matches work */ + { "a", "b", FALSE }, /* and single letter not matches shouldn't */ + { "*.*.com", "foo.example.com", FALSE }, /* unsupported wildcards */ + { "*.*.com", "example.com", FALSE }, + { "**.example.com", "foo.example.com", FALSE }, + { "**.example.com", "example.com", FALSE }, + { "f*.example.com", "foo.example.com", FALSE }, + { "f*.example.com", "bar.example.com", FALSE }, + { "*o.example.com", "foo.example.com", FALSE }, + { "*o.example.com", "bar.example.com", FALSE }, + { "f*o.example.com", "foo.example.com", FALSE }, + { "f*o.example.com", "bar.example.com", FALSE }, + { "foo.e*.com", "foo.example.com", FALSE }, + { "foo.*e.com", "foo.example.com", FALSE }, + { "foo.e*e.com", "foo.example.com", FALSE }, + { "foo.example.com", "foo.example.com.", TRUE }, /* trailing dot */ + { "*.example.com", "foo.example.com.", TRUE }, + { "foo", "foo.", TRUE }, + { "foo.example.com.", "foo.example.com", FALSE }, + { "*.example.com.", "foo.example.com", FALSE }, + { "foo.", "foo", FALSE }, + { "foo.example.com", "foo.example.com..", FALSE }, + { "*.example.com", "foo.example.com..", FALSE }, + { "foo", "foo..", FALSE }, + { "foo.example.com..", "foo.example.com", FALSE }, + { "*.example.com..", "foo.example.com", FALSE }, + { "foo..", "foo", FALSE }, + { NULL } +}; + +static svn_error_t * +test_cert_match_dns_identity(apr_pool_t *pool) +{ + return run_cert_match_dns_tests(cert_match_dns_tests, pool); +} + +/* This test table implements results that should happen if we supported + * RFC 6125 s. 6.4.3 Rule 3. We don't so it's expected to fail for now. */ +static struct cert_match_dns_test rule3_tests[] = { + { "baz*.example.net", "baz1.example.net", TRUE }, + { "*baz.example.net", "foobaz.example.net", TRUE }, + { "b*z.example.net", "buuz.example.net", TRUE }, + { "b*z.example.net", "bz.example.net", FALSE }, /* presume wildcard can't + match nothing */ + { "baz*.example.net", "baz.example.net", FALSE }, + { "*baz.example.net", "baz.example.net", FALSE }, + { "b*z.example.net", "buuzuuz.example.net", TRUE }, /* presume wildcard + should be greedy */ + { NULL } +}; + +static svn_error_t * +test_rule3(apr_pool_t *pool) +{ + return run_cert_match_dns_tests(rule3_tests, pool); +} + /* The test table. */ @@ -2922,5 +3065,9 @@ struct svn_test_descriptor_t test_funcs[ "test svn_fspath__dirname/basename/split"), SVN_TEST_PASS2(test_fspath_get_longest_ancestor, "test svn_fspath__get_longest_ancestor"), + SVN_TEST_PASS2(test_cert_match_dns_identity, + "test svn_cert__match_dns_identity"), + SVN_TEST_XFAIL2(test_rule3, + "test match with RFC 6125 s. 6.4.3 Rule 3"), SVN_TEST_NULL }; Propchange: subversion/branches/1.7.x-issue4340-repos/tools/client-side/svnmucc/svnmucc.c ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Dec 14 11:44:03 2014 @@ -1,6 +1,8 @@ /subversion/1.7.x-issue4059/tools/client-side/svnmucc/svnmucc.c:1239661-1239744 /subversion/branches/1.5.x-r30215/tools/client-side/svnmucc/svnmucc.c:870312 +/subversion/branches/1.7.x/tools/client-side/svnmucc/svnmucc.c:1480943-1645438 /subversion/branches/1.7.x-JavaHL-pools/tools/client-side/svnmucc/svnmucc.c:1158684-1158722 +/subversion/branches/1.7.x-gssapi-solaris10/tools/client-side/svnmucc/svnmucc.c:1453164-1515067 /subversion/branches/1.7.x-issue3888/tools/client-side/svnmucc/svnmucc.c:1148937-1149162 /subversion/branches/1.7.x-issue3975/tools/client-side/svnmucc/svnmucc.c:1160761-1161546 /subversion/branches/1.7.x-issue3976/tools/client-side/svnmucc/svnmucc.c:1161731-1165397 @@ -13,12 +15,21 @@ /subversion/branches/1.7.x-issue4102/tools/client-side/svnmucc/svnmucc.c:1292401-1295402 /subversion/branches/1.7.x-issue4123/tools/client-side/svnmucc/svnmucc.c:1293358-1293812 /subversion/branches/1.7.x-issue4144/tools/client-side/svnmucc/svnmucc.c:1305854-1306143 +/subversion/branches/1.7.x-issue4153/tools/client-side/svnmucc/svnmucc.c:1309894-1539233 /subversion/branches/1.7.x-issue4161/tools/client-side/svnmucc/svnmucc.c:1330697-1331209 /subversion/branches/1.7.x-issue4166/tools/client-side/svnmucc/svnmucc.c:1330474-1336071 /subversion/branches/1.7.x-issue4169/tools/client-side/svnmucc/svnmucc.c:1330537-1336116 +/subversion/branches/1.7.x-issue4257/tools/client-side/svnmucc/svnmucc.c:1454456-1461404 +/subversion/branches/1.7.x-issue4263/tools/client-side/svnmucc/svnmucc.c:1423588-1434547 +/subversion/branches/1.7.x-issue4270/tools/client-side/svnmucc/svnmucc.c:1433737-1485341 +/subversion/branches/1.7.x-issue4306/tools/client-side/svnmucc/svnmucc.c:1438872-1514941 +/subversion/branches/1.7.x-issue4332/tools/client-side/svnmucc/svnmucc.c:1453478-1460963 +/subversion/branches/1.7.x-issue4340/tools/client-side/svnmucc/svnmucc.c:1461589-1485180 +/subversion/branches/1.7.x-issue4408/tools/client-side/svnmucc/svnmucc.c:1512143-1514943 /subversion/branches/1.7.x-issue4k/tools/client-side/svnmucc/svnmucc.c:1166502-1167193 /subversion/branches/1.7.x-log-diff/tools/client-side/svnmucc/svnmucc.c:1295670-1295699 /subversion/branches/1.7.x-neon-default/tools/client-side/svnmucc/svnmucc.c:1148803-1158680 +/subversion/branches/1.7.x-neon-properr/tools/client-side/svnmucc/svnmucc.c:1440619-1461944 /subversion/branches/1.7.x-r1152189/tools/client-side/svnmucc/svnmucc.c:1152759-1154249 /subversion/branches/1.7.x-r1155160/tools/client-side/svnmucc/svnmucc.c:1158704-1159223 /subversion/branches/1.7.x-r1159093/tools/client-side/svnmucc/svnmucc.c:1159097-1159230 @@ -34,6 +45,7 @@ /subversion/branches/1.7.x-r1306111/tools/client-side/svnmucc/svnmucc.c:1306301-1331207 /subversion/branches/1.7.x-r1341012/tools/client-side/svnmucc/svnmucc.c:1341013-1355629 /subversion/branches/1.7.x-r1348822/tools/client-side/svnmucc/svnmucc.c:1348878-1355700 +/subversion/branches/1.7.x-r1352031/tools/client-side/svnmucc/svnmucc.c:1431725-1435017 /subversion/branches/1.7.x-r1352068/tools/client-side/svnmucc/svnmucc.c:1352087-1364232 /subversion/branches/1.7.x-r1361007/tools/client-side/svnmucc/svnmucc.c:1361110-1367853 /subversion/branches/1.7.x-r1361341/tools/client-side/svnmucc/svnmucc.c:1361342-1367855 @@ -47,7 +59,15 @@ /subversion/branches/1.7.x-r1398325/tools/client-side/svnmucc/svnmucc.c:1398353-1398633 /subversion/branches/1.7.x-r1399174/tools/client-side/svnmucc/svnmucc.c:1399176-1403964 /subversion/branches/1.7.x-r1401915/tools/client-side/svnmucc/svnmucc.c:1401934-1407349 +/subversion/branches/1.7.x-r1407131/tools/client-side/svnmucc/svnmucc.c:1407164-1419607 /subversion/branches/1.7.x-r1423646/tools/client-side/svnmucc/svnmucc.c:1423647-1424282 +/subversion/branches/1.7.x-r1426752/tools/client-side/svnmucc/svnmucc.c:1426753-1485335 +/subversion/branches/1.7.x-r1427278/tools/client-side/svnmucc/svnmucc.c:1433724-1485338 +/subversion/branches/1.7.x-r1461743/tools/client-side/svnmucc/svnmucc.c:1461745-1482189 +/subversion/branches/1.7.x-r1475724/tools/client-side/svnmucc/svnmucc.c:1475743-1482192 +/subversion/branches/1.7.x-r1481010/tools/client-side/svnmucc/svnmucc.c:1481034-1482194 +/subversion/branches/1.7.x-r1482759/tools/client-side/svnmucc/svnmucc.c:1483584-1485046 +/subversion/branches/1.7.x-r1507044/tools/client-side/svnmucc/svnmucc.c:1507300-1511568 /subversion/branches/1.7.x-serf-server-root-segfaults/tools/client-side/svnmucc/svnmucc.c:1383952-1392726 /subversion/branches/1.7.x-svn-patch-eol-fixes/tools/client-side/svnmucc/svnmucc.c:1207511-1235924 /subversion/branches/atomic-revprop/tools/client-side/svnmucc/svnmucc.c:965046-1000689 @@ -105,4 +125,4 @@ /subversion/branches/tree-conflicts-notify/tools/client-side/svnmucc/svnmucc.c:873926-874008 /subversion/branches/uris-as-urls/tools/client-side/svnmucc/svnmucc.c:1060426-1064427 /subversion/trunk/subversion/svnmucc/svnmucc.c:1407597 -/subversion/trunk/tools/client-side/svnmucc/svnmucc.c:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146762,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147299,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148652,1148662,1148699,1148853,1148877,1148882,1148936,1149103,1149105,1149135,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150344,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151854,1151906,1151911,1152129,1152140,1152189-1152190,1152267,1152282,1152286,1152726,1152809,1153138,1153141,1153416,1153540,1153566,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154278,1154379,1154382,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160 ,1155313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,1158187,1158193-1158194,1158196,1158201,1158207,1158209-1158210,1158217,1158285,1158288,1158303,1158309,1158407,1158419,1158421,1158436,1158455,1158616-1158617,1158634,1158854,1158875,1158886,1158893,1158896,1158919,1158923-1158924,1158929,1158963,1159093,1159098,1159101,1159132,1159136,1159148,1159230,1159275,1159400,1159686,1159760,1159772,1160605,1160671,1160682,1160704-1160705,1160756,1161063,1161080,1161185,1161210,1161683,1161721,1162024,1162033,1162201,1162516,1162880,1162974,1162995,1163243,1163372,1163383,1163557,1163792,1163953,1164027,1164386,1164426,1164517,1164535,1164554,1164580,1164614,1164645,1164760,1164765,1164929,1166267,1166500,1166555,1166678,1167062,1167173,1167209,1167269,1167503,1167659,1167681,1169524,1169531,1169650,1171708,1173111,1173425,1173639,1174051,1174060,1174342,1174652,1174761,1174797-1174798,1174806,1175888,1176915,1176 949,1177001,1177492,1177732,1178280,1178282,1178942,1179680,1179767,1179776,1180154,1181090,1181110,1181155,1181215,1181609,1181666,1182115,1182527,1182771,1182904,1182909,1183054,1183263,1183347,1185222,1185242,1185280,1185282,1185730,1185738,1185746,1185763,1185768,1185886,1185911,1185918,1186059,1186092,1186101,1186107,1186109,1186121,1186231,1186240,1186422,1186434,1186732,1186755,1186784,1186815,1186928,1186944,1186981,1186983,1187311,1187676,1187695,1188609,1188652,1188677,1188762,1188774,1189190,1189261,1189395,1189580,1189665,1190463,1195480,1197135,1197998,1199876,1199950,1200277,1200837,1200896,1201002,1201072,1201419,1201824,1202132,1202135,1202187,1202333,1202630,1202807,1203546,1203651,1203653,1203977,1204167,1204478,1204610,1204673,1205188,1205193,1205209,1205726,1205839,1205848,1205968,1206523,1206533,1206576,1206718-1206719,1206724,1206741,1206748,1207555,1207656,1207663,1207808,1207823,1207858,1207949,1208840,1209631,1209654,1210147,1210195,1210913,1211048,1211483,1 211859,1211885,1212476,1212482,1212484,1213331,1213673,1213681,1213690,1213711,1213716,1214139,1215260,1215288,1215374-1215375,1215379,1220740,1220742,1220750,1220861,1221178,1221303,1221767,1221780,1221793,1222521,1222628,1222644,1222693,1222699,1225491,1226597,1227146,1227237,1227250,1227352,1227372,1227384-1227385,1227900,1228340,1229252,1229303,1229677,1229833,1229980,1230212,1230714,1231029,1231944-1231945,1232202,1232207,1232221-1232222,1232267,1232413,1233292,1235264,1235296,1235302,1235736,1236163,1236173,1236283,1236343,1237720,1237779,1238121,1239382,1239596,1239631,1239655,1239747,1240314,1240485,1240619,1240752,1241530,1241553,1241599,1241626,1241713,1241726,1242116,1242537,1242607,1242759,1242770,1242794,1243694,1243840,1243920,1243976,1244303,1244317,1244466,1244551,1245284-1245285,1245711,1245738,1245746,1245764,1245809,1245817,1245929,1245935,1291429,1291446,1291520,1291594,1291680,1291685,1291700,1291704,1291726,1291729,1291797,1291810,1291941,1292090,1292248,129225 5,1292260,1292296,1292322,1292507,1292516,1292768,1292827,1292926,1293229,1293577,1293945,1293972,1293976,1293998,1294134,1294136,1294147,1294236,1294470,1294586,1295007,1295303,1295372,1296251,1296303,1296369,1296691,1297522,1298343,1300265,1302399,1302417,1302539,1302588,1302591,1302613,1305853,1306111,1306334,1307177,1309992,1310378,1310428,1310535,1310594,1311702,1311935,1325361,1327474,1327490,1327495,1327979,1328002,1328038,1328144,1328267-1328268,1328353,1328846-1328847,1328852,1328878,1329388,1329417,1329876,1330258,1330382,1330444,1330520,1335104,1335555,1337441,1338810,1339164,1340556,1341012,1341031,1341034,1341076,1342984,1344864-1344865,1344869,1345482,1345740,1346765,1348822,1349215,1349367,1349371,1349380,1349778,1351117,1351772,1352068,1353572,1354626,1354652,1354876,1354907,1355340,1361007,1361019,1361341,1362508,1365519,1365549,1365554,1365556,1365592,1367498,1368065,1368128,1368197-1368198,1371282,1374198,1374800,1374802,1375052,1375089,1376414,1378847,1380175,138 0295,1380697,1382843,1383029,1383466,1383483,1383946,1387226,1387943,1388975,1389364,1389499,1389658,1389851,1389878,1389928,1390653,1390965,1391020,1391022,1391641,1391935,1392502,1392599,1393061,1393156,1393165,1393542,1393551,1393598,1394519,1396285,1398100,1399174,1401915,1402417,1402421,1403258,1403583,1403964,1403982,1410106,1410203,1423646 +/subversion/trunk/tools/client-side/svnmucc/svnmucc.c:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146762,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147299,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148652,1148662,1148699,1148853,1148877,1148882,1148936,1149103,1149105,1149135,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150344,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151854,1151906,1151911,1152129,1152140,1152189-1152190,1152267,1152282,1152286,1152726,1152809,1153138,1153141,1153416,1153540,1153566,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154278,1154379,1154382,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160 ,1155313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,1158187,1158193-1158194,1158196,1158201,1158207,1158209-1158210,1158217,1158285,1158288,1158303,1158309,1158407,1158419,1158421,1158436,1158455,1158616-1158617,1158634,1158854,1158875,1158886,1158893,1158896,1158919,1158923-1158924,1158929,1158963,1159093,1159098,1159101,1159132,1159136,1159148,1159230,1159275,1159400,1159686,1159760,1159772,1160605,1160671,1160682,1160704-1160705,1160756,1161063,1161080,1161185,1161210,1161683,1161721,1162024,1162033,1162201,1162516,1162880,1162974,1162995,1163243,1163372,1163383,1163557,1163792,1163953,1164027,1164116,1164386,1164426,1164517,1164535,1164554,1164580,1164614,1164645,1164760,1164765,1164929,1166267,1166500,1166555,1166678,1167062,1167173,1167209,1167269,1167503,1167659,1167681,1169524,1169531,1169650,1171708,1173111,1173425,1173639,1174051,1174060,1174342,1174652,1174761,1174797-1174798,1174806,1175888,1176 915,1176949,1177001,1177492,1177732,1178280,1178282,1178942,1179680,1179767,1179776,1180154,1181090,1181110,1181155,1181215,1181609,1181666,1182115,1182527,1182771,1182904,1182909,1183054,1183263,1183347,1185222,1185242,1185280,1185282,1185730,1185738,1185746,1185763,1185768,1185886,1185911,1185918,1186059,1186092,1186101,1186107,1186109,1186121,1186231,1186240,1186422,1186434,1186732,1186755,1186784,1186815,1186928,1186944,1186981,1186983,1187311,1187676,1187695,1188609,1188652,1188677,1188762,1188774,1189190,1189261,1189395,1189580,1189665,1190463,1195480,1197135,1197998,1199876,1199950,1200277,1200837,1200896,1201002,1201072,1201419,1201824,1202132,1202135,1202187,1202333,1202630,1202807,1203546,1203651,1203653,1203977,1204167,1204478,1204610,1204673,1205188,1205193,1205209,1205726,1205839,1205848,1205968,1206523,1206533,1206576,1206718-1206719,1206724,1206741,1206748,1207555,1207656,1207663,1207808,1207823,1207858,1207949,1208840,1209631,1209654,1210147,1210195,1210913,1211048,1 211483,1211859,1211885,1212476,1212482,1212484,1213331,1213673,1213681,1213690,1213711,1213716,1214139,1215260,1215288,1215374-1215375,1215379,1220740,1220742,1220750,1220861,1221178,1221303,1221767,1221780,1221793,1222521,1222628,1222644,1222693,1222699,1225491,1226597,1227146,1227237,1227250,1227352,1227372,1227384-1227385,1227900,1228340,1229252,1229303,1229677,1229833,1229980,1230212,1230714,1230798,1231029,1231944-1231945,1232202,1232207,1232221-1232222,1232267,1232413,1233292,1235264,1235296,1235302,1235736,1236163,1236173,1236283,1236343,1237720,1237779,1238121,1239382,1239596,1239631,1239655,1239747,1240314,1240485,1240619,1240752,1241530,1241553,1241599,1241626,1241713,1241726,1242116,1242537,1242607,1242759,1242770,1242794,1243694,1243840,1243920,1243976,1244303,1244317,1244466,1244551,1245284-1245285,1245711,1245738,1245746,1245764,1245809,1245817,1245929,1245935,1291429,1291446,1291520,1291594,1291680,1291685,1291700,1291704,1291726,1291729,1291797,1291810,1291941,129209 0,1292248,1292255,1292260,1292296,1292322,1292507,1292516,1292768,1292827,1292926,1293229,1293577,1293945,1293972,1293976,1293998,1294134,1294136,1294147,1294236,1294470,1294586,1295007,1295303,1295372,1295418,1296251,1296303,1296369,1296691,1297522,1298343,1300265,1302399,1302417,1302539,1302588,1302591,1302613,1305853,1306111,1306275,1306334,1307177,1309865,1309992,1310378,1310428,1310535,1310594,1311702,1311935,1325361,1327474,1327490,1327495,1327979,1328002,1328038,1328144,1328267-1328268,1328353,1328846-1328847,1328852,1328878,1329388,1329417,1329876,1330258,1330382,1330444,1330520,1335104,1335555,1337441,1338291,1338297,1338314,1338688,1338708,1338713,1338739,1338748,1338810,1339159,1339164,1340556,1341012,1341031,1341034,1341076,1341544,1341560,1342984,1344864-1344865,1344869,1345482,1345740,1346765,1348822,1349215,1349367,1349371,1349380,1349778,1351117,1351772,1352031,1352068,1353572,1354626,1354652,1354876,1354907,1355340,1361007,1361019,1361341,1362508,1365519,1365549,136 5554,1365556,1365592,1367498,1368065,1368128,1368197-1368198,1371282,1374198,1374800,1374802,1375052,1375089,1376414,1378847,1380175,1380295,1380697,1382843,1383029,1383466,1383483,1383946,1387226,1387943,1388975,1389364,1389499,1389658,1389851,1389878,1389928,1390653,1390965,1391020,1391022,1391641,1391935,1392502,1392599,1393061,1393156,1393165,1393542,1393551,1393598,1394519,1396285,1398100,1399174,1401915,1402417,1402421,1403258,1403583,1403588,1403691,1403964,1403982,1405922,1407131,1407812,1408650,1409146,1409939,1410106,1410203,1419670-1419681,1421011,1421103,1421380,1421541,1422053,1422100,1423585,1423646,1423837,1423840,1423848,1424977,1425368,1426138,1426264,1426752,1426830,1427197,1427210,1427278,1429201,1434128,1434405,1434414,1434418,1434435,1434476,1434750,1435361,1438602,1438683,1441810,1443763,1443929,1445753,1451678,1452617,1452780,1452967,1453780,1454088,1454217,1455352,1458341,1459599,1461278,1461562,1461580,1461701,1461743,1462293,1462300,1462302,1462321,1462334, 1465975,1476359,1477730,1481010,1481627,1482282,1483781,1485350,1490684,1503528,1507044,1512432,1512471-1512472,1513463,1513472,1514763,1515119,1515237,1515992,1515997,1516023-1516024,1516051-1516052,1516565 Modified: subversion/branches/1.7.x-issue4340-repos/tools/server-side/mod_dontdothat/mod_dontdothat.c URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4340-repos/tools/server-side/mod_dontdothat/mod_dontdothat.c?rev=1645439&r1=1645438&r2=1645439&view=diff ============================================================================== --- subversion/branches/1.7.x-issue4340-repos/tools/server-side/mod_dontdothat/mod_dontdothat.c (original) +++ subversion/branches/1.7.x-issue4340-repos/tools/server-side/mod_dontdothat/mod_dontdothat.c Sun Dec 14 11:44:03 2014 @@ -30,12 +30,15 @@ #include <util_filter.h> #include <ap_config.h> #include <apr_strings.h> +#include <apr_uri.h> #include <expat.h> #include "mod_dav_svn.h" #include "svn_string.h" #include "svn_config.h" +#include "svn_path.h" +#include "private/svn_fspath.h" module AP_MODULE_DECLARE_DATA dontdothat_module; @@ -161,26 +164,71 @@ matches(const char *wc, const char *p) } } +/* duplicate of dav_svn__log_err() from mod_dav_svn/util.c */ +static void +log_dav_err(request_rec *r, + dav_error *err, + int level) +{ + dav_error *errscan; + + /* Log the errors */ + /* ### should have a directive to log the first or all */ + for (errscan = err; errscan != NULL; errscan = errscan->prev) { + apr_status_t status; + + if (errscan->desc == NULL) + continue; + +#if AP_MODULE_MAGIC_AT_LEAST(20091119,0) + status = errscan->aprerr; +#else + status = errscan->save_errno; +#endif + + ap_log_rerror(APLOG_MARK, level, status, r, + "%s [%d, #%d]", + errscan->desc, errscan->status, errscan->error_id); + } +} + static svn_boolean_t is_this_legal(dontdothat_filter_ctx *ctx, const char *uri) { const char *relative_path; const char *cleaned_uri; const char *repos_name; + const char *uri_path; int trailing_slash; dav_error *derr; - /* Ok, so we need to skip past the scheme, host, etc. */ - uri = ap_strstr_c(uri, "://"); - if (uri) - uri = ap_strchr_c(uri + 3, '/'); + /* uri can be an absolute uri or just a path, we only want the path to match + * against */ + if (uri && svn_path_is_url(uri)) + { + apr_uri_t parsed_uri; + apr_status_t rv = apr_uri_parse(ctx->r->pool, uri, &parsed_uri); + if (APR_SUCCESS != rv) + { + /* Error parsing the URI, log and reject request. */ + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, ctx->r, + "mod_dontdothat: blocked request after failing " + "to parse uri: '%s'", uri); + return FALSE; + } + uri_path = parsed_uri.path; + } + else + { + uri_path = uri; + } - if (uri) + if (uri_path) { const char *repos_path; derr = dav_svn_split_uri(ctx->r, - uri, + uri_path, ctx->cfg->base_path, &cleaned_uri, &trailing_slash, @@ -194,7 +242,7 @@ is_this_legal(dontdothat_filter_ctx *ctx if (! repos_path) repos_path = ""; - repos_path = apr_psprintf(ctx->r->pool, "/%s", repos_path); + repos_path = svn_fspath__canonicalize(repos_path, ctx->r->pool); /* First check the special cases that are always legal... */ for (idx = 0; idx < ctx->allow_recursive_ops->nelts; ++idx) @@ -228,6 +276,19 @@ is_this_legal(dontdothat_filter_ctx *ctx } } } + else + { + log_dav_err(ctx->r, derr, APLOG_ERR); + return FALSE; + } + + } + else + { + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, + "mod_dontdothat: empty uri passed to is_this_legal(), " + "module bug?"); + return FALSE; } return TRUE;
