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

Can't run app that has a directory that ends in a dot #16162

Closed
steveharter opened this issue Feb 1, 2018 · 4 comments · Fixed by dotnet/runtime#459
Closed

Can't run app that has a directory that ends in a dot #16162

steveharter opened this issue Feb 1, 2018 · 4 comments · Fixed by dotnet/runtime#459

Comments

@steveharter
Copy link
Member

@steveharter steveharter commented Feb 1, 2018

Originally From @JingLMalan on November 14, 2017 3:21

Steps to reproduce

I install dotnet platform, and it succeed.
JingMalans-MacBook-Pro:myApp liangjingtang$ dotnet --version 2.0.2
First step: I create a new project:
dotnet new console -o myApp cd myApp
It also restores succeeded.
Then: I build this test project.
dotnet build
It also tells me that Build succeeded.
At last: I run it.
dotnet run
message:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly '/Users/liangjingtang/Documents/workspace/program/net./myApp/bin/Debug/netcoreapp2.0/myApp.dll'. The system cannot find the file specified.

What's the matter with it?

Expected behavior

Run

Actual behavior

Unhandled Exception

Environment data

dotnet --info output:
.NET Command Line Tools (2.0.2)

Product Information:
Version: 2.0.2
Commit SHA-1 hash: a04b4bf512

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/2.0.2/

Microsoft .NET Core Shared Framework Host

Version : 2.0.0
Build : e8b8861

Copied from original issue: dotnet/cli#8007
Also see: dotnet/core-setup#3410

@steveharter

This comment has been minimized.

Copy link
Member Author

@steveharter steveharter commented Feb 1, 2018

From @dasMulli on November 14, 2017 4:5

Seems to be reproducible for every built application when any directory in the hierarchy ends with a dot.

$ dotnet exec /Users/martin/tmp/net/tmp./testcons/bin/Debug/netcoreapp2.0/testcons.dll

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly '/Users/martin/tmp/net/tmp./testcons/bin/Debug/netcoreapp2.0/testcons.dll'. The system cannot find the file specified.

Abort trap: 6
@steveharter

This comment has been minimized.

Copy link
Member Author

@steveharter steveharter commented Feb 1, 2018

This appears to be a coreclr issue per the call stack:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib         0x00007fffa60c1d42 __pthread_kill + 10
1   libsystem_pthread.dylib       0x00007fffa61af457 pthread_kill + 90
2   libsystem_c.dylib             0x00007fffa6027420 abort + 129
3   libcoreclr.dylib               0x000000010616a35e PROCAbort + 14
4   libcoreclr.dylib               0x0000000106168ef2 PROCEndProcess(void*, unsigned int, int) + 226
5   libcoreclr.dylib               0x000000010623c16a CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*) + 746
6   libcoreclr.dylib               0x0000000106173104 coreclr_execute_assembly + 260
@jeffschwMSFT

This comment has been minimized.

Copy link
Member

@jeffschwMSFT jeffschwMSFT commented Feb 7, 2018

This feels like a much larger scenario, I tried a directory called '.tmp' and that then causes restore/build to fail with the following error:
Program.cs(3,11): error CS1001: Identifier expected [C:\temp\dotnetcore.tmp.tmp.csproj]

@lpereira

This comment has been minimized.

Copy link
Member

@lpereira lpereira commented May 23, 2019

This issue happens because FILEDosToUnixPathA() removes the trailing period before / when converting a DOS path to a Unix path. This seems to be correct according to the Path normalization doc, under Trimming characters:

If a segment ends in a single period, that period is removed.

Windows strips the trailing dot from path segments due to compatibility reasons (a file named "foo." is just "foo" as far as DOS is concerned because file names were stored in 8.3 format). In Unix, the file system does not have any concept of file extension, so "foo" and "foo." are different names.

My first reaction would be to junk the period-trimming-code from this function, but I don't know enough of the Windows environment to know what this could possibly negatively affect. (I know that I can't reproduce the issue anymore if the period-trimming-code is removed, though.)

mateoatr added a commit to dotnet/runtime that referenced this issue Dec 3, 2019
Run app that has a directory that ends in a dot (fix [#16162](dotnet/coreclr#16162)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.