FsAutoComplete icon indicating copy to clipboard operation
FsAutoComplete copied to clipboard

The specified file name or path is too long

Open seoushi opened this issue 2 years ago • 7 comments

I just ported my emacs setup to my m1 macbook pro which uses eglot and fsautocomplete for work with fsharp. While trying to find references it errors out and complains about the file path being too long. I'm not sure what file path it's trying but mine is even below the windows file path limit of 260 characters. In case it helps here is a link to the source code I'm trying it on https://seoushi.dynu.net/sean/inulang/-/blob/fsharp/inulang/inulang/Cli.fs . I've also seen this happen on my gentoo machine but it's not 100% as it is on my m1 macbook.

More Information: dotnet 6.0.302 fsautocomplete version 0.55.0+1fe4bb9fc5a7cedd00d35e34d347de2c74abe8b1

Here is the event log of the error from emacs. error.txt

seoushi avatar Jul 15 '22 02:07 seoushi

Oh this is very weird - that's way down in the compiler itself. The inputs to that are always null for the path name, so I'm not entirely sure where to go from there.

baronfel avatar Jul 15 '22 03:07 baronfel

Based on a cursory look you may be hitting this branch of the unix-specific memory-mapped file code: https://github.com/dotnet/runtime/blob/main/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs#L246-L267

Do you have a way of finding what SHM_NAME_MAX is on your system?

baronfel avatar Jul 15 '22 04:07 baronfel

I couldn't find a straight forward way to find that information so I wrote a small c program with shm_open and from trial and error it looks like the max is 31.

seoushi avatar Jul 15 '22 04:07 seoushi

I think the fix for SHM_NAME_MAX on macOS was only fixed for dotnet/7:

  • https://github.com/dotnet/runtime/pull/68541#event-6626719635

I don't see the changes getting merged to the 6.0 branch:

  • https://github.com/dotnet/runtime/blob/release/6.0/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Unix.cs

razzmatazz avatar Jul 15 '22 05:07 razzmatazz

Good call, can you try installing a .net 7 preview and running FSAC with it? It should just work.

baronfel avatar Jul 15 '22 11:07 baronfel

I tried using dotnet 7.0.100 and while it no longer throws exceptions no results are given. Finding reference or definitions returns.

Messages

user-error: No definitions found for: LSP identifier at point [2 times]
user-error: No references found for: LSP identifier at point

Eglot Events

[client-request] (id:68) Fri Jul 15 08:19:48 2022:
(:jsonrpc "2.0" :id 68 :method "textDocument/definition" :params
          (:textDocument
           (:uri "file:///Users/sean/repos/inulang/inulang/inulang/Ast.fs")
           :position
           (:line 38 :character 32)))
[server-reply] (id:68) Fri Jul 15 08:19:48 2022:
(:jsonrpc "2.0" :id 68 :result nil)

dotnet 6.0 at least worked with finding the definition so I will be returning to that. Given this is a dotnet issue feel free to close this issue. I recommend adding something in the readme for other mac m1 users tho. Thanks for all the help!

seoushi avatar Jul 15 '22 15:07 seoushi

I can look into if there's something critical we fail with on 7.0.100 previews in the meantime.

baronfel avatar Jul 21 '22 19:07 baronfel