ltp
ltp copied to clipboard
Off-by-one issue in inotify11?
Maybe I'm misreading the test, but is there any off-by-one issue in inotify11?
It looks like churn creates 10,000 files (CHURN_FILES + 1 being 10,000), because of the <= in for (i = 0; i <= CHURN_FILES; ++i). But then it also looks like verify_inotify has a possibility of completing after verifying only 9,999 files, because of the < in while (!opened && nevents < CHURN_FILES).
Am I understanding that correctly? I don't imagine that it has any effect on the outcome of the test - I suspect the test functions perfectly well catching the potential regressions it was meant to catch - but is it something to tidy up? It caught my attention with a "huh, that's interesting...".
It wouldn't break the test to read all 10,000 expected files, would it?
Looks like you are right, I suppose it would be cleaner to change the <= in the for loop to just <. @jankara what do you think?
Yeah, I agree. Let's use < CHURN_FILES uniformly.
@nathanielmanistaatgoogle can you send a patch?