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

[fs] MacOs : flaky copy test #421

Closed
zekth opened this issue May 20, 2019 · 2 comments
Closed

[fs] MacOs : flaky copy test #421

zekth opened this issue May 20, 2019 · 2 comments

Comments

@zekth
Copy link
Contributor

zekth commented May 20, 2019


test [fs] copy synchronously with preserve timestamps ... ‌FAILED‌
Error: 

    ‌[Diff]‌ ‌Left‌ / ‌Right‌


-   1558364063‌
+   1558364062‌

    at assertEquals (/Users/vsts/agent/2.150.3/work/1/s/testing/pretty.ts:66:11)
    at assertEquals (/Users/vsts/agent/2.150.3/work/1/s/testing/asserts.ts:64:5)
    at /Users/vsts/agent/2.150.3/work/1/s/fs/copy_test.ts:185:5
    at fn (/Users/vsts/agent/2.150.3/work/1/s/fs/copy_test.ts:32:13)
    at runTestsSerial (/Users/vsts/agent/2.150.3/work/1/s/testing/mod.ts:112:19)
    at async runTests (/Users/vsts/agent/2.150.3/work/1/s/testing/mod.ts:147:9)
    at async main (/Users/vsts/agent/2.150.3/work/1/s/testing/main.ts:5:5)

Sometimes it happens randomly on MacOs.

cc @axetroy

@axetroy
Copy link
Contributor

axetroy commented May 20, 2019

This should be a bug for Deno.utime

Loss of precision when changing timestamps using Deno.utime

@axetroy
Copy link
Contributor

axetroy commented May 20, 2019

I tried it, deno.stat() does not change the file's accessed attribute.

So whenever you access, you get consistent properties.

Let's try

// a.ts
const s = Deno.statSync('./test.ts');

console.log(s.created, s.accessed, s.modified);
> deno run --allow-all a.ts
1558369133 1558369638 1558369133
> deno run --allow-all a.ts
1558369133 1558369638 1558369133
> deno run --allow-all a.ts
1558369133 1558369638 1558369133
> deno run --allow-all a.ts
1558369133 1558369638 1558369133

Source Code

https://github.com/denoland/deno_std/blob/301c12d9d20d94d0ed36a394353835a90b5e9249/fs/copy.ts#L87-L94

Conclusion

I guess the problem does not appear in the copy module, but in Deno.utime()

inverted-capital pushed a commit to dreamcatcher-tech/napps that referenced this issue Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants