Closed sekunho closed 2 years ago
thanks for reporting the issue have those directories something special: filesystem, perms, hard links?
How come 1.5 requires hie.yaml while 1.2 doesn't?
hie.yaml should not be necessary so it is a bug probably related with the hie-bios library
//cc @fendor
have those directories something special: filesystem, perms, hard links?
How do I check for this?
hmm ls -la
and df .
in ~/Projects/foo
? i am not a linux expert though
Ah got it.
[sekun@nixos:~/Projects/foo]$ ls -la
total 76
drwxr-xr-x 7 sekun users 4096 Nov 25 15:12 .
drwxr-xr-x 7 sekun users 4096 Nov 25 11:39 ..
-rw-r--r-- 1 sekun users 115 Nov 25 11:58 CHANGELOG.md
drwxr-xr-x 3 sekun users 4096 Nov 25 15:12 .direnv
drwxr-xr-x 6 sekun users 4096 Nov 25 12:01 dist-newstyle
-rw-r--r-- 1 sekun users 10 Nov 25 15:12 .envrc
-rw-r--r-- 1 sekun users 992 Nov 25 15:01 flake.lock
-rw-r--r-- 1 sekun users 696 Nov 25 15:11 flake.nix
drwxr-xr-x 8 sekun users 4096 Nov 25 15:11 .git
-rw-r--r-- 1 sekun users 293 Nov 25 11:48 .gitignore
-rw-r--r-- 1 sekun users 146 Nov 25 15:12 hie.yaml
-rw-r--r-- 1 sekun users 1514 Nov 25 11:26 LICENSE
drwxr-xr-x 2 sekun users 4096 Nov 25 14:29 src
-rw-r--r-- 1 sekun users 13903 Nov 25 14:19 .stylish-haskell.yaml
-rw-r--r-- 1 sekun users 1124 Nov 25 14:48 foo.cabal
drwxr-xr-x 2 sekun users 4096 Nov 25 11:58 test
[sekun@nixos:~/Projects/foo]$ df .
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/disk/by-uuid/c950348d-10f4-421f-a595-486f064fc3f1 471571688 35942640 411601096 9% /
Could you test with 1.4, to find out in which version things regressed?
How did you install HLS?
This error looks suspiciously like a bug from implicit-hie-cradle
, but no HLS version that uses the buggy version has been published yet.
I just checked that nixpkgs nightly contains the offending version (0.4.0.1). So maybe HLS has been built by nix with implicit-hie-cradle-0.4.0.1
?
@pepeiborra Sure, hopefully I'll be able look into it tomorrow if ever needed.
@fendor
How did you install HLS?
Through nix
I just checked that nixpkgs nightly contains the offending version (0.4.0.1). So maybe HLS has been built by nix with implicit-hie-cradle-0.4.0.1?
Ah I think that's it! I just checked it for the specific commit if nixpkgs I'm using; matches the version you mentioned. Is this resolved in 0.4.0.2?
I hope so, but I don't think implicit-hie has any tests. The relevant PR is: https://github.com/haskell/haskell-language-server/pull/2342 And it affects you if your cabal version is >= 3.4
Hi,
I've just checked it (I think so...). In my case haskell-language-server-wrapper
still fails with implicit-hie-cradle 0.4.0.2
. I'm using hls from unstable nixpkgs (1.5.0.0 currently) and I had to turn off testing for hls-tactics-plugin (some ormolu(?) test was failing).
Here is my nix overlay: https://github.com/kczulko/nixos-config/commit/24e418049a7696c5cadeda22b3728c104fdb30af
And this is what I get:
Thanks, Karol
Like @sekunho I have the same issue. Here are some further details:
ghcup
)ghcup
)ghcup
)I am not using Nix. I’m new to all this therefore I don’t really know how to debug this (also I can’t run the haskell-language-server
command like @sekunho did, because zsh tells me the command wasn’t found).
This doesn’t impose too much of an inconvenience so I think I’ll make use of the compiler directly for now. Hopefully this gets sorted out soon! And yes, thank you all for your work on the HLS!
I have published implicit-hie-cradle-0.5.0.0
, which reverts all 0.4's changes.
It should get picked up by nix at some point and this problem will be fixed.
Hi @Avi-D-coder
I'll try to check it and let you know what's the result.
Thank you very much!
Best regards, Karol
Hi,
Maybe I'm doing sth wrong but updating to implicit-hie-cradle-0.5.0.0
didn't help. Still a lot of cabal: streamingProcess: chdir: invalid argument (Bad file descriptor)
errors.
Here's my code: https://github.com/kczulko/nixos-config/commit/8b2342344fafe5176986a4dd8db106a3b9b24d6a
Best regards, Karol
Does 0.3.0.5 still work? The diff between implicit-hie-cradle-0.5.0.0 and implicit-hie-cradle-0.3.0.5 is just the version number. This issue may be caused by something else.
Nope, still the same error:
cabal: streamingProcess: chdir: invalid argument (Bad file descriptor)
I have also tried nix-build directly from the hls source code at this point:
master origin/master bd0046b7089e32e309f7b29ee6ec1a808ca1db86
Author: Pepe Iborra <pepeiborra@gmail.com>
AuthorDate: Thu Nov 25 23:21:25 2021 +0000
Commit: GitHub <noreply@github.com>
CommitDate: Thu Nov 25 23:21:25 2021 +0000
and ofc I get cabal: streamingProcess: chdir: invalid argument (Bad file descriptor)
.
I'll try and reproduce it.
Oh. I have just spotted how it works... so haskell-language-server-wrapper
starts already installed haskell-language-server
which is the one that fails for me. So to clarify: haskell-language-server
binary build with nix-build
cmd works fine for the git
hash I've put in my previous comment (bd0046b7089e32e309f7b29ee6ec1a808ca1db86
).
If this helps anyone, that's my workaround for now. I'm building latest (1.5.1.0) hls from sources:
# hls 1.5.1.0
haskell-language-server = (import (
fetchTarball https://github.com/haskell/haskell-language-server/archive/745ef26f406dbdd5e4a538585f8519af9f1ccb09.tar.gz
)).defaultPackage.x86_64-linux;
Regards, Karol
I reproduce the cabal: streamingProcess: chdir: invalid argument (Bad file descriptor)
error only with implicit-hie-cradle-0.4.0.1
not 0.4.0.2
.
I hope distribution channels will be updated sooner or later with the fixed implicit-hie vuersion, so closing, thanks for reporting the issue!
Hello, thanks again for all the work put into HLS!
Your environment
Output of
haskell-language-server --probe-tools
orhaskell-language-server-wrapper --probe-tools
:Which OS do you use: NixOS 21.05
Which lsp-client do you use: doom emacs
v21.12.0-alpha
with haskell modeDescribe your project (alternative: link to the project): It's a newly generated project with
cabal init --interactive
with nix flakes to provide the HLS, cabal, and GHC. https://gist.github.com/sekunho/72747c20a192e62a6fc9dc9e9660aa0aContents of
hie.yaml
: N/ASteps to reproduce
nix develop
(ordirenv
)haskell-language-server --debug
However, it works if I do:
gen-hie > hie.yaml
haskell-language-server
It's strange because when I pin a commit of
nixpkgs
to one that contains HLS 1.2.0.0 and ghc 8.10.6, it works. It doesn't work with HLS 1.5.0.0 and GHC 8.10.7. How come 1.5 requireshie.yaml
while 1.2 doesn't?Expected behaviour
Shouldn't complain about a bad file descriptor without
hie.yaml
since it works for 1.2.Actual behaviour
Complains about a bad file descriptor without it.
Include debug information
Execute in the root of your project the command
haskell-language-server --debug .
and paste the logs here:Debug output:
``` # haskell-language-server --debug [sekun@nixos:~/Projects/foo]$ haskell-language-server --debug haskell-language-server version: 1.5.0.0 (GHC: 8.10.7) (PATH: /nix/store/ngi32ilj18ppcc78g0kc3z3zq4r3s049-haskell-language-server-1.5.0.0/bin/haskell-language-server) ghcide setup tester in /home/sekun/Projects/foo. Report bugs at https://github.com/haskell/haskell-language-server/issues Step 1/4: Finding files to test in /home/sekun/Projects/foo Found 2 files Step 2/4: Looking for hie.yaml files that control setup Found 1 cradle () Step 3/4: Initializing the IDE 2021-11-25 14:39:32.955603396 [ThreadId 7] DEBUG hls: Initializing exports map from hiedb Step 4/4: Type checking 2021-11-25 14:39:32.956138658 [ThreadId 7] DEBUG hls: Done initializing exports map from hiedb (0) the files 2021-11-25 14:39:32.956815549 [ThreadId 31] INFO hls: Consulting the cradle for "src/Foo.hs" 2021-11-25 14:39:32.956900639 [ThreadId 31] WARNING hls: No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for src/Foo.hs. Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie). You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error. 2021-11-25 14:39:32.970625984 [ThreadId 31] DEBUG hls: Output from setting up the cradle Cradle {cradleRootDir = "", cradleOptsProg = CradleAction: Cabal} 2021-11-25 14:39:32.972146247 [ThreadId 27] INFO hls: File: /home/sekun/Projects/foo/src/Foo.hs Hidden: no Range: 1:1-2:1 Source: compiler Severity: DsError Message: cabal: streamingProcess: chdir: invalid argument (Bad file descriptor) 2021-11-25 14:39:32.972431128 [ThreadId 30] INFO hls: File: /home/sekun/Projects/foo/test/MyLibTest.hs Hidden: no Range: 1:1-2:1 Source: compiler Severity: DsError Message: cabal: streamingProcess: chdir: invalid argument (Bad file descriptor) 2021-11-25 14:39:32.972707809 [ThreadId 19] INFO hls: finish: User TypeCheck (took 0.02s) 2021-11-25 14:39:32.972927379 [ThreadId 42] INFO hls: finish: GetHie (took 0.00s) F2021-11-25 14:39:32.97316226 [ThreadId 49] INFO hls: finish: GenerateCore (took 0.00s) iles that failed: * /home/sekun/Projects/foo/src/Foo.hs * /home/sekun/Projects/foo/test/MyLibTest.hs Completed (0 files worked, 2 files failed) ```Paste the logs from the lsp-client, e.g. for VS Code
LSP logs:
``` # lsp-log buffer Command "haskell-language-server --lsp -d -l /tmp/hls.log" is present on the path. Command "haskell-language-server --lsp -d -l /tmp/hls.log" is present on the path. Command "haskell-language-server --lsp -d -l /tmp/hls.log" is present on the path. Found the following clients for /home/sekun/Projects/foo/src/Foo.hs: (server-id lsp-haskell, priority 0) The following clients were selected based on priority: (server-id lsp-haskell, priority 0) Creating watchers for following 3 folders: /home/sekun/Projects/foo /home/sekun/Projects/foo/src /home/sekun/Projects/foo/test # lsp-haskell::stderr haskell-language-server version: 1.5.0.0 (GHC: 8.10.7) (PATH: /nix/store/ngi32ilj18ppcc78g0kc3z3zq4r3s049-haskell-language-server-1.5.0.0/bin/haskell-language-server) Starting (haskell-language-server)LSP server... with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Just "/tmp/hls.log", argsThreads = 0, argsProjectGhcVersion = False} with plugins: [PluginId "pragmas",PluginId "floskell",PluginId "fourmolu",PluginId "tactics",PluginId "ormolu",PluginId "stylish-haskell",PluginId "retrie",PluginId "brittany",PluginId "callHierarchy",PluginId "class",PluginId "haddockComments",PluginId "eval",PluginId "importLens",PluginId "refineImports",PluginId "moduleName",PluginId "hlint",PluginId "splice",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-code-actions-imports-exports",PluginId "ghcide-code-actions-type-signatures",PluginId "ghcide-code-actions-bindings",PluginId "ghcide-code-actions-fill-holes",PluginId "ghcide-completions",PluginId "ghcide-type-lenses",PluginId "ghcide-core"] in directory: /home/sekun/Projects/foo Couldn't load cradle for libdir: (CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitSuccess, cradleErrorStderr = ["Couldn't execute cabal --builddir=/home/sekun/.cache/hie-bios/dist-foo-7de3951b2299bde2ff8672638cbcd53f v2-exec --with-compiler /home/sekun/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b ghc -v0 -- --print-libdir"]},"/home/sekun/Projects/foo",Nothing,Cradle {cradleRootDir = "", cradleOptsProg = CradleAction: Cabal}) ```