Skip to content

Help text wrongly states that the default --builddir is dist #7924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andreasabel opened this issue Jan 22, 2022 · 3 comments
Open

Help text wrongly states that the default --builddir is dist #7924

andreasabel opened this issue Jan 22, 2022 · 3 comments

Comments

@andreasabel
Copy link
Member

Help text for cabal install still claims that the default --builddir is dist (rather than dist-newstyle).

$ cabal install --help | grep -B1 dist
 --builddir=DIR                 The directory where Cabal puts generated build
                                files (default dist)
@andreasabel andreasabel added documentation newcomer: 1-one-line-change re: help-text Concerning option --help and hints given to the user labels Jan 22, 2022
@phadej
Copy link
Collaborator

phadej commented Jan 22, 2022

This is indeed embarrassing. If you grep the code, you will notice that the help message comes from Cabal, not cabal-install:

optionDistPref :: (flags -> Flag FilePath)
-> (Flag FilePath -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref get set = \showOrParseArgs ->
option "" (distPrefFlagName showOrParseArgs)
( "The directory where Cabal puts generated build files "
++ "(default " ++ defaultDistPref ++ ")")
get set
(reqArgFlag "DIR")
where
distPrefFlagName ShowArgs = ["builddir"]
distPrefFlagName ParseArgs = ["builddir", "distdir", "distpref"]
(defaultDistPref is defined in the same file).

I think that the underlying reason is the same as why there is

% cabal build --help|grep libdir 
 --libdir=DIR                   installation directory for libraries
 --libsubdir=DIR                subdirectory of libdir in which libs are
 --dynlibdir=DIR                installation directory for dynamic libraries

etc parameters in cabal v2-build which shouldn't be there, as they don't have any effect. However Cabal's builddir is repurposed to do reasonable thing for cabal-install. It's somewhat hard to trace where from exactly builddir configuration param is

TL;DR, this is IMO a symptom of v2 commands not having sane, independent cli-argument implementation. There are plenty of such small annoyances. I guess the symptoms could be fixed one-by-one: in this case parameterize optionDistPref by default location and use dist-newstyle in cabal-install); however fixing the underlying cause needs a very determined person.

@phadej
Copy link
Collaborator

phadej commented Jan 22, 2022

This is not oneline change, multiple files, in separate packages have to be changed. (This shouldn't be that hard, but that is a consequence of a hard underlying problem I mention: there is a sizable technical debt).

@mpickering
Copy link
Collaborator

@phadej is correct about how to fix this issue, the change in #8833 seems the wrong way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants