Skip to content
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

Closed
wants to merge 0 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Mar 11, 2021

Fixes: #36591

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Mar 11, 2021
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@Trott
Copy link
Member Author

Trott commented Mar 11, 2021

Still need to skip on SmartOS and possibly others. Putting into Draft until I get around to looking more closely.

@Trott Trott marked this pull request as draft March 11, 2021 16:57
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.
Copy link
Member

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.

Copy link
Member Author

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.

@Trott Trott marked this pull request as ready for review March 13, 2021 16:44
@Trott
Copy link
Member Author

Trott commented Mar 13, 2021

OK, this is ready for review.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

@Trott Trott added the wip Issues and PRs that are still a work in progress. label Mar 16, 2021
@Trott
Copy link
Member Author

Trott commented Mar 16, 2021

Labeling this wip pending resolution of #36591 (comment).

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@Trott Trott removed the wip Issues and PRs that are still a work in progress. label Mar 17, 2021
@Trott
Copy link
Member Author

Trott commented Mar 17, 2021

I think this is now ready for review. @targos @richardlau @mhdawson

@targos
Copy link
Member

targos commented Mar 17, 2021

sorry, the skip is not working correctly with my system and the test fails as before.

@targos
Copy link
Member

targos commented Mar 17, 2021

If it can help:

$ touch -t 204001020304 /tmp/y2k32-test

$ date -r /tmp/y2k32-test "+%Y%m%d%H%M"
203801190414

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@Trott

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`.
Copy link
Member

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

Copy link
Member

@targos targos Mar 17, 2021

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

Copy link
Member

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.

Copy link
Member Author

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.

@nodejs-github-bot

This comment has been minimized.

@Trott
Copy link
Member Author

Trott commented Mar 17, 2021

The IBM i check for Y2K38 support passed but the test failed when fs.utimesSync() threw with EINVAL. Since IBM i is not fully supported (yet?) and has lots of skipped tests, including the current version of this one, I'll go back to skipping-for-now in IBM i.

@Trott

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@targos
Copy link
Member

targos commented Mar 17, 2021

Current result on my machine:

$ node test/parallel/y2k38.js
1..0 # Skipped: File system appears to lack Y2k38 support (date failed)

@Trott
Copy link
Member Author

Trott commented Mar 17, 2021

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/

image

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

Trott added a commit to Trott/io.js that referenced this pull request Mar 18, 2021
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>
@Trott
Copy link
Member Author

Trott commented Mar 18, 2021

Landed in ab6c7dd

@Trott Trott closed this Mar 18, 2021
@Trott Trott deleted the fix-test-fs-utimes branch March 18, 2021 04:51
@richardlau
Copy link
Member

The IBM i check for Y2K38 support passed but the test failed when fs.utimesSync() threw with EINVAL. Since IBM i is not fully supported (yet?) and has lots of skipped tests, including the current version of this one, I'll go back to skipping-for-now in IBM i.

FWIW Just to follow this up... on IBM i process.platform === 'aix' (same as AIX), see

node/test/common/index.js

Lines 801 to 805 in d3417bb

// On IBMi, process.platform and os.platform() both return 'aix',
// It is not enough to differentiate between IBMi and real AIX system.
get isIBMi() {
return require('os').type() === 'OS400';
},

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.

ruyadorno pushed a commit that referenced this pull request Mar 20, 2021
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: #36591

PR-URL: #37707
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
jasnell pushed a commit that referenced this pull request Mar 22, 2021
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>
ruyadorno pushed a commit that referenced this pull request Mar 24, 2021
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>
@ruyadorno ruyadorno mentioned this pull request Mar 30, 2021
targos pushed a commit that referenced this pull request May 1, 2021
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: #36591

PR-URL: #37707
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
targos pushed a commit that referenced this pull request May 1, 2021
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>
@danielleadams danielleadams mentioned this pull request May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test-fs-utimes failing locally
5 participants