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

Building from NFS: The last access/last write time on file cannot be set #13808

Open
emmenlau opened this issue Sep 24, 2020 · 14 comments
Open
Labels
area-Host untriaged Request triage from a team member
Milestone

Comments

@emmenlau
Copy link

I'm working with sources on an NFS mapped drive on Windows 10 2004. The drive is mapped with the Microsoft Windows NFSv3 client. User and group IDs are mapped to the correct Linux server user/group IDs. I can read and write from the drive without problems.

But when I try to build a .NET Core 3.1 project with dotnet 3.1.402, the build fails very early with error:

C:\Program Files\dotnet\sdk\3.1.402\Microsoft.Common.CurrentVersion.targets(4385,5): error MSB3374: The last access/last write time on file "U:\Source\thrift\lib\netstd\Tests\Thrift.PublicInterfaces.Compile.Tests\obj\cygwin\Debug\netcoreapp3.1\Thrift.PublicInterfaces.Compile.Tests.csproj.CopyComplete" cannot be set. The parameter is incorrect. : 'U:\Source\thrift\lib\netstd\Tests\Thrift.PublicInterfaces.Compile.Tests\obj\cygwin\Debug\netcoreapp3.1\Thrift.PublicInterfaces.Compile.Tests.csproj.CopyComplete' [U:\Source\thrift\lib\netstd\Tests\Thrift.PublicInterfaces.Compile.Tests\Thrift.PublicInterfaces.Compile.Tests.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018: The "CreateAppHost" task failed unexpectedly. [U:\Source\thrift\lib\netstd\Tests\Thrift.IntegrationTests\Thrift.IntegrationTests.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018: System.IO.IOException: The parameter is incorrect. : 'U:\Source\thrift\lib\netstd\Tests\Thrift.IntegrationTests\obj\cygwin\Debug\netcoreapp3.1\Thrift.IntegrationTests.exe' [U:\Source\thrift\lib\netstd\Tests\Thrift.IntegrationTests\Thrift.IntegrationTests.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.FileSystem.SetLastWriteTime(String fullPath, DateTimeOffset time, Boolean asDirectory) [U:\Source\thrift\lib\netstd\Tests\Thrift.IntegrationTests\Thrift.IntegrationTests.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.File.SetLastWriteTimeUtc(String path, DateTime lastWriteTimeUtc) [U:\Source\thrift\lib\netstd\Tests\Thrift.IntegrationTests\Thrift.IntegrationTests.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.HostModel.RetryUtil.RetryOnIOError(Action func) [U:\Source\thrift\lib\netstd\Tests\Thrift.IntegrationTests\Thrift.IntegrationTests.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [U:\Source\thrift\lib\netstd\Tests\Thrift.IntegrationTests\Thrift.IntegrationTests.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [U:\Source\thrift\lib\netstd\Tests\Thrift.IntegrationTests\Thrift.IntegrationTests.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018: The "CreateAppHost" task failed unexpectedly. [U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\Thrift.Benchmarks.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018: System.IO.IOException: The parameter is incorrect. : 'U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\obj\cygwin\Debug\netcoreapp3.1\Thrift.Benchmarks.exe' [U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\Thrift.Benchmarks.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.FileSystem.SetLastWriteTime(String fullPath, DateTimeOffset time, Boolean asDirectory) [U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\Thrift.Benchmarks.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at System.IO.File.SetLastWriteTimeUtc(String path, DateTime lastWriteTimeUtc) [U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\Thrift.Benchmarks.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.HostModel.RetryUtil.RetryOnIOError(Action func) [U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\Thrift.Benchmarks.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost(String appHostSourceFilePath, String appHostDestinationFilePath, String appBinaryFilePath, Boolean windowsGraphicalUserInterface, String assemblyToCopyResorcesFrom) [U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\Thrift.Benchmarks.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore() [U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\Thrift.Benchmarks.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() [U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\Thrift.Benchmarks.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\Thrift.Benchmarks.csproj]
C:\Program Files\dotnet\sdk\3.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(424,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [U:\Source\thrift\lib\netstd\Benchmarks\Thrift.Benchmarks\Thrift.Benchmarks.csproj]

I can understand from the error that .NET tries to update a time stamp, and this seems to fail. But I assume that time stamp updates are possible on NFS mapped drives because I can see correct file creation time stamps. Or is there something fundamental broken?

@scalablecory scalablecory transferred this issue from dotnet/core Sep 24, 2020
@marcpopMSFT marcpopMSFT added the untriaged Request triage from a team member label Oct 8, 2020
@zerovian
Copy link

zerovian commented Oct 28, 2020

Also running into this on an NFS mounted drive:

dotnet_install\dotnetcore\3.1.403\sdk\3.1.403\Microsoft.Common.CurrentVersion.targets(4385,5): error MSB3374: The last access/last write time on file "project.csproj.CopyComplete" cannot be set. The parameter is incorrect. : 'project\obj\x64\Debug\netstandard2.0\project.csproj.CopyComplete' [.csproj]
780 Warning(s)
1 Error(s)

this is causing my builds to fail and I cannot migrate my library to .net core.

$> dotnet --version
3.1.403

running this inside a cygwin shell on an NFS mounted drive.

@zerovian
Copy link

zerovian commented Oct 28, 2020

Please note that my project is hosted in a clearcase VOB mounted on Windows.

In case it helps this is how the drive shows up using 'mount' command from cygwin. I'm running dotnet under cygwin shell as most of our build scripts are cross platform we use cygwin on windows.

Z: on /cygdrive/z type mvfs (binary,noacl,posix=0,noumount,auto)

@zerovian
Copy link

zerovian commented Oct 28, 2020

Running with -v diag shows this:


                             bin\x64\Debug\netstandard2.0\zh-TW\Progress.Messages.resources.dll
                             bin\x64\Debug\netstandard2.0\zh\Progress.Messages.resources.dll (TaskId:58)
                   Done executing task "Copy". (TaskId:58)
                   Using "Touch" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
                   Task "Touch" (TaskId:59)
                     Task Parameter:Files=Z:\vobs_prgs\src\dotnet\o4glrt\obj\x64\Debug\netstandard2.0\o4glrt.csproj.CopyComplete (TaskId:59)
                     Task Parameter:AlwaysCreate=True (TaskId:59)
                     Touching "Z:\vobs_prgs\src\dotnet\o4glrt\obj\x64\Debug\netstandard2.0\o4glrt.csproj.CopyComplete". (TaskId:59)
14:14:24.140   1:7>\\rdlserv\tools\nt64\dotnetcore\3.1.403\sdk\3.1.403\Microsoft.Common.CurrentVersion.targets(4385,5): error MSB3374: The last access/last write time on file "Z:\vobs_prgs\src\dotnet\o4glrt\obj\x64\Debug\netstandard2.0\o4glrt.csproj.CopyComplete" cannot be set. The parameter is incorrect. : 'Z:\vobs_prgs\src\dotnet\o4glrt\obj\x64\Debug\netstandard2.0\o4glrt.csproj.CopyComplete' [Z:\vobs_prgs\src\dotnet\o4glrt\o4glrt.csproj]
                   Done executing task "Touch" -- FAILED. (TaskId:59)

@flecmart
Copy link

Running into the same problem using a clear case vob. Did you make some progress?

@zerovian
Copy link

Our solution was to set the IntermediateOutputPath property in the top level PropertyGroup section of each of our .csproj files.

Something like this, and we ensure that TMPDIR and USER environment variables are setup in our build environments. Its a workaround, but not a solution.

<IntermediateOutputPath>$(TMPDIR)/$(USER)/project/obj</IntermediateOutputPath>

@flecmart
Copy link

Thanks for the workaround. I can confirm that it works when you move the IntermediateOutputPath to a local path.

The strange thing is that the solution builds from inside vs studio 2019 (with IntermediateOutputPath on clearcase).

@zerovian
Copy link

Yup. same. doesn't fail when built in visual studio. only from command line.

@marcpopMSFT
Copy link
Member

Does this still repro with current SDKs? CC @vitek-karas @elinor-fung

@smx-smx
Copy link

smx-smx commented Nov 19, 2023

I can reproduce with dotnet SDK 8.0.100 on a NFS share

C:\Program Files\dotnet\sdk\8.0.100\Microsoft.Common.CurrentVersion.targets(4933,5): error MSB3374: The last access/las
t write time on file "<csproj file here>CopyComplete
" cannot be set. The parameter is incorrect. : '<csproj file here>.CopyComplete' [<csproj file here>]

However a touch command from msys/cygwin on NFS works, so i'm not sure why it's not working here.
Not sure if it helps, but i found this while searching for the problem: mono/mono#14089

@danmoseley
Copy link
Member

Can someone confirm that SetLastWriteTime in 8.0 fails against NFS? If so please ensure there is an issue open in dotnet/runtime to make it work, or at least fail with a better message.

@smx-smx
Copy link

smx-smx commented Nov 22, 2023

mount NFS

mount [remote] T:
T: is now successfully connected to [remote]

source code

Console.WriteLine("Hello, dotnet " + Environment.Version);

var t = DateTime.Now.Subtract(TimeSpan.FromDays(1));
System.IO.File.SetLastWriteTime(@"T:\thefile.txt", t);

output

Hello, dotnet 8.0.0
Unhandled exception. System.IO.IOException: The parameter is incorrect. : 'T:\thefile.txt'
   at System.IO.FileSystem.SetFileTime(SafeFileHandle fileHandle, String fullPath, Int64 creationTime, Int64 lastAccessTime, Int64 lastWriteTime, Int64 changeTime, UInt32 fileAttributes)
   at System.IO.FileSystem.SetFileTime(String fullPath, Boolean asDirectory, Int64 creationTime, Int64 lastAccessTime, Int64 lastWriteTime, Int64 changeTime, UInt32 fileAttributes)
   at System.IO.FileSystem.SetLastWriteTime(String fullPath, DateTimeOffset time, Boolean asDirectory)
   at System.IO.File.SetLastWriteTime(String path, DateTime lastWriteTime)
   at Program.<Main>$(String[] args) in G:\projects\nfs-issue\Program.cs:line 4

@virzak
Copy link

virzak commented Feb 17, 2024

This also happens when trying to build in podman in rootless mode. The IntermediateOutputPath workaround mentioned above is great, but setting /P:IntermediateOutputPath=/tmp/$USER/project/obj/ every time is annoying, and editing the project file is not desired

@zerovian
Copy link

This also happens when trying to build in podman in rootless mode. The IntermediateOutputPath workaround mentioned above is great, but setting /P:IntermediateOutputPath=/tmp/$USER/project/obj/ every time is annoying, and editing the project file is not desired

we ended up creating a Directory.build.props file in the dir above the projects so we dont have to edit all the .csproj files. it contains just this setting and one other.

@virzak
Copy link

virzak commented Feb 17, 2024

creating a Directory.build.props

Doing the same thing now:

<PropertyGroup Condition="'$(container)' == 'podman'">
  <IntermediateOutputPath>/tmp/$(USER)/project/obj/</IntermediateOutputPath>
</PropertyGroup>

virzak added a commit to zompinc/efcore-extensions that referenced this issue Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Host untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

8 participants