hsenv icon indicating copy to clipboard operation
hsenv copied to clipboard

Unable to install tarballs with '~' in the path

Open cheecheeo opened this issue 12 years ago • 2 comments

In revision f14cddf0ae684f10118c56b933823b96ab39e7dc I'm unable to create an environment with the home directory shortcut ('~'):

$ ~/.cabal/bin/hsenv --ghc=~/packages/ghc-7.5.20120711-x86_64-unknown-linux.tar.bz2 Creating Virtual Haskell directory structure Installing GHC Installing GHC from ~/packages/ghc-7.5.20120711-x86_64-unknown-linux.tar.bz2 /bin/tar process failed with status 2

hsenv.log file contains detailed description of the process.

$ cat hsenv.log Creating Virtual Haskell directory structure hsenv directory: /data/home/chee1/breakghc/.hsenv_breakghc cabal directory: /data/home/chee1/breakghc/.hsenv_breakghc/cabal hsenv bin directory: /data/home/chee1/breakghc/.hsenv_breakghc/bin Installing GHC Installing GHC from ~/packages/ghc-7.5.20120711-x86_64-unknown-linux.tar.bz2 Unpacking GHC tarball to /data/home/chee1/breakghc/ghc31404 Running outside process: tar xf ~/packages/ghc-7.5.20120711-x86_64-unknown-linux.tar.bz2 -C /data/home/chee1/breakghc/ghc31404 --strip-components 1 Looking for tar in $PATH tar -> /bin/tar Process failed with exit code 2 Empty process output Process error output: /bin/tar: ~/packages/ghc-7.5.20120711-x86_64-unknown-linux.tar.bz2: Cannot open: No such file or directory /bin/tar: Error is not recoverable: exiting now

/bin/tar process failed with status 2

$ rm -rf .hsenv_breakghc/

$ ~/.cabal/bin/hsenv --ghc=/home/chee1/packages/ghc-7.5.20120711-x86_64-unknown-linux.tar.bz2 Creating Virtual Haskell directory structure Installing GHC Installing GHC from /home/chee1/packages/ghc-7.5.20120711-x86_64-unknown-linux.tar.bz2 Initializing GHC Package database at /data/home/chee1/breakghc/.hsenv_breakghc/ghc_pkg_db Copying necessary packages from original GHC package database Using user-wide (~/.cabal/packages) Hackage download cache directory Installing cabal config at /data/home/chee1/breakghc/.hsenv_breakghc/cabal/config Installing activate script Installing cabal wrapper using /data/home/chee1/breakghc/.hsenv_breakghc/cabal/config at /data/home/chee1/breakghc/.hsenv_breakghc/bin/cabal Skipping 'cabal update' step, Hackage download cache already downloaded to ~/.cabal/packages/. You can update it manually with 'cabal update' (from inside or outside the virtual environment).

To activate the new environment use 'source .hsenv_breakghc/bin/activate'

I'm guessing that there is a missing environment variable, maybe $HOME missing.

cheecheeo avatar Jul 12 '12 23:07 cheecheeo

techically, there's no error. '~' is not a valid path - it often works, because your shell (bash at least) expands it to your home directory path, before passing it as an argument to a program, but the expansion only happens if it's the first character of a token, e.g. "echo ~ --ghc=~" will print something like "/home/paczesiowa --ghc=~". I'm sceptical to writing a hack that will look for ~ at the beginning of a path and expand it - I don't think any other unix tool does it.

different solution would be to allow both "--ghc=PATH" and "--ghc PATH", what do you think about it?

Paczesiowa avatar Jul 15 '12 21:07 Paczesiowa

I think allowing both "--ghc=PATH" and "--ghc PATH" is a good idea.

Better error reporting for unknowing users like me would also be helpful, maybe like the ghc configure script uses:

$ ./configure --prefix=~/blahblahblah configure: error: expected an absolute directory name for --prefix: ~/blahblahblah

cheecheeo avatar Jul 15 '12 22:07 cheecheeo