rename/21.t
https://github.com/pjd/pjdfstest/blob/c711b5f6b666579846afba399a998f74f60c488b/tests/rename/21.t#L26
expect 0 mkdir ${n2}/${n0} 0700
expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n0} ${n2}/${n1}
expect "0|EACCES" -u 65534 -g 65534 rename ${n2}/${n1} ${n2}/${n0}
rename/21.t renames ${n2}/${n0} to ${n2}/${n1} while it doesn't have write permission to ${n2}/${n0}. The result can be 0 or EACCES. However, if the filesystem returns EACCES, it will return ENOENT to the next test because ${n2}/${n1} doesn't exist. The test needs to remove and recreate the directory or allow ENOENT in the next test.
Are you saying that the rest of the test contained spurious failures? What OS and FS are you using?
I was writing a filesystem on Linux. There is a bug that messed up on the permission bits and failed a lot of tests. For rename/21.t, it passed the 1st rename with EACCES and failed the 2nd rename with ENOENT. I looked at the test and felt that the filesystem is doing things correctly. Later, I fixed the bug and passed the test.
My question is that if failure (EACCES) is allowed in the first rename, why the second rename cannot return ENOENT?
You're correct. The second rename on line 26 should allow ENOENT, if the first one failed. Would you care to submit a patch?