[Hackage] #688: hard-coded path to configuration file

#688: hard-coded path to configuration file ---------------------------------+------------------------------------------ Reporter: guest | Owner: Type: enhancement | Status: new Priority: normal | Milestone: Component: cabal-install tool | Version: 1.8.0.2 Severity: minor | Keywords: Difficulty: easy (<4 hours) | Ghcversion: 6.10.4 Platform: Linux | ---------------------------------+------------------------------------------ I want to be able to tell {{{cabal}}} to read the configuration from a different place than {{{$HOME/.cabal/config}}}. The ultimate goal is to get rid of the non-standard {{{.cabal}}} directory altogether, so far careful {{{--package-db}}}/{{{--prefix}}} etc. juggling served me well; {{{config}}} is the last remaining file there. {{{
cabal --version cabal-install version 0.8.2 using version 1.8.0.2 of the Cabal library }}}
-- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/688 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#688: no indication that configuration file location is configurable ---------------------------------+------------------------------------------ Reporter: guest | Owner: Type: enhancement | Status: new Priority: normal | Milestone: Component: cabal-install tool | Version: 1.8.0.2 Severity: minor | Keywords: Difficulty: easy (<4 hours) | Ghcversion: 6.10.4 Platform: Linux | ---------------------------------+------------------------------------------ Comment(by duncan): I'm not quite sure why you say it is non-standard. It's the standard unix place to put per-user application files. Where would you consider to be a standard location? You can use: {{{ cabal --config-file=... [command] [flags] }}} So it should work to use a shell alias, something like {{{ alias cabal="cabal --config-file=..." }}} So really the bug here is not that it's hard coded (since it's not) but that these global flags are not easily discoverable. We don't list them all in the global --help so as not to clutter things, but then we need a way to let people know that there are extra global options and provide a way to get the help for them via some extended --help thing. So let us know about: * what you think the standard location should be * if that shell alias (or whatever equivalent you choose to use) works ok and we should open another ticket on providing extended help for the global flags. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/688#comment:1 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#688: adopt XDG basedir spec ---------------------------------+------------------------------------------ Reporter: guest | Owner: Type: enhancement | Status: new Priority: low | Milestone: Component: cabal-install tool | Version: 1.8.0.4 Severity: normal | Keywords: Difficulty: hard (< 1 day) | Ghcversion: 6.10.4 Platform: Linux | ---------------------------------+------------------------------------------ Changes (by guest): * priority: normal => low * difficulty: easy (<4 hours) => hard (< 1 day) * version: 1.8.0.2 => 1.8.0.4 * severity: minor => normal Comment: Sorry for neglecting to answer right away, I forgot about this bug for a few days because I didn't bother to jump through the hoops to be able to receive change notification. If by standard you mean ''de facto'' just everyone's been doing it like that, then I agree. And since indeed everyone's been doing that, I end up with hundreds of dotdirs in my home directory. This sucks because their content is essentially unstructured. The problem is that I want to treat files differently according to their purpose; and there are '''not just application files'''. There are also configuration files, they are put under version control. There are cache files, they are excluded from backup and indexing. You know that a software package in Linux is not just dumped into a single directory somewhere, but the files are sorted into directories which each have a certain meaning. [http://www.pathname.com/fhs/ FHS] governs the semantics for the system layout, [http://standards.freedesktop.org /basedir-spec/basedir-spec-latest.html FDO's XDG base directory specification] governs this for a user's directory. These are real standards, and they enable all sorts of interoperability that would not be possible with unstructured directory contents. Whether you want to adopt the spec in order to sort files into their appropriate XDG location by default is up to you. Thanks to your hint about {{{--config-file}}} I was able to move away the last file and delete {{{.cabal}}} for good, so certainly a compliant layout is already possible (through careful configuration, as I said before) if a user wants it. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/688#comment:2 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#688: adopt XDG basedir spec ---------------------------------+------------------------------------------ Reporter: guest | Owner: Type: enhancement | Status: new Priority: low | Milestone: Component: cabal-install tool | Version: 1.8.0.4 Severity: normal | Keywords: Difficulty: hard (< 1 day) | Ghcversion: 6.10.4 Platform: Linux | ---------------------------------+------------------------------------------ Comment(by duncan): I thought you might say the XDG spec. Yes I realise it's a "real" standard as opposed to a de facto standard. I must admit I'm slightly sceptical about the attempt to redefine where apps keep their per-user info. So far, very few apps seem to follow this new spec (mainly a few GNOME desktop bits). I will be surprised if they ever manage to get more than the two main desktops to move their dot files. That said, if the world is going to move that direction then we don't want to get in the way. We should make it easier for users or distros to change where the per-user files go by default. Thanks for confirming it is at least possible (if not convenient). -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/688#comment:3 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#688: adopt XDG basedir spec ---------------------------------+------------------------------------------ Reporter: guest | Owner: Type: enhancement | Status: new Priority: low | Milestone: Component: cabal-install tool | Version: 1.8.0.4 Severity: normal | Keywords: Difficulty: hard (< 1 day) | Ghcversion: 6.10.4 Platform: Linux | ---------------------------------+------------------------------------------ Comment(by guest):
we should open another ticket on providing extended help for the global flags This is now tracked in #690.
-- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/688#comment:4 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#688: adopt XDG basedir spec ---------------------------------+------------------------------------------ Reporter: guest | Owner: Type: enhancement | Status: new Priority: low | Milestone: Component: cabal-install tool | Version: 1.8.0.4 Severity: normal | Keywords: Difficulty: hard (< 1 day) | Ghcversion: 6.10.4 Platform: Linux | ---------------------------------+------------------------------------------ Comment(by duncan): Hmm, I notice the XDG base directory specification does not say anything about program executable files or library files, though the default naming scheme sort-of suggests `~/.local/bin` and `~/.local/lib`. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/688#comment:5 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#688: adopt XDG basedir spec ---------------------------------+------------------------------------------ Reporter: guest | Owner: Type: enhancement | Status: new Priority: low | Milestone: Component: cabal-install tool | Version: 1.8.0.4 Severity: normal | Keywords: Difficulty: hard (< 1 day) | Ghcversion: 6.10.4 Platform: Linux | ---------------------------------+------------------------------------------ Comment(by Syzygies): I found this ticket while researching precedents for a related question. For various reasons I like to build multiple versions of GHC side by side: Migration between major releases, testing candidate releases. For torture- testing new hardware, building many copies of GHC at once is better than e.g. the usual prime testing. I once literally caused a server power supply to smoke this way; my friend's hardware vendor was in over their head. They took my GHC test in-house to minimize delivery cycles. A related piece of de facto convention comes up here: It is crazy to sprinkle pieces of a system like GHC into separate global locations like /usr/local/bin, /usr/local/share, unless one will only ever use one version, with no desire to look under the hood or move the installation. In other words, I have no issue with Linux or OS X shipping this way, but major additions should be localized by default. Some are, e.g. TeX. GHC should. Fortunately, to avoid Siamese twin installations with accidentally shared parts, one can use the ./configure --prefix option while building GHC. Then, it becomes apparent that "cabal install" is the remaining holdout to ideal version localization. There is a perfect storm of tiny factors keeping Cabal from gracefully localizing. I wanted to elicit advice before contributing a fix; this ticket seems to have touched on a key issue. I did not know about the "--config-file=..." command-line option; I will start using it in scripts. However, we need a better default for global installs. In /usr/local I now use a symbolic link from ghc to one of the directories ghc-6.10.4, ghc-6.12.1, ghc-6.12.2, ghc-6.12.3-rc1. It then appears that I built GHC using "--prefix=/usr/local/ghc". My ~/.cabal/config file includes lines like "remote-repo-cache: /usr/local/ghc/packages". This works, but I've had amusing debates with unix experts on why my symbolic link is a terrible solution. Basically, when I change this link I pull the rug out from under any ongoing process that wants to see a consistent environment. Environment variables are one "right" way to handle this. In short, a symbolic link is like changing state, while environment variables are like functional programming. However, not only does .cabal/config fail to allow external environment variables, it doesn't allow forms like one sees in its own comments. (Who reads documentation? We all read sample code.) For example, even though I see the comment "-- bindir: $prefix/bin" I cannot write "remote-repo- cache: $prefix/packages". I would prefer to be able to write anything that would evaluate correctly in a shell to an absolute path, e.g. `which ghc` or `perl -pe ...` and so forth. Ideally, a global install would by default use a global location for the Cabal config file, but we slam back into the original problem: By default the global install of GHC did not use the --prefix option, so there is no well-defined location parametrized by the version of GHC. On the other hand, this isn't so bad, e.g. put everything in ../share/hackage.haskell.org relative to the currently visible ghc. Saves bandwidth caching packages; if someone hasn't bothered to build ghc using --prefix, they won't mind the Siamese twin effects with Cabal either. The simplest change that would help my issue would be to allow both absolute and relative paths in .cabal/install, with a relative path relative to the location of `which ghc`. This would "just work" in simple cases, and allow competing processes to coexist, that chose different versions of ghc via a custom $PATH alone, with no other flags needed. If this change was accepted, I wouldn't mind leaving my config file in ~/.cabal. That location is only mildly annoying; as has been noted, we've already lost the war on keeping that area uncluttered. However, it just shouldn't matter which authorized user works on a global install. Relying on ~/.cabal/config for a global install should be viewed as a bug, as it prevents several admins from cooperating in consistently maintaining GHC on a shared system. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/688#comment:6 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#688: adopt XDG basedir spec ---------------------------------+------------------------------------------ Reporter: guest | Owner: Type: enhancement | Status: new Priority: low | Milestone: Component: cabal-install tool | Version: 1.8.0.4 Severity: normal | Keywords: Difficulty: hard (< 1 day) | Ghcversion: 6.10.4 Platform: Linux | ---------------------------------+------------------------------------------ Comment(by duncan): Replying to [comment:6 Syzygies]:
A related piece of de facto convention comes up here: It is crazy to sprinkle pieces of a system like GHC into separate global locations like /usr/local/bin, /usr/local/share, unless one will only ever use one version, with no desire to look under the hood or move the installation. In other words, I have no issue with Linux or OS X shipping this way, but major additions should be localized by default. Some are, e.g. TeX. GHC should.
You can already do this if you want to. You just set the --prefix to be what you want, e.g. instead of using /usr/local as the prefix, use /opt/ghc/6.12.1 or whatever, then you'll get paths like `/opt/ghc/6.12.1/bin`, `/opt/ghc/6.12.1/lib`, `/opt/ghc/6.12.1/share` etc etc.
Fortunately, to avoid Siamese twin installations with accidentally shared parts, one can use the ./configure --prefix option while building GHC. Then, it becomes apparent that "cabal install" is the remaining holdout to ideal version localization. There is a perfect storm of tiny factors keeping Cabal from gracefully localizing. I wanted to elicit advice before contributing a fix; this ticket seems to have touched on a key issue.
I did not know about the "--config-file=..." command-line option; I will start using it in scripts. However, we need a better default for global installs.
The "default" default, should follow global conventions, meaning using /usr/local. Again you can override the prefix and all other install directories. It's true that there is not currently a sensible way to have a global cabal config file, in the style of /etc/cabal or something like that. Following the XDG spec in that regard might make some sense.
Environment variables are one "right" way to handle this. In short, a symbolic link is like changing state, while environment variables are like functional programming.
You mean you would like an environment variable to set the location of the Cabal config file? You can set the `$CABAL_CONFIG`, it acts like setting the "--config-file=..." option.
However, not only does .cabal/config fail to allow external environment variables, it doesn't allow forms like one sees in its own comments. (Who reads documentation? We all read sample code.) For example, even though I see the comment "-- bindir: $prefix/bin" I cannot write "remote-repo- cache: $prefix/packages". I would prefer to be able to write anything that would evaluate correctly in a shell to an absolute path, e.g. `which ghc` or `perl -pe ...` and so forth.
The prefix is something that makes sense in the context of an installation. It is not clear that basing the cache location on that makes sense. It means for example that it will not find the default cache if you override the --prefix on the command line. Perhaps what you really want to do is to specify the default prefix and cache dirs in the config file based on some other variable, rather than having the cache dir follow the prefix.
Ideally, a global install would by default use a global location for the Cabal config file,
Do you mean an install run as root, or do you mean an install run as a user? Or do you mean that you'd like to be able to have a shared/global set of connfig defaults that can be overridden in per-user config files? As a user when you run `cabal install --global --su-cmd=sudo` you're using your own config, but installing to a global location (the exact prefix etc is set in the config file). It does the build as user and installs as root.
but we slam back into the original problem: By default the global install of GHC did not use the --prefix option, so there is no well- defined location parametrized by the version of GHC.
You can either use versioned ghc binaries, (called `ghc-6.10.4`, `ghc-6.12.1` etc) in a shared prefix like `/usr/local` or as I described above you can use separate prefixes for different ghc installations. Note that by default, cabal installs libs in dirs including the ghc version, so it all works. As mentioned before you have complete control over the prefix (and other detailed layout of bindir etc) so you can put files where you like, according to some ghc version scheme. You can use the compiler id in the cabal prefix for example.
The simplest change that would help my issue would be to allow both absolute and relative paths in .cabal/install, with a relative path relative to the location of `which ghc`.
Honestly I don't think that is sensible. Allowing people to use more variables so that you can specify a prefix that happens to correspond to your ghc installation is one thing, making that the meaning for relative paths is rather another. Usually you do not want to install things into the ghc tree, so using relative paths would encourage that dangerous behaviour.
However, it just shouldn't matter which authorized user works on a global install. Relying on ~/.cabal/config for a global install should be viewed as a bug, as it prevents several admins from cooperating in consistently maintaining GHC on a shared system.
I don't understand this bit. Perhaps you can explain what config you would like to use for global installs. Where would it live? Do you assume global installs are only performed by root? I think it would help if you could explain what you're actually trying to achieve. The mailing list might be the better place for that discussion. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/688#comment:7 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#688: adopt XDG basedir spec ---------------------------------+------------------------------------------ Reporter: guest | Owner: Type: enhancement | Status: new Priority: low | Milestone: cabal-install-0.16 Component: cabal-install tool | Version: 1.8.0.4 Severity: normal | Keywords: Difficulty: hard (< 1 day) | Ghcversion: 6.10.4 Platform: Linux | ---------------------------------+------------------------------------------ Changes (by kosmikus): * milestone: => cabal-install-0.16 Comment: Moving to 0.16 milestone so that we look at it again sometime soon, but I think this is a candidate for _|_ (meaning that without external concrete patches or suggestions, we probably won't do it). -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/688#comment:8 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects
participants (1)
-
Hackage