Fossil SCM
The symlinks tests are all concerned with files accessed through symlink traversal which has not been allowed for quite a while (I think [4d445ead] is the last change that enforced this). To carry out the tests, ensure allow-symlinks is set in the local repo.
Commit
d30cd073149436ddf289a4655908abaffdecf9f9f0da156e4b18a0b87b2f3f18
Parent
b94d8c4479ea4f6…
1 file changed
+17
-5
+17
-5
| --- test/symlinks.test | ||
| +++ test/symlinks.test | ||
| @@ -35,10 +35,13 @@ | ||
| 35 | 35 | require_no_open_checkout |
| 36 | 36 | |
| 37 | 37 | ############################################################################### |
| 38 | 38 | |
| 39 | 39 | test_setup; set rootDir [file normalize [pwd]] |
| 40 | + | |
| 41 | +# Using tempHomePath, allow-symlinks will always be off at this point. | |
| 42 | +fossil set allow-symlinks on | |
| 40 | 43 | |
| 41 | 44 | fossil test-th-eval --open-config {repository} |
| 42 | 45 | set repository [normalize_result] |
| 43 | 46 | |
| 44 | 47 | if {[string length $repository] == 0} { |
| @@ -62,22 +65,31 @@ | ||
| 62 | 65 | test symlinks-dir-2 {[file exists [file join $rootDir symdirA f1.txt]] eq 1} |
| 63 | 66 | test symlinks-dir-3 {[file exists [file join $rootDir subdirA f2.txt]] eq 1} |
| 64 | 67 | test symlinks-dir-4 {[file exists [file join $rootDir symdirA f2.txt]] eq 1} |
| 65 | 68 | |
| 66 | 69 | fossil add [file join $rootDir symdirA f1.txt] |
| 70 | +test symlinks-skip-dir-traversal {[normalize_result] eq \ | |
| 71 | +"SKIP symdirA/f1.txt"} | |
| 72 | + | |
| 67 | 73 | fossil commit -m "c1" |
| 68 | 74 | |
| 75 | +test symlinks-empty-commit {[normalize_result] eq \ | |
| 76 | +"nothing has changed; use --allow-empty to override"} | |
| 77 | + | |
| 69 | 78 | ############################################################################### |
| 70 | 79 | |
| 71 | 80 | fossil ls |
| 72 | -test symlinks-dir-5 {[normalize_result] eq "symdirA/f1.txt"} | |
| 81 | +test symlinks-dir-5 {[normalize_result] eq ""} | |
| 73 | 82 | |
| 74 | 83 | ############################################################################### |
| 84 | + | |
| 85 | +fossil set allow | |
| 86 | +puts $RESULT | |
| 75 | 87 | |
| 76 | 88 | fossil extras |
| 77 | 89 | test symlinks-dir-6 {[normalize_result] eq \ |
| 78 | -"subdirA/f1.txt\nsubdirA/f2.txt\nsymdirA/f2.txt"} | |
| 90 | +"subdirA/f1.txt\nsubdirA/f2.txt\nsymdirA"} | |
| 79 | 91 | |
| 80 | 92 | ############################################################################### |
| 81 | 93 | |
| 82 | 94 | fossil close |
| 83 | 95 | file delete [file join $rootDir subdirA f1.txt] |
| @@ -87,17 +99,17 @@ | ||
| 87 | 99 | test symlinks-dir-9 {[file exists [file join $rootDir subdirA f2.txt]] eq 1} |
| 88 | 100 | test symlinks-dir-10 {[file exists [file join $rootDir symdirA f2.txt]] eq 1} |
| 89 | 101 | |
| 90 | 102 | ############################################################################### |
| 91 | 103 | |
| 92 | -fossil open $repository | |
| 104 | +fossil open --force $repository | |
| 93 | 105 | set code [catch {file readlink [file join $rootDir symdirA]} result] |
| 94 | 106 | |
| 95 | 107 | test symlinks-dir-11 {$code == 0} |
| 96 | 108 | test symlinks-dir-12 {$result eq [file join $rootDir subdirA]} |
| 97 | -test symlinks-dir-13 {[file exists [file join $rootDir subdirA f1.txt]] eq 1} | |
| 98 | -test symlinks-dir-14 {[file exists [file join $rootDir symdirA f1.txt]] eq 1} | |
| 109 | +test symlinks-dir-13 {[file exists [file join $rootDir subdirA f1.txt]] eq 0} | |
| 110 | +test symlinks-dir-14 {[file exists [file join $rootDir symdirA f1.txt]] eq 0} | |
| 99 | 111 | test symlinks-dir-15 {[file exists [file join $rootDir subdirA f2.txt]] eq 1} |
| 100 | 112 | test symlinks-dir-16 {[file exists [file join $rootDir symdirA f2.txt]] eq 1} |
| 101 | 113 | |
| 102 | 114 | ############################################################################### |
| 103 | 115 | # |
| 104 | 116 |
| --- test/symlinks.test | |
| +++ test/symlinks.test | |
| @@ -35,10 +35,13 @@ | |
| 35 | require_no_open_checkout |
| 36 | |
| 37 | ############################################################################### |
| 38 | |
| 39 | test_setup; set rootDir [file normalize [pwd]] |
| 40 | |
| 41 | fossil test-th-eval --open-config {repository} |
| 42 | set repository [normalize_result] |
| 43 | |
| 44 | if {[string length $repository] == 0} { |
| @@ -62,22 +65,31 @@ | |
| 62 | test symlinks-dir-2 {[file exists [file join $rootDir symdirA f1.txt]] eq 1} |
| 63 | test symlinks-dir-3 {[file exists [file join $rootDir subdirA f2.txt]] eq 1} |
| 64 | test symlinks-dir-4 {[file exists [file join $rootDir symdirA f2.txt]] eq 1} |
| 65 | |
| 66 | fossil add [file join $rootDir symdirA f1.txt] |
| 67 | fossil commit -m "c1" |
| 68 | |
| 69 | ############################################################################### |
| 70 | |
| 71 | fossil ls |
| 72 | test symlinks-dir-5 {[normalize_result] eq "symdirA/f1.txt"} |
| 73 | |
| 74 | ############################################################################### |
| 75 | |
| 76 | fossil extras |
| 77 | test symlinks-dir-6 {[normalize_result] eq \ |
| 78 | "subdirA/f1.txt\nsubdirA/f2.txt\nsymdirA/f2.txt"} |
| 79 | |
| 80 | ############################################################################### |
| 81 | |
| 82 | fossil close |
| 83 | file delete [file join $rootDir subdirA f1.txt] |
| @@ -87,17 +99,17 @@ | |
| 87 | test symlinks-dir-9 {[file exists [file join $rootDir subdirA f2.txt]] eq 1} |
| 88 | test symlinks-dir-10 {[file exists [file join $rootDir symdirA f2.txt]] eq 1} |
| 89 | |
| 90 | ############################################################################### |
| 91 | |
| 92 | fossil open $repository |
| 93 | set code [catch {file readlink [file join $rootDir symdirA]} result] |
| 94 | |
| 95 | test symlinks-dir-11 {$code == 0} |
| 96 | test symlinks-dir-12 {$result eq [file join $rootDir subdirA]} |
| 97 | test symlinks-dir-13 {[file exists [file join $rootDir subdirA f1.txt]] eq 1} |
| 98 | test symlinks-dir-14 {[file exists [file join $rootDir symdirA f1.txt]] eq 1} |
| 99 | test symlinks-dir-15 {[file exists [file join $rootDir subdirA f2.txt]] eq 1} |
| 100 | test symlinks-dir-16 {[file exists [file join $rootDir symdirA f2.txt]] eq 1} |
| 101 | |
| 102 | ############################################################################### |
| 103 | # |
| 104 |
| --- test/symlinks.test | |
| +++ test/symlinks.test | |
| @@ -35,10 +35,13 @@ | |
| 35 | require_no_open_checkout |
| 36 | |
| 37 | ############################################################################### |
| 38 | |
| 39 | test_setup; set rootDir [file normalize [pwd]] |
| 40 | |
| 41 | # Using tempHomePath, allow-symlinks will always be off at this point. |
| 42 | fossil set allow-symlinks on |
| 43 | |
| 44 | fossil test-th-eval --open-config {repository} |
| 45 | set repository [normalize_result] |
| 46 | |
| 47 | if {[string length $repository] == 0} { |
| @@ -62,22 +65,31 @@ | |
| 65 | test symlinks-dir-2 {[file exists [file join $rootDir symdirA f1.txt]] eq 1} |
| 66 | test symlinks-dir-3 {[file exists [file join $rootDir subdirA f2.txt]] eq 1} |
| 67 | test symlinks-dir-4 {[file exists [file join $rootDir symdirA f2.txt]] eq 1} |
| 68 | |
| 69 | fossil add [file join $rootDir symdirA f1.txt] |
| 70 | test symlinks-skip-dir-traversal {[normalize_result] eq \ |
| 71 | "SKIP symdirA/f1.txt"} |
| 72 | |
| 73 | fossil commit -m "c1" |
| 74 | |
| 75 | test symlinks-empty-commit {[normalize_result] eq \ |
| 76 | "nothing has changed; use --allow-empty to override"} |
| 77 | |
| 78 | ############################################################################### |
| 79 | |
| 80 | fossil ls |
| 81 | test symlinks-dir-5 {[normalize_result] eq ""} |
| 82 | |
| 83 | ############################################################################### |
| 84 | |
| 85 | fossil set allow |
| 86 | puts $RESULT |
| 87 | |
| 88 | fossil extras |
| 89 | test symlinks-dir-6 {[normalize_result] eq \ |
| 90 | "subdirA/f1.txt\nsubdirA/f2.txt\nsymdirA"} |
| 91 | |
| 92 | ############################################################################### |
| 93 | |
| 94 | fossil close |
| 95 | file delete [file join $rootDir subdirA f1.txt] |
| @@ -87,17 +99,17 @@ | |
| 99 | test symlinks-dir-9 {[file exists [file join $rootDir subdirA f2.txt]] eq 1} |
| 100 | test symlinks-dir-10 {[file exists [file join $rootDir symdirA f2.txt]] eq 1} |
| 101 | |
| 102 | ############################################################################### |
| 103 | |
| 104 | fossil open --force $repository |
| 105 | set code [catch {file readlink [file join $rootDir symdirA]} result] |
| 106 | |
| 107 | test symlinks-dir-11 {$code == 0} |
| 108 | test symlinks-dir-12 {$result eq [file join $rootDir subdirA]} |
| 109 | test symlinks-dir-13 {[file exists [file join $rootDir subdirA f1.txt]] eq 0} |
| 110 | test symlinks-dir-14 {[file exists [file join $rootDir symdirA f1.txt]] eq 0} |
| 111 | test symlinks-dir-15 {[file exists [file join $rootDir subdirA f2.txt]] eq 1} |
| 112 | test symlinks-dir-16 {[file exists [file join $rootDir symdirA f2.txt]] eq 1} |
| 113 | |
| 114 | ############################################################################### |
| 115 | # |
| 116 |