Skip to content

Commit 6938b35

Browse files
committed
Merge branch 'ps/reftable-unit-test-nfs-workaround'
A unit test for reftable code tried to enumerate all files in a directory after reftable operations and expected to see nothing but the files it wanted to leave there, but was fooled by .nfs* cruft files left, which has been corrected. * ps/reftable-unit-test-nfs-workaround: reftable: fix tests being broken by NFS' delete-after-close semantics
2 parents 50b52ca + 0068aa7 commit 6938b35

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

reftable/stack_test.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ static int count_dir_entries(const char *dirname)
3838
return 0;
3939

4040
while ((d = readdir(dir))) {
41-
if (!strcmp(d->d_name, "..") || !strcmp(d->d_name, "."))
41+
/*
42+
* Besides skipping over "." and "..", we also need to
43+
* skip over other files that have a leading ".". This
44+
* is due to behaviour of NFS, which will rename files
45+
* to ".nfs*" to emulate delete-on-last-close.
46+
*
47+
* In any case this should be fine as the reftable
48+
* library will never write files with leading dots
49+
* anyway.
50+
*/
51+
if (starts_with(d->d_name, "."))
4252
continue;
4353
len++;
4454
}

0 commit comments

Comments
 (0)