Skip to content
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

cabal.config should have a field for password-command. #5224

Closed
merijn opened this issue Mar 21, 2018 · 7 comments · Fixed by #6680
Closed

cabal.config should have a field for password-command. #5224

merijn opened this issue Mar 21, 2018 · 7 comments · Fixed by #6680

Comments

@merijn
Copy link
Collaborator

merijn commented Mar 21, 2018

Currently, according to cabal upload --help it's possible to specify a username and password in the cabal.config file. Of course, storing passwords in config files is a horrible idea, ESPECIALLY when one wants to share/publish those. Thankfully cabal upload has the helpful --password-command flag to read the password from the stdout of another application, however as far as I know this password-command can't be specified in cabal.config?

@merijn
Copy link
Collaborator Author

merijn commented Mar 22, 2018

cocreature just pointed out on IRC that this flag already exists, but is just not mentioned by the cabal upload command. So it should probably be specified underneath the username/password fields mentioned.

@m-renaud
Copy link
Collaborator

This appears to be fixed in version 2.4.0.0:

$ cabal --version
cabal-install version 2.4.0.0
compiled using version 2.4.0.1 of the Cabal library

$ cabal upload --help
Uploads source packages or documentation to Hackage.

Usage: cabal upload [FLAGS] TARFILES

Flags for upload:
 -h --help                      Show this help text
 -v --verbose[=n]               Control verbosity (n is 0--3, default verbosity
                                level is 1)
    --publish                   Publish the package instead of uploading it as
                                a candidate.
 -d --documentation             Upload documentation instead of a source
                                package. By default, this uploads documentation
                                for a package candidate. To upload
                                documentation for a published package, combine
                                with --publish.
 -u --username=USERNAME         Hackage username.
 -p --password=PASSWORD         Hackage password.
 -P --password-command=PASSWORD Command to get Hackage password.

You can store your Hackage login in the ~/.cabal/config file
Relevant global configuration keys:
  username
  password

and looking at the auto-generated ~/.cabal/config I see:

-- This config file was generated using the following versions
-- of Cabal and cabal-install:
-- Cabal library version: 2.4.0.1
-- cabal-install version: 2.4.0.0

<snip>

-- username:
-- password:
-- password-command:

@hvr
Copy link
Member

hvr commented Nov 29, 2018

@m-renaud no, it is not fixed yet (i.e. the open issue is the --help text failing to mention that you can configure password-command in your cabal config)!

but fixing this might be as easy as extending the last line of

uploadCommand :: CommandUI UploadFlags
uploadCommand = CommandUI {
    commandName         = "upload",
    commandSynopsis     = "Uploads source packages or documentation to Hackage.",
    commandDescription  = Nothing,
    commandNotes        = Just $ \_ ->
         "You can store your Hackage login in the ~/.cabal/config file\n"
      ++ relevantConfigValuesText ["username", "password"],

to include "password-command".

@m-renaud
Copy link
Collaborator

Ahh, I see, thanks for clarifying I had misread the original comment. I thought it was saying that the -P --password-command=PASSWORD Command to get Hackage password. line was missing from cabal upload --help.

@m-renaud m-renaud self-assigned this Nov 29, 2018
@merijn
Copy link
Collaborator Author

merijn commented Nov 30, 2018

The ticket's main point was that "password-command" wasn't in the default config file as an option (I found out it existed on IRC), but that appears to be solved according to your comment. So yes, I think just patching the config values text to point it out should be enough to close this.

@hvr
Copy link
Member

hvr commented Nov 30, 2018

The ticket's main point was that "password-command" wasn't in the default config file as an option

Btw, the -- password-command: command line got generated into the default config since cabal version 1.24

So only if your config file was generated by an older version of cabal you would have missed it

@merijn
Copy link
Collaborator Author

merijn commented Nov 30, 2018

That may have been the case, in which case I suppose this issue was actually rather trivial... Oh well!

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