Skip to content

Fix invalid atime being set #53

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

Merged
merged 1 commit into from
Nov 21, 2021

Conversation

jrjohnson
Copy link
Contributor

What Changed & Why

It's not super clear from the node docs, but it appears that the value
of atime needs to be in seconds since the eppoc, but Date.now returns milliseconds
which sets the timestamp far into the future. This causes node tar to
die when it attempts to encode this time and finds a very large integer.

We can also pass a Date object directly here so that's what I've done.

This could also copy the access time in the same way we copy the modified time, but it seems better to set it to the created time instead. I'm happy to go either way though.

Related issues

Link to related issues in this or other repositories (if any)

PR Checklist

  • Add tests

People

@avdv @lukemelia

It's not super clear from the node docs, but it appears that the value
of atime needs to be in seconds since the eppoc, but Date.now returns milliseconds
which sets the timestamp far into the future. This causes node tar to
die when it attempts to encode this time and finds a very large integer.

We can also pass a Date object directly here so that's what I've done.
Copy link
Contributor

@avdv avdv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I would never have guessed that Date.now() returns a number, and I can see no hint in the official docs as to what precision utimes expects if given a number instead of a Date or String...

@lukemelia lukemelia added the bug label Nov 21, 2021
Copy link
Collaborator

@lukemelia lukemelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @jrjohnson. Great job on the tests!

@lukemelia lukemelia merged commit 52a0e4b into ember-cli-deploy:master Nov 21, 2021
@jrjohnson jrjohnson deleted the atime-fix branch November 22, 2021 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants