-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
File.SetLastAccessTimeUtc on Ubuntu is only up to seconds #26964
Comments
@Anipik could you please take a look when you free up? |
yep I will take a look at it sometime next week :) |
I'll set the milestone to 2.1.x for now. |
Ugh, I see the comment shows the problem -- when fixing, please help check that we don't have anywhere else in CoreFX/CoreCLR that does not set milliseconds. For a start we should not use utime anywhere we can use utimensat or utimes. private void SetAccessWriteTimes(string path, long? accessTime, long? writeTime)
{
// force a refresh so that we have an up-to-date times for values not being overwritten
_fileStatusInitialized = -1;
EnsureStatInitialized(path);
Interop.Sys.UTimBuf buf;
// we use utime() not utimensat() so we drop the subsecond part
buf.AcTime = accessTime ?? _fileStatus.ATime;
buf.ModTime = writeTime ?? _fileStatus.MTime;
Interop.CheckIo(Interop.Sys.UTime(path, ref buf), path, InitiallyDirectory);
_fileStatusInitialized = -1;
} |
It looks like this impact large project solution builds. Currently Ubuntu takes 2 times of time to build incrementally than Windows |
yeah it will be an improvement. I will post the numbers when I put the PR to fix this |
I am able to make it work using @wli3 can you confirm that following is the required output ?
|
@Anipik yes, this looks good |
@danmosemsft its fixed in master, do we want it to go for release branch |
Thanks @Anipik you're the file timestamp expert now. Yes, please add the template to this issue, create the port PR, and send mail to the usual alias per the procedure in my email and while back. |
Thanks :) I will do that |
Shiproom templateDescriptionCurrently, when we set the LastAccessTime or LastModifiedTime of the files on Unix, the millisecond/micrososecond/nanosecond attribute of the timestamp of the file is always set to zero. Customer ImpactThe customers will be able to set Last Access Time or Last Modified Time in Unix to nanosecond granularity. Regression?Not a Regression RiskLow risk because this change is already in master. |
Approved for 2.1.5. |
Updated the template with performance numbers |
Fixed in 3.0 in PR dotnet/corefx#31522 (setting milestone accordingly & closing). Note: The 2.1.x port was rejected - see PR dotnet/corefx#31569. |
Similar to https://github.com/dotnet/corefx/issues/26024 but for write
This blocks using msbuild incremental build. Especially when using MemoryMappedFile, LastWriteTime will not be set automatically
on Ubuntu
file_change_lastaccess has SetLastAccessTimeUtc after file_reference is created. But end up easier than file_reference. And clearly, the ticks are rounded.
on Windows it is correct
The text was updated successfully, but these errors were encountered: