ghc-pkg: Try opening lockfiles in read-write mode first
ClosedPublic

Authored by bgamari on Aug 29 2017, 1:25 PM.

Details

Summary

As pointed out in Trac #13945, some filesystems only allow allow exclusive locks if
the fd being locked was opened for write access. This causes ghc-pkg to fail as
it first attempts to open and exclusively lock its lockfile in read-only mode to
accomodate package databases for which we lack write permissions (e.g. global
package databases).

Instead, we now try read-write mode first, falling back to read-only mode if
this fails.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bgamari created this revision.Aug 29 2017, 1:25 PM
This revision was automatically updated to reflect the committed changes.