[GHC] #13945: 'ghc-pkg update' fails due to bad file descriptor error

GHC ghc-devs at haskell.org
Mon Jul 10 13:47:18 UTC 2017


#13945: 'ghc-pkg update' fails due to bad file descriptor error
---------------------------------+----------------------------------------
        Reporter:  mpickering    |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  high          |            Milestone:
       Component:  Compiler      |              Version:  8.2.1-rc3
      Resolution:                |             Keywords:
Operating System:  Linux         |         Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+----------------------------------------
Description changed by bgamari:

@@ -42,4 +42,4 @@
- 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
+ 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

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13945#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list