public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] t_readdir_3: Allow EOF on ignore_error
@ 2026-01-04 10:28 Shahar Hochma
  2026-01-07  8:25 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Shahar Hochma @ 2026-01-04 10:28 UTC (permalink / raw)
  To: fstests; +Cc: 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.

Signed-off-by: Shahar Hochma <shaharhoch@gmail.com>
---
 src/t_readdir_3.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/t_readdir_3.c b/src/t_readdir_3.c
index 8f9bb326..5d7afddc 100644
--- a/src/t_readdir_3.c
+++ b/src/t_readdir_3.c
@@ -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);
 	}
-- 
2.52.0.351.gbe84eed79e-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] t_readdir_3: Allow EOF on ignore_error
  2026-01-04 10:28 [PATCH] t_readdir_3: Allow EOF on ignore_error Shahar Hochma
@ 2026-01-07  8:25 ` Christoph Hellwig
       [not found]   ` <CAHeNByfyTHSL-UHboz_8OtcdXDDfxA+BJ_awkVw3s_50c61e5g@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2026-01-07  8:25 UTC (permalink / raw)
  To: Shahar Hochma; +Cc: fstests

On Sun, Jan 04, 2026 at 12:28:16PM +0200, Shahar Hochma wrote:
> 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?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] t_readdir_3: Allow EOF on ignore_error
       [not found]   ` <CAHeNByfyTHSL-UHboz_8OtcdXDDfxA+BJ_awkVw3s_50c61e5g@mail.gmail.com>
@ 2026-01-07  8:41     ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-01-07  8:41 UTC (permalink / raw)
  To: Shahar Hochma; +Cc: Christoph Hellwig, fstests

On Wed, Jan 07, 2026 at 10:36:30AM +0200, Shahar Hochma wrote:
> 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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-07  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-04 10:28 [PATCH] t_readdir_3: Allow EOF on ignore_error Shahar Hochma
2026-01-07  8:25 ` Christoph Hellwig
     [not found]   ` <CAHeNByfyTHSL-UHboz_8OtcdXDDfxA+BJ_awkVw3s_50c61e5g@mail.gmail.com>
2026-01-07  8:41     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox