Skip to contentSkip to conversation

t_readdir_3: Allow EOF on ignore_error

PATCH In review Shahar Hochma 2 participants 3 messages Jan 4 – Jan 7 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t_readdir_3: Allow EOF on ignore_error

ignore_error is used when providing random input to setpos. This can, by chance, produce a valid response from readdir, but with EOF. In which case, we don't want the test to fail.

---
 src/t_readdir_3.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/t_readdir_3.c +4 -2
index 8f9bb326..5d7afddc 100644
@@ -52,12 +52,12 @@ static void libc_getentry(struct dirent *entry)
 	errno = 0;
 	ret = readdir(dir);
 	if (!ret) {
+		if (ignore_error)
+			return;
 		if (errno == 0) {
 			fprintf(stderr, "Unexpected EOF while reading dir.\n");
 			exit(1);
 		}
-		if (ignore_error)
-			return;
 		perror("readdir");
 		exit(1);
 	}
@@ -92,6 +92,8 @@ static void kernel_getentry(struct dirent *entry)
 		exit(1);
 	}
 	if (ret == 0) {
+		if (ignore_error)
+			return;
 		fprintf(stderr, "Unexpected EOF while reading dir.\n");
 		exit(1);
 	}
Signature · 1 line
2.52.0.351.gbe84eed79e-goog
#1 lore raw
Quoted 3 lines · Shahar Hochma

ignore_error is used when providing random input to setpos. This can, by chance, produce a valid response from readdir, but with EOF. In which case, we don't want the test to fail.

Just curious: how did you run into this?

A message that is not in the archive (sent off-list or not yet received): CAHeNByfyTHSL-UHboz_8OtcdXDDfxA+BJ_awkVw3s_50c61e5g@mail.gmail.com

#3 lore raw
Quoted 3 lines · Shahar Hochma

I'm working on an NFS server solution and we use XFS tests as part of our CI. This test failed sporadically, and we found the issue while investing the failure.

Adding that you saw failures on NFS would be really useful. Especially as NFS vs setpos is pretty special in general.