aspnet / dnx

OBSOLETE - see readme
Other
963 stars 224 forks source link

dnx crashes (System.IO.FileNotFoundException) on Linux if the home directory contains a broken symbolic link #2184

Closed jrg1381 closed 9 years ago

jrg1381 commented 9 years ago

If $HOME contains a symlink which points to a non-existent target, then running an application with dnx

jrg@absinthe:~/fizzbuzz$ dnx . run

crashes with this stack trace:

System.IO.FileNotFoundException: Could not find file '/home/jrg/ADTECH 1'.
File name: '/home/jrg/ADTECH 1'
   at Interop.CheckIo(Int64 result, String path, Boolean isDirectory, Func`2 errorRewriter)
   at System.IO.UnixFileSystem.FileSystemEnumerable`1.<Enumerate>d__2.MoveNext()
   at System.Linq.Enumerable.<ConcatIterator>d__1`1.MoveNext()
   at System.Linq.Enumerable.<SelectManyIterator>d__1`2.MoveNext()
   at System.Linq.Enumerable.<DistinctIterator>d__1`1.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Microsoft.Framework.Runtime.ProjectResolver.Initialize(String projectPath, String rootPath)
   at Microsoft.Framework.Runtime.ProjectResolver..ctor(String projectPath, String rootPath)
   at Microsoft.Framework.Runtime.ApplicationHostContext..ctor(IServiceProvider serviceProvider, String projectDirectory, String packagesDirectory, String configuration, FrameworkName targetFramework, ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheDependencyProvider, IAssemblyLoadContextFactory loadContextFactory, Boolean skipLockFileValidation)
   at Microsoft.Framework.Runtime.DefaultHost.Initialize(DefaultHostOptions options, IServiceProvider hostServices)
   at Microsoft.Framework.Runtime.DefaultHost..ctor(DefaultHostOptions options, IServiceProvider hostServices)
   at Microsoft.Framework.ApplicationHost.Program.Main(String[] args)

In this case, "ADTECH 1" is a symbolic link which points to an unmounted removable drive, but any broken soft link will do.

Removing the symlink fixed dnx, and adding a new broken one re-introduced the failure.

Repro: cd ~ ln -s dgdfgdfgg bogus

run dnx.

davidfowl commented 9 years ago

/cc @stephentoub Can you take a look at this?

stephentoub commented 9 years ago

Will do, thanks.

muratg commented 9 years ago

Closing as this is a CoreFX issue (Thanks @stephentoub for the fix!)