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

cp -p not preserving date and time #1939

Closed
cmendl opened this issue Apr 17, 2017 · 6 comments · Fixed by JuliaLang/julia#28000
Closed

cp -p not preserving date and time #1939

cmendl opened this issue Apr 17, 2017 · 6 comments · Fixed by JuliaLang/julia#28000
Assignees

Comments

@cmendl
Copy link

cmendl commented Apr 17, 2017

Microsoft Windows [Version 10.0.14393]

Copying files using cp -p does not retain date of source file (on Windows filesystem)

user@SCHORSCH:/mnt/c/tmp$ cp -p foo.txt foe.txt
user@SCHORSCH:/mnt/c/tmp$ ls -la
total 28
drwxrwxrwx 2 root root 0 Apr 17 14:17 .
drwxrwxrwx 2 root root 0 Apr 17 14:16 ..
-rwxrwxrwx 1 root root 7 Apr 17 14:17 foe.txt
-rwxrwxrwx 1 root root 7 Apr 17 14:16 foo.txt

Copied file "foe.txt" should have date and time of source file "foo.txt", but instead gets assigned current time.

@stehufntdev
Copy link
Collaborator

Are you seeing the same behavior in lxfs (e.g. root directory) or just in drvfs? IIRC, we recently found an issue with drvfs timestamps but I'll double check.

@cmendl
Copy link
Author

cmendl commented Apr 18, 2017

I'm seeing the issue only when copying files within the windows filesystem; cp -p works as expected within my home directory of the bash shell, and also when copying a file form the windows filesystem into my home directory.

Chris

@SvenGroot
Copy link
Member

This is due to the way that Windows updates timestamps, which it only does when the handle closes. When you use "cp -p" it opens the target file, writes to it, sets the timestamp, then closes it. Setting the timestamp doesn't use the same handle due to our VFS design, so when the file is closed Windows updates the timestamp again because that handle was written to.

We're working on ways to mitigate this issue.

@sunjoong
Copy link

sunjoong commented Apr 28, 2017

@SvenGroot - Because make is a timestamp based utility, it would make problems. I hope it will be fixed soon.

@jstarks
Copy link
Member

jstarks commented Dec 19, 2017

This should be fixed in insider build 17063.

@michael-ts
Copy link

@jstarks I'm seeing this bug in the WSL(2) in Windows 10, however the issue is that while the seconds part of the timestamp is preserved, the milliseconds part is zeroed out in the destination file.

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

Successfully merging a pull request may close this issue.

7 participants