patch applied (cabal-install): Use user installs by default

Simon Marlow simonmarhaskell at gmail.com
Thu May 10 04:25:41 EDT 2007


Duncan Coutts wrote:
> On Mon, 2007-05-07 at 09:20 +0100, Simon Marlow wrote:
>> Duncan Coutts wrote:
>>> Fri May  4 03:46:52 PDT 2007  Duncan Coutts <duncan.coutts at worc.ox.ac.uk>
>>>   * Use user installs by default
>>>   So it "Just Works"tm without needing extra options or sudo fiddling.
>>>   If you care you can still do sudo fiddling and --global-install
>> This is inconsistent with Cabal and ghc-pkg, which both use global installs by 
>> default.  At the time we felt that global installs were the more common case.  I 
>> know this isn't a clear-cut issue though, and there are good arguments on both 
>> sides.  For example, one could argue that only the system's package manager 
>> should install packages globally, so since we're bypassing the system package 
>> manager we should default to user installs.
>>
>> However, I'm more concerned that we are consistent, and avoid surprising 
>> behaviour where possible.
> 
> The surprising behaviour I was trying to avoid was that by default it'd
> fail with an unhelpful error message. Having it work seems to be a
> better default.
> 
> When doing manual, configure, build, install steps people are familiar
> with the notion that the install step needs to be done as root. When we
> are installing a whole set of packages automagically we don't quite have
> the same connection to the individual build steps and we kind of expect
> things to "Just Work"tm without a great deal of intervention.
> 
> The only way we can do this is if you always run cabal-install as root.
> We'd have to make it clearer to people through the command line UI that
> this is the thing to do. This is also a slightly thing to get right,
> since if the user runs cabal-install update as non-root then the package
> db gets downloaded to their $HOME/.cabal-install/packages but if you
> then do cabal-install install as root then /root/.cabal-install/packages
> or /var/cache/cabal-install/packages probably is not up to date.
> 
> As it happens, I'm not sure that --global by default for ghc-pkg and
> --user by default for cabal-install isn't right. The difference is in
> who is likely to be using the command and what level of control they
> expect.
> 
> I'm cc'ing cabal-devel. Hopefully we can get some more opinions on this.

We certainly shouldn't advocate running cabal-install as root (or should we? 
isn't emerge typically run as root in Gentoo?).

I'm concerned that the unsuspecting user might end up with a mixture of 
globally-installed and locally-installed packages, leading to confusion later 
on.  (See [1] for example)

I think this can be solved with decent diagnostics.  e.g.:

   $ cabal-install foo
   You don't have permission to install packages globally (for all users).
   Either: run cabal-install as root, or add the --user flag to install
   packages for the current user only.

cabal-install could drop its permissions for the non-install steps, perhaps. 
Replace "as root" with "as administrator" for Windows.

[1] 
http://gimbo.org.uk/blog/2007/04/27/haskell-packages-gotcha-global-vs-per-user-package-databases/


More information about the cabal-devel mailing list