Fossil SCM

Detect where an OS (in this case probably Darwin) has already done a case mapping, using "fossil echo-test". Fix docs.

danshearer 2026-11-19 08:36 UTC test-suite-new
Commit cb01eaabfd97b051f7c45a0c7749b4a223f4a4fead40adc7e7ba9e035bbea0c9
+1 -1
--- test/README.md
+++ test/README.md
@@ -86,11 +86,11 @@
8686
8787
When a test finds a fault that is not yet fixed, add `knownBug` as the test's last argument, so that the suite still exits with status 0. A known bug that passes is reported as `OK (knownBug)?`. Don't forget to remove `knownBug` when you're sure the fault is fixed.
8888
8989
If the known bug is the exit status of a `fossil` command, add `-knownBug` to that command too. Otherwise the command prints an `ERROR` line on every run, even with `-quiet`. With `-knownBug` you only see that line under `-strict`.
9090
91
-A known bug should fail on every system. If the fault only shows up in some environments, have the test set up that environment itself. If a test needs something the system might not have, that's a requirement, so use `test_skip`.
91
+A test marked `knownBug` should fail on every system where it's marked. If the fault only shows up in some environments, have the test set up that environment itself. If Fossil really does behave differently on some system, as it does with decomposed pathnames on macOS, have the test check that behavior and leave the mark off there; don't test for the operating system's name. If a test needs something the system might not have, that's a requirement, so use `test_skip`.
9292
9393
Stray files in `test/` can be confusing because `delta1.test` and `merge2.test` run their tests on every file and the counts may differ from what is expected. A different total is not a failure.
9494
9595
Beware of global variables! If you must create a new global variable, be sure there isn't a collision with other files. Some future design should avoid this
9696
problem.
9797
--- test/README.md
+++ test/README.md
@@ -86,11 +86,11 @@
86
87 When a test finds a fault that is not yet fixed, add `knownBug` as the test's last argument, so that the suite still exits with status 0. A known bug that passes is reported as `OK (knownBug)?`. Don't forget to remove `knownBug` when you're sure the fault is fixed.
88
89 If the known bug is the exit status of a `fossil` command, add `-knownBug` to that command too. Otherwise the command prints an `ERROR` line on every run, even with `-quiet`. With `-knownBug` you only see that line under `-strict`.
90
91 A known bug should fail on every system. If the fault only shows up in some environments, have the test set up that environment itself. If a test needs something the system might not have, that's a requirement, so use `test_skip`.
92
93 Stray files in `test/` can be confusing because `delta1.test` and `merge2.test` run their tests on every file and the counts may differ from what is expected. A different total is not a failure.
94
95 Beware of global variables! If you must create a new global variable, be sure there isn't a collision with other files. Some future design should avoid this
96 problem.
97
--- test/README.md
+++ test/README.md
@@ -86,11 +86,11 @@
86
87 When a test finds a fault that is not yet fixed, add `knownBug` as the test's last argument, so that the suite still exits with status 0. A known bug that passes is reported as `OK (knownBug)?`. Don't forget to remove `knownBug` when you're sure the fault is fixed.
88
89 If the known bug is the exit status of a `fossil` command, add `-knownBug` to that command too. Otherwise the command prints an `ERROR` line on every run, even with `-quiet`. With `-knownBug` you only see that line under `-strict`.
90
91 A test marked `knownBug` should fail on every system where it's marked. If the fault only shows up in some environments, have the test set up that environment itself. If Fossil really does behave differently on some system, as it does with decomposed pathnames on macOS, have the test check that behavior and leave the mark off there; don't test for the operating system's name. If a test needs something the system might not have, that's a requirement, so use `test_skip`.
92
93 Stray files in `test/` can be confusing because `delta1.test` and `merge2.test` run their tests on every file and the counts may differ from what is expected. A different total is not a failure.
94
95 Beware of global variables! If you must create a new global variable, be sure there isn't a collision with other files. Some future design should avoid this
96 problem.
97
--- test/unicode-pathnames.test
+++ test/unicode-pathnames.test
@@ -30,10 +30,16 @@
3030
# With the setting off, fossil folds the ASCII letters and compares
3131
# every other byte as written, so the tests of names outside ASCII are
3232
# marked knownBug. Fossil also checks out, updates to and commits a
3333
# version that has two names for one file, so those tests are marked
3434
# knownBug for ASCII names too.
35
+#
36
+# On macOS Fossil converts every pathname from Apple's decomposed form
37
+# to NFC, so some of these pairs will end up normalised to the same name
38
+# before fossil gets to compare. "fossil test-echo" reliably detects this.
39
+# With case-sensitive on we expect to find the file, and with it off
40
+# we won't find the file, and it's an actual bug.
3541
#
3642
# Case folding maps both the sharp s, U+00DF, and the capital sharp s,
3743
# U+1E9E, to the two letters "ss", so by D145 a name with a sharp s and
3844
# the same name with "ss" are one file. ext4 with case folding folds
3945
# each sharp s to "ss" and has one file for the two names. NTFS and
@@ -49,11 +55,11 @@
4955
#
5056
set upSavedEncoding [encoding system]
5157
encoding system utf-8
5258
5359
# Returns NAME with each character outside ASCII written as a Tcl
54
-# escape, so that two spellings that look the same can be told apart.
60
+# escape, so that two spellings that look the same can be distinguished.
5561
#
5662
proc up_escape {name} {
5763
set escaped ""
5864
foreach char [split $name ""] {
5965
scan $char %c code
@@ -153,20 +159,38 @@
153159
fossil commit -m "one spelling of each pathname"
154160
155161
fossil ls
156162
test_eq unicode-pathnames-ls [lsort [split [normalize_result] \n]] \
157163
[lsort $upNames]
164
+
165
+# upConverted lists the pairs whose other spelling fossil converts to
166
+# the checked-in one when it reads its arguments. Each is one name to
167
+# fossil, so its tests with the setting off are not marked knownBug.
168
+#
169
+set upConverted [list]
170
+set upRows [list]
171
+foreach {label a b constraint} $upSame {
172
+ fossil test-echo $b
173
+ if {[string first "argv\[2\] = \[$a\]" $RESULT] >= 0} {
174
+ lappend upConverted $label
175
+ set constraint ""
176
+ }
177
+ lappend upRows $label $a $b $constraint
178
+}
179
+set upSame $upRows
158180
159181
# With the setting on, the other spelling is not a file under
160
-# management.
182
+# management, unless fossil converts it.
161183
#
162184
foreach {label a b constraint} $upSame {
163185
up_show $label $a $b
186
+ set converted [expr {$label in $upConverted}]
164187
fossil ls $b
165
- test_eq unicode-pathnames-on-$label-ls [normalize_result] ""
166
- fossil cat $b -expectError
167
- test_eq unicode-pathnames-on-$label-cat $CODE 1
188
+ test_eq unicode-pathnames-on-$label-ls [normalize_result] \
189
+ [expr {$converted ? $a : ""}]
190
+ fossil cat $b {*}[expr {$converted ? "" : "-expectError"}]
191
+ test_eq unicode-pathnames-on-$label-cat $CODE [expr {!$converted}]
168192
}
169193
170194
# With the setting off, "fossil ls", "fossil cat" and "fossil rm" find
171195
# the file by its other spelling.
172196
#
@@ -199,11 +223,11 @@
199223
# has two files for the two spellings.
200224
#
201225
set upOneFile [list]
202226
foreach {label a b constraint} $upSame {
203227
up_show $label $a $b
204
- if {[file exists $b]} {
228
+ if {[file exists $b] || $label in $upConverted} {
205229
lappend upOneFile $label
206230
continue
207231
}
208232
file mkdir [file dirname $b]
209233
write_file $b "other spelling\n"
@@ -219,11 +243,11 @@
219243
file delete [file dirname $b]
220244
}
221245
}
222246
if {[llength $upOneFile] > 0} {
223247
test_skip_part "extras and add tests of [join $upOneFile {, }]:\
224
- the file system has one file for both spellings"
248
+ fossil or the file system has one name for both spellings"
225249
}
226250
227251
###############################################################################
228252
#
229253
# A version made with the setting on has both spellings of a pathname.
@@ -247,11 +271,11 @@
247271
write_file $a "first spelling\n"
248272
write_file plain.txt "plain\n"
249273
fossil add $a plain.txt
250274
fossil commit -m "first spelling"
251275
set upFirst [up_new_version]
252
- if {[file exists $b]} {
276
+ if {[file exists $b] || $label in $upConverted} {
253277
lappend upOneFile $label
254278
continue
255279
}
256280
write_file $b "second spelling\n"
257281
fossil add $b
@@ -272,12 +296,12 @@
272296
test_eq unicode-pathnames-collide-$label-update-file [file exists $b] 0 \
273297
knownBug
274298
}
275299
if {[llength $upOneFile] > 0} {
276300
test_skip_part "commit and update tests of [join $upOneFile {, }]:\
277
- the file system has one file for both spellings"
301
+ fossil or the file system has one name for both spellings"
278302
}
279303
280304
###############################################################################
281305
282306
encoding system $upSavedEncoding
283307
test_cleanup
284308
--- test/unicode-pathnames.test
+++ test/unicode-pathnames.test
@@ -30,10 +30,16 @@
30 # With the setting off, fossil folds the ASCII letters and compares
31 # every other byte as written, so the tests of names outside ASCII are
32 # marked knownBug. Fossil also checks out, updates to and commits a
33 # version that has two names for one file, so those tests are marked
34 # knownBug for ASCII names too.
 
 
 
 
 
 
35 #
36 # Case folding maps both the sharp s, U+00DF, and the capital sharp s,
37 # U+1E9E, to the two letters "ss", so by D145 a name with a sharp s and
38 # the same name with "ss" are one file. ext4 with case folding folds
39 # each sharp s to "ss" and has one file for the two names. NTFS and
@@ -49,11 +55,11 @@
49 #
50 set upSavedEncoding [encoding system]
51 encoding system utf-8
52
53 # Returns NAME with each character outside ASCII written as a Tcl
54 # escape, so that two spellings that look the same can be told apart.
55 #
56 proc up_escape {name} {
57 set escaped ""
58 foreach char [split $name ""] {
59 scan $char %c code
@@ -153,20 +159,38 @@
153 fossil commit -m "one spelling of each pathname"
154
155 fossil ls
156 test_eq unicode-pathnames-ls [lsort [split [normalize_result] \n]] \
157 [lsort $upNames]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
159 # With the setting on, the other spelling is not a file under
160 # management.
161 #
162 foreach {label a b constraint} $upSame {
163 up_show $label $a $b
 
164 fossil ls $b
165 test_eq unicode-pathnames-on-$label-ls [normalize_result] ""
166 fossil cat $b -expectError
167 test_eq unicode-pathnames-on-$label-cat $CODE 1
 
168 }
169
170 # With the setting off, "fossil ls", "fossil cat" and "fossil rm" find
171 # the file by its other spelling.
172 #
@@ -199,11 +223,11 @@
199 # has two files for the two spellings.
200 #
201 set upOneFile [list]
202 foreach {label a b constraint} $upSame {
203 up_show $label $a $b
204 if {[file exists $b]} {
205 lappend upOneFile $label
206 continue
207 }
208 file mkdir [file dirname $b]
209 write_file $b "other spelling\n"
@@ -219,11 +243,11 @@
219 file delete [file dirname $b]
220 }
221 }
222 if {[llength $upOneFile] > 0} {
223 test_skip_part "extras and add tests of [join $upOneFile {, }]:\
224 the file system has one file for both spellings"
225 }
226
227 ###############################################################################
228 #
229 # A version made with the setting on has both spellings of a pathname.
@@ -247,11 +271,11 @@
247 write_file $a "first spelling\n"
248 write_file plain.txt "plain\n"
249 fossil add $a plain.txt
250 fossil commit -m "first spelling"
251 set upFirst [up_new_version]
252 if {[file exists $b]} {
253 lappend upOneFile $label
254 continue
255 }
256 write_file $b "second spelling\n"
257 fossil add $b
@@ -272,12 +296,12 @@
272 test_eq unicode-pathnames-collide-$label-update-file [file exists $b] 0 \
273 knownBug
274 }
275 if {[llength $upOneFile] > 0} {
276 test_skip_part "commit and update tests of [join $upOneFile {, }]:\
277 the file system has one file for both spellings"
278 }
279
280 ###############################################################################
281
282 encoding system $upSavedEncoding
283 test_cleanup
284
--- test/unicode-pathnames.test
+++ test/unicode-pathnames.test
@@ -30,10 +30,16 @@
30 # With the setting off, fossil folds the ASCII letters and compares
31 # every other byte as written, so the tests of names outside ASCII are
32 # marked knownBug. Fossil also checks out, updates to and commits a
33 # version that has two names for one file, so those tests are marked
34 # knownBug for ASCII names too.
35 #
36 # On macOS Fossil converts every pathname from Apple's decomposed form
37 # to NFC, so some of these pairs will end up normalised to the same name
38 # before fossil gets to compare. "fossil test-echo" reliably detects this.
39 # With case-sensitive on we expect to find the file, and with it off
40 # we won't find the file, and it's an actual bug.
41 #
42 # Case folding maps both the sharp s, U+00DF, and the capital sharp s,
43 # U+1E9E, to the two letters "ss", so by D145 a name with a sharp s and
44 # the same name with "ss" are one file. ext4 with case folding folds
45 # each sharp s to "ss" and has one file for the two names. NTFS and
@@ -49,11 +55,11 @@
55 #
56 set upSavedEncoding [encoding system]
57 encoding system utf-8
58
59 # Returns NAME with each character outside ASCII written as a Tcl
60 # escape, so that two spellings that look the same can be distinguished.
61 #
62 proc up_escape {name} {
63 set escaped ""
64 foreach char [split $name ""] {
65 scan $char %c code
@@ -153,20 +159,38 @@
159 fossil commit -m "one spelling of each pathname"
160
161 fossil ls
162 test_eq unicode-pathnames-ls [lsort [split [normalize_result] \n]] \
163 [lsort $upNames]
164
165 # upConverted lists the pairs whose other spelling fossil converts to
166 # the checked-in one when it reads its arguments. Each is one name to
167 # fossil, so its tests with the setting off are not marked knownBug.
168 #
169 set upConverted [list]
170 set upRows [list]
171 foreach {label a b constraint} $upSame {
172 fossil test-echo $b
173 if {[string first "argv\[2\] = \[$a\]" $RESULT] >= 0} {
174 lappend upConverted $label
175 set constraint ""
176 }
177 lappend upRows $label $a $b $constraint
178 }
179 set upSame $upRows
180
181 # With the setting on, the other spelling is not a file under
182 # management, unless fossil converts it.
183 #
184 foreach {label a b constraint} $upSame {
185 up_show $label $a $b
186 set converted [expr {$label in $upConverted}]
187 fossil ls $b
188 test_eq unicode-pathnames-on-$label-ls [normalize_result] \
189 [expr {$converted ? $a : ""}]
190 fossil cat $b {*}[expr {$converted ? "" : "-expectError"}]
191 test_eq unicode-pathnames-on-$label-cat $CODE [expr {!$converted}]
192 }
193
194 # With the setting off, "fossil ls", "fossil cat" and "fossil rm" find
195 # the file by its other spelling.
196 #
@@ -199,11 +223,11 @@
223 # has two files for the two spellings.
224 #
225 set upOneFile [list]
226 foreach {label a b constraint} $upSame {
227 up_show $label $a $b
228 if {[file exists $b] || $label in $upConverted} {
229 lappend upOneFile $label
230 continue
231 }
232 file mkdir [file dirname $b]
233 write_file $b "other spelling\n"
@@ -219,11 +243,11 @@
243 file delete [file dirname $b]
244 }
245 }
246 if {[llength $upOneFile] > 0} {
247 test_skip_part "extras and add tests of [join $upOneFile {, }]:\
248 fossil or the file system has one name for both spellings"
249 }
250
251 ###############################################################################
252 #
253 # A version made with the setting on has both spellings of a pathname.
@@ -247,11 +271,11 @@
271 write_file $a "first spelling\n"
272 write_file plain.txt "plain\n"
273 fossil add $a plain.txt
274 fossil commit -m "first spelling"
275 set upFirst [up_new_version]
276 if {[file exists $b] || $label in $upConverted} {
277 lappend upOneFile $label
278 continue
279 }
280 write_file $b "second spelling\n"
281 fossil add $b
@@ -272,12 +296,12 @@
296 test_eq unicode-pathnames-collide-$label-update-file [file exists $b] 0 \
297 knownBug
298 }
299 if {[llength $upOneFile] > 0} {
300 test_skip_part "commit and update tests of [join $upOneFile {, }]:\
301 fossil or the file system has one name for both spellings"
302 }
303
304 ###############################################################################
305
306 encoding system $upSavedEncoding
307 test_cleanup
308

Keyboard Shortcuts

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