From: Vadim Zhestikov Date: Wed, 29 Jul 2026 21:52:06 +0000 (-0700) Subject: Test262: accept ENOTEMPTY and EEXIST in fs/rename.t.mjs X-Git-Tag: 1.0.1~23 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=f109134d50ccdd7e18769376b0eff35664dd3c2b;p=njs.git Test262: accept ENOTEMPTY and EEXIST in fs/rename.t.mjs Renaming a regular file onto an existing directory is permitted by POSIX to fail with EISDIR, ENOTDIR, ENOTEMPTY or EEXIST, and the exact errno depends on the kernel and filesystem. The test only accepted ENOTDIR and EISDIR, so it began failing on the ubuntu-26.04 CI runners whose newer kernel returns ENOTEMPTY (or EEXIST) for this case. Accept ENOTEMPTY and EEXIST in all three variants (sync, callback and promise based) to make the test robust across kernels while still rejecting genuinely unexpected errors. --- diff --git a/test/fs/rename.t.mjs b/test/fs/rename.t.mjs index 104b4a5b..ad93e25a 100644 --- a/test/fs/rename.t.mjs +++ b/test/fs/rename.t.mjs @@ -25,7 +25,8 @@ var testSync = () => new Promise((resolve, reject) => { } catch (e) { if (e.syscall != 'rename' - || (e.code != 'ENOTDIR' && e.code != 'EISDIR')) + || (e.code != 'ENOTDIR' && e.code != 'EISDIR' + && e.code != 'ENOTEMPTY' && e.code != 'EEXIST')) { reject(new Error('fs.unlinkSync error 1')); } @@ -56,7 +57,8 @@ var testCallback = () => new Promise((resolve, reject) => { fs.rename(fname_utf8(dname), dname, err => { if (err.syscall != 'rename' - || (err.code != 'ENOTDIR' && err.code != 'EISDIR')) + || (err.code != 'ENOTDIR' && err.code != 'EISDIR' + && err.code != 'ENOTEMPTY' && err.code != 'EEXIST')) { reject(new Error('fs.unlink error 2')); } @@ -84,7 +86,8 @@ let testFsp = () => Promise.resolve() .then(() => fsp.rename(fname_utf8(dname), dname)) .catch(e => { if (e.syscall != 'rename' - || (e.code != 'ENOTDIR' && e.code != 'EISDIR')) + || (e.code != 'ENOTDIR' && e.code != 'EISDIR' + && e.code != 'ENOTEMPTY' && e.code != 'EEXIST')) { throw new Error('fsp.rename error 1'); }