[Hackage] #289: symlink binaries into ~/bin

Hackage trac at galois.com
Sun Aug 3 11:34:33 EDT 2008


#289: symlink binaries into ~/bin
---------------------------------+------------------------------------------
  Reporter:  duncan              |        Owner:                     
      Type:  enhancement         |       Status:  new                
  Priority:  normal              |    Milestone:  Cabal-1.4          
 Component:  cabal-install tool  |      Version:                     
  Severity:  normal              |   Resolution:                     
  Keywords:                      |   Difficulty:  very easy (<1 hour)
Ghcversion:  6.8.2               |     Platform:                     
---------------------------------+------------------------------------------
Comment (by Isaac Dupree):

 Replying to [comment:6 duncan]:
 > I guess you can tell cabal to put symlinks in ~/.cabal/bin instead of
 ~/bin and to use versioned binaries. Would that do?

 if it works, it's fine with me

 > Mess what mess? There will be some symlinks in `~/bin` pointing to
 `~/.cabal/bin`. Using `ls -l` they will be easily identifiable if you want
 to delete them.

 yes, that mess. And then there's always the risk that they come back next
 time (next time I use Cabal, that is), unless I found out how to disable
 it in the config, changed it, and didn't make any typoes or other
 mistakes. (Changing a config file is not the sort of thing you get instant
 feedback on.)

 > This should just work. You have `/usr/bin` in your `$PATH` before
 `$HOME/bin`

 no I don't, I have `$HOME/bin` earlier.  Usually when I install things
 locally it's because the package-manager version is older and I want to
 use the newer version!  For completeness, here's my current `$PATH`:
 {{{
 $ echo $PATH
 /Users/me/inst/bin:/Users/me/scripts:/Users/me/HOME/bin:/Users/me/HOME/.cabal/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/Users/me/inst/stow
 /fish-darcs20080706+open-help-fix/bin:/usr/X11R6/bin
 }}}

 > Ok, but do you have any specific problems with what we're proposing? If
 so what is your suggestion for the best default behavior?

 I suggest that if the config file is empty, then if anything looks
 suspicious ($HOME/bin is not in PATH or is a symlink), you ask the user
 what they want to do, and record that choice in the config file.  Actually
 it'd probably be a service to ask even if they have no $HOME/bin, and
 create it if they want one, and otherwise record otherwise in the config
 file.  Is it a problem, being interactive?  Or simpler: just ask any time
 the config file doesn't say anything about it and you're installing a
 binary.

 > > er, sorry for the rants, did it explain anything?  I think if all
 programs had always been as polite as Cabal is planning to be, I ''might''
 have appreciated it doing that automatically...
 >
 > So you mean this sounds ok?

 okay as long as no one else complains about it -- and certainly aids
 discoverability, because anyone who looks in their `$HOME/bin` will
 implicitly be able to find out about the existence of `$HOME/.cabal`!

 > We're not really so concerned with people who know what they're doing,
 except to the extent that we do not annoy them. What we want is for things
 to "Just Work"(tm) for users who don't know and don't care. The current
 behavior of installing just to `~/.cabal/bin` fails that test.

 Yeah, that's why we need to worry about what happens for users that don't
 have a `$HOME/bin` currently.  And if we ever create `$HOME/bin`
 ourselves, about distros that don't add `$HOME/bin` to `$PATH`, because
 e.g. modifying files like `.bashrc` isn't going to be very reliable.  I
 noticed I have a directory "$HOME/perl", probably from using CPAN
 sometime, but I don't remember if I chose that directory-name or it did:
 {{{
 > ls $HOME/perl/
 bin/  lib/
 > ls $HOME/perl/bin/
 config_data*  ptar*  ptardiff*  pwhich*  shasum*  ysh*
 # and $HOME/perl/lib/perl5/(lots of directories and stuff)
 }}}

 Probably the best we can do is output a message explaining the situation
 whenever (or the first time) we install a binary, possibly with the
 addition of some choices.  Probably the message needs to be different on
 Windows too (If I was suddenly on Windows, I would need a helpful message
 like that :-)

 -Isaac

-- 
Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/289#comment:7>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects


More information about the cabal-devel mailing list