Ticket #541 (closed defect: fixed)

Opened 4 years ago

Last modified 17 months ago

bootstrap.sh ignores PREFIX environment variable

Reported by: nr Owned by:
Priority: normal Milestone:
Component: cabal-install tool Version: 1.6.0.1
Severity: major Keywords:
Cc: Difficulty: unknown
GHC Version: Platform: Linux

Description

bootstrap.sh breaks if PREFIX is not $HOME/.cabal. Patch (from git diff) below:

diff --git a/bootstrap.sh b/bootstrap.sh
index 79729af..29f2b65 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -132,7 +132,7 @@ install_pkg () {
     || die "Compiling the Setup script failed"
   [ -x Setup ] || die "The Setup script does not exist or cannot be run"
 
-  ./Setup configure --user "--prefix=${HOME}/.cabal" \
+  ./Setup configure --user "--prefix=$PREFIX" \
     --with-compiler=${GHC} --with-hc-pkg=${GHC_PKG} \
     ${EXTRA_CONFIGURE_OPTS} ${VERBOSE} \
     || die "Configuring the ${PKG} package failed"

Change History

Changed 4 years ago by nr

  • severity changed from normal to major

Followup: even with this patch, using $PREFIX does not work: a directory structure gets created in $PREFIX, but there is no config file, which results in this pain:

: nr@homedog 5523 ; cabal install -v graphmod
/usr/bin/ghc --numeric-version
looking for package tool: ghc-pkg near compiler in /usr/bin
found package tool in /usr/bin/ghc-pkg
/usr/bin/ghc-pkg --version
/usr/bin/ghc --supported-languages
Reading installed packages...
/usr/bin/ghc-pkg list
Warning: No remote package servers have been specified. Usually you would have
one specified in the config file.
cabal: There is no package named graphmod
: nr@homedog 5524 ; 

Changed 4 years ago by duncan

  • status changed from new to closed
  • resolution set to fixed

Thanks. It turns out this has been fixed in the dev version already:

Sun Mar 15 12:54:07 GMT 2009  Duncan Coutts <duncan@haskell.org>
  * Clarify the instructions in the README and bootstrap.sh
  Addresses the complaint in ticket #523.

See #523 for the improved wording of the README about doing update before the config file gets created.

Also, the PREFIX/HOME mistake was fixed in the same patch:

    hunk ./bootstrap.sh 135
    -  ./Setup configure --user "--prefix=${HOME}/.cabal" \
    +  ./Setup configure --user "--prefix=${PREFIX}" \

However I do not understand the problem about no config file existing. When I remove the config file and the cached package index and try to install something I get:

$ cabal install graphmod
Config file /home/duncan/.cabal/config not found.
Writing default configuration to /home/duncan/.cabal/config
Warning: The package list for 'hackage.haskell.org' does not exist. Run
'cabal update' to download it.
cabal: There is no package named graphmod

It sounds like you've got a partial config file rather than none at all.

We cannot create the config file at install time because global installs cannot create per-user config files. The best we can do is to improve things so that the config file is always created on the first run and explained appropriately.

Changed 4 years ago by nr

I had a partial config file because I created one, since I was encouraged to by the output from some command or other.

I'm sympathetic to the problem of one install per system vs one config file per user. In that case I hope the Right Thing to do is that every time cabal (cabal-install) runs, it checks to see if ~/.cabal/config exists and if not, creates it. Unless that operation fails (with a suitable error messages), all other references to the file with then make sense. Even running

  cabal -h

should create the file.

A cabal-config man page in section 5 would be a bonus.

Changed 17 months ago by elga

Note: See TracTickets for help on using tickets.