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.

preben 2023-11-16 21:27 test-fixes-2.24
Commit d30cd073149436ddf289a4655908abaffdecf9f9f0da156e4b18a0b87b2f3f18
1 file changed +17 -5
--- test/symlinks.test
+++ test/symlinks.test
@@ -35,10 +35,13 @@
3535
require_no_open_checkout
3636
3737
###############################################################################
3838
3939
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
4043
4144
fossil test-th-eval --open-config {repository}
4245
set repository [normalize_result]
4346
4447
if {[string length $repository] == 0} {
@@ -62,22 +65,31 @@
6265
test symlinks-dir-2 {[file exists [file join $rootDir symdirA f1.txt]] eq 1}
6366
test symlinks-dir-3 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
6467
test symlinks-dir-4 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
6568
6669
fossil add [file join $rootDir symdirA f1.txt]
70
+test symlinks-skip-dir-traversal {[normalize_result] eq \
71
+"SKIP symdirA/f1.txt"}
72
+
6773
fossil commit -m "c1"
6874
75
+test symlinks-empty-commit {[normalize_result] eq \
76
+"nothing has changed; use --allow-empty to override"}
77
+
6978
###############################################################################
7079
7180
fossil ls
72
-test symlinks-dir-5 {[normalize_result] eq "symdirA/f1.txt"}
81
+test symlinks-dir-5 {[normalize_result] eq ""}
7382
7483
###############################################################################
84
+
85
+fossil set allow
86
+puts $RESULT
7587
7688
fossil extras
7789
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"}
7991
8092
###############################################################################
8193
8294
fossil close
8395
file delete [file join $rootDir subdirA f1.txt]
@@ -87,17 +99,17 @@
8799
test symlinks-dir-9 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
88100
test symlinks-dir-10 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
89101
90102
###############################################################################
91103
92
-fossil open $repository
104
+fossil open --force $repository
93105
set code [catch {file readlink [file join $rootDir symdirA]} result]
94106
95107
test symlinks-dir-11 {$code == 0}
96108
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}
99111
test symlinks-dir-15 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
100112
test symlinks-dir-16 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
101113
102114
###############################################################################
103115
#
104116
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button