0

I have question about how/when files on SAMBA are refreshed

I'm doing something like that:

me@server:~/test/application

me@server:~/test/application$ dotnet myapp.dll

Application prints hello world

now I'm removing folder application using Windows (it's connected via SAMBA) and I'm inserting there the same folder, at the same place with my new application inside.

now I'm going back to my Linux terminal (connected via SSH) which stays in the same path /test/application/ and using

dotnet myapp.dll

results in:

System.IO.FileNotFoundException: Unable to find the specified file.
   at Interop.Sys.GetCwdHelper(Byte* ptr, Int32 bufferSize)
   at Interop.Sys.GetCwd()
   at System.Environment.get_CurrentDirectory()
   at System.IO.Directory.GetCurrentDirectory()
   at Microsoft.DotNet.Cli.Utils.CommandResolver.TryResolveCommandSpec(ICommandResolverPolicy commandResolverPolicy, String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath, String applicationName)
   at Microsoft.DotNet.Cli.Utils.Command.Create(ICommandResolverPolicy commandResolverPolicy, String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath, String applicationName)
   at Microsoft.DotNet.Cli.Utils.Command.Create(String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath, String applicationName)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

It seems like something is wrong with my app, but

using ls to list files shows nothing - as if folder was empty,

But after doing cd .. and then cd application everything works properly (ls lists my files, app works properly)

Basically it requires "refreshing folder", but what's the reason of that under the hood?

Friend told me that there was something like "old folder session with previous disk INodes loaded"

  • Your friend is right. – Ipor Sircer Jan 29 at 11:44
2

In Linux or Unix you can delete a file or directory that is still opened by a process.

In your case the shell has still the old /test/application open as its current directory.

Via samba you have deleted all files and the directory entry application in the parent directory /test. The inode of this directory is still in use by the shell, and the shell passes this current directory to its child processes, e.g. ls. ls correctly lists no files because you have deleted them from the directory file that used to be /test/application.

When you use cd application in /test, the directory file /test is read which contains a new entry application pointing to the newly created /test/application.

See also https://stackoverflow.com/q/2028874/10622916

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.