[GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error (was: make install fails when registering packages)
GHC
ghc-devs at haskell.org
Sun Jul 9 22:12:57 UTC 2017
#13945: 'ghc-pkg update' fails due to bad file descriptor error
-------------------------------------+-------------------------------------
Reporter: mpickering | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by mpickering):
* cc: goldfire (added)
@@ -35,1 +35,3 @@
- Here is the call stack from the crash if that's useful.
+ A workaround is to make sure that `HAVE_FLOCK` is not defined, the way I
+ did this was commenting out the three relevant lines in
+ libraries/base/configure.ac.
@@ -37,50 +39,7 @@
- {{{
- CallStack (from HasCallStack):
- die', called at
- libraries/Cabal/Cabal/Distribution/Simple/Program/Run.hs:142:7 in
- main:Distribution.Simple.Program.Run
- runProgramInvocation, called at
- libraries/Cabal/Cabal/Distribution/Simple/Program/HcPkg.hs:167:5 in
- main:Distribution.Simple.Program.HcPkg
- register, called at
- libraries/Cabal/Cabal/Distribution/Simple/GHC.hs:1709:5 in
- main:Distribution.Simple.GHC
- registerPackage, called at
- libraries/Cabal/Cabal/Distribution/Simple/Register.hs:350:14 in
- main:Distribution.Simple.Register
- registerPackage, called at
- libraries/Cabal/Cabal/Distribution/Simple/Register.hs:172:16 in
- main:Distribution.Simple.Register
- registerAll, called at
- libraries/Cabal/Cabal/Distribution/Simple/Register.hs:125:5 in
- main:Distribution.Simple.Register
- register, called at libraries/Cabal/Cabal/Distribution/Simple.hs:770:10
- in main:Distribution.Simple
- defaultRegHook, called at
- libraries/Cabal/Cabal/Distribution/Simple.hs:584:20 in
- main:Distribution.Simple
- regHook, called at
- libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:120:5 in
- main:Distribution.Simple.UserHooks
- regHook, called at
- libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:120:5 in
- main:Distribution.Simple.UserHooks
- cmd_hook, called at libraries/Cabal/Cabal/Distribution/Simple.hs:452:38
- in main:Distribution.Simple
- cmd_hook, called at libraries/Cabal/Cabal/Distribution/Simple.hs:469:4
- in main:Distribution.Simple
- hookedActionWithArgs, called at
- libraries/Cabal/Cabal/Distribution/Simple.hs:451:5 in
- main:Distribution.Simple
- hookedAction, called at
- libraries/Cabal/Cabal/Distribution/Simple.hs:430:5 in
- main:Distribution.Simple
- registerAction, called at
- libraries/Cabal/Cabal/Distribution/Simple.hs:184:50 in
- main:Distribution.Simple
- defaultMainHelper, called at
- libraries/Cabal/Cabal/Distribution/Simple.hs:133:28 in
- main:Distribution.Simple
- defaultMainWithHooksArgs, called at utils/ghc-cabal/Main.hs:214:6 in
- main:Main
- }}}
+ geekosaur suggests on IRC that the problem might be
+
+ > what might be possible is that hLock uses fcntl locking, ghc-pkg opens a
+ database r/o if it can't open it > r/w, and it tried to acquire a write
+ lock (which will fail with EBADF if the file descriptor is only open for >
+ > read). and there is an SElinux context prohibiting your process opening
+ the db for write
New description:
In the final part of installation when packages are registered, the
following command fails
{{{
"inplace/bin/ghc-cabal" register libraries/ghc-prim dist-install
"/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc"
"/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc-
pkg" "/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708" ''
'/home/pgrads/mp16005/linux/installed-ghc' '/home/pgrads/mp16005/linux
/installed-ghc/lib/ghc-8.2.0.20170708' '/home/pgrads/mp16005/linux
/installed-ghc/share/doc/ghc-8.2.0.20170708/html/libraries' NO
}}}
with the following output
{{{
Registering library for ghc-prim-0.5.0.0..
ghc-cabal:
'/home/pgrads/mp16005/linux/installed-ghc/lib/ghc-8.2.0.20170708/bin/ghc-
pkg'
exited with an error:
ghc-pkg: Couldn't open database
/home/pgrads/mp16005/linux/installed-
ghc/lib/ghc-8.2.0.20170708/package.conf.d
for modification: {handle:
/home/pgrads/mp16005/linux/installed-
ghc/lib/ghc-8.2.0.20170708/package.conf.d/package.cache.lock}:
hLock: invalid argument (Bad file descriptor)
}}}
It might be something to do with the permissions I have on my machine but
I used to be able to install ghc if I gave it a suitable prefix other than
`/usr/local`.
A workaround is to make sure that `HAVE_FLOCK` is not defined, the way I
did this was commenting out the three relevant lines in
libraries/base/configure.ac.
geekosaur suggests on IRC that the problem might be
> what might be possible is that hLock uses fcntl locking, ghc-pkg opens a
database r/o if it can't open it > r/w, and it tried to acquire a write
lock (which will fail with EBADF if the file descriptor is only open for >
> read). and there is an SElinux context prohibiting your process opening
the db for write
--
Comment:
I updated the ticket as I think this will be a more general problem using
8.2.1 on any system where these restrictions exist. I can't properly
diagnose the problem but geekosaur speculates an explanation which seemed
plausible.
This also seems the same issue that Richard was having back in March.
https://mail.haskell.org/pipermail/ghc-devs/2017-March/013915.html
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list