-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fix test-fs-utimes on non-Y2K38 file systems #37707
Conversation
Still need to skip on SmartOS and possibly others. Putting into Draft until I get around to looking more closely. |
test/parallel/test-fs-utimes.js
Outdated
const Y2K38_mtime = 2 ** 31; | ||
fs.utimesSync(path, Y2K38_mtime, Y2K38_mtime); | ||
const Y2K38_stats = fs.statSync(path); | ||
assert.strictEqual(Y2K38_stats.mtime.getTime() / 1000, Y2K38_mtime); | ||
const mtimeStamp = Y2K38_stats.mtime.getTime() / 1000; | ||
// Off-by-one value is permissible for file systems that don't support Y2K38. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think skipping as was done before it better. The sets it to off by one, so allowing off by one is the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous skipped platforms are a separate issue that I was optimistically hoping this change would fix. If we dont allow the max - 1 value, then we need to skip all Linux hosts.
I think the thing to do is restore the previous skipped platforms and allow max - 1.
f64b2f5
to
9b7fe78
Compare
OK, this is ready for review. |
This comment has been minimized.
This comment has been minimized.
Labeling this |
fd75a40
to
d6544ac
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I think this is now ready for review. @targos @richardlau @mhdawson |
sorry, the skip is not working correctly with my system and the test fails as before. |
If it can help:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
if (!common.isWindows) { | ||
// Check for Y2K38 support. For Windows and AIX, assume it's there. Windows | ||
// doesn't have `touch` and `date -r` which are used in the check for support. | ||
// AIX lacks `date -r`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Non-blocking observation.)
FWIW I believe GNU date
is available via the coreutils
package from the AIX toolbox but we don't currently have that installed on our CI hosts.
It is correct that the native date
command doesn't support the -r
option: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/d_commands/date.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about stat -c '%Y'
?
Edit: updated to %Y
On my machine, it returns 2147483647, wich corresponds to 2038-01-19T03:14:07.000Z
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AIX doesn't natively have stat
but does have istat
: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/i_commands/istat.html
Like GNU date
, the GNU version of stat
looks to be available in the coreutils
AIX toolbox package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On macOS:
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
If there's something that will work on AIX, we can have a separate AIX path to do the check. Ditto for Windows. But I think those can also be added at a later date.
This comment has been minimized.
This comment has been minimized.
The IBM i check for Y2K38 support passed but the test failed when |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Current result on my machine:
|
Helps to push your changes before running the test.... IBM i test to confirm skip logic: https://ci.nodejs.org/job/node-test-commit-ibmi/298/ ✅ |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Move Y2K38-specific parts of test-fs-utimes to test-fs-utimes-y2K38.js. On non-Windows, check for Y2K38 support and skip if it is unsupported. Fixes: nodejs#36591 PR-URL: nodejs#37707 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
2ff6e74
to
8d2095e
Compare
Landed in ab6c7dd |
8d2095e
to
ab6c7dd
Compare
FWIW Just to follow this up... on IBM i Lines 801 to 805 in d3417bb
so common.isAIX is true and the check for Y2k38 support skipped. If I remove the check for common.isAIX , the Y2K38 support check fails (as expected) on IBM i.
|
On some platforms `date` may not support the `-r` option. Optimistically allow the test to proceed in that case as the previous `touch` had succeeded -- we were just not able to easily validate the file date. PR-URL: #37825 Refs: #37707 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
On some platforms `date` may not support the `-r` option. Optimistically allow the test to proceed in that case as the previous `touch` had succeeded -- we were just not able to easily validate the file date. PR-URL: #37825 Refs: #37707 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
On some platforms `date` may not support the `-r` option. Optimistically allow the test to proceed in that case as the previous `touch` had succeeded -- we were just not able to easily validate the file date. PR-URL: #37825 Refs: #37707 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Fixes: #36591