Fix parsing of password-command option (#6268)
commite08b46559d0c513dd17b61d9b8b0657fc8ccd890
authorFraser Tweedale <ftweedal@redhat.com>
Mon, 5 Jun 2023 12:19:06 +0000 (5 22:19 +1000)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Fri, 14 Jul 2023 14:52:57 +0000 (14 14:52 +0000)
tree52a659312235164ff9a11377e6d59ff5b6dda2e9
parent5d86771a9db437ae7c3dc3aa116e5923232cd7c1
Fix parsing of password-command option (#6268)

The password-command option does not parse its value correctly.
Quotes are ignored, making many kinds of commands impossible to
express (e.g.  `sh -c "foo | bar"`).  Also, `cabal user-config`
treats the argument list as a *list of option values*, rather than a
*value that is a list*.  As a consequence, `cabal user-config
update` corrupts the value in the config file.

Fix these issues by parsing the command as a space separated list of
tokens, and changing the getter to `unwords` the value and return a
*singleton* list.  Also update the argument placeholder from
`PASSWORD` to `COMMAND`.

Fixes: https://github.com/haskell/cabal/issues/6268
(cherry picked from commit 95f48ad71eba4891ccfd6affe72cbf1a6dd3b970)

# Conflicts:
# cabal-install/src/Distribution/Client/Setup.hs
# cabal-install/src/Distribution/Deprecated/ParseUtils.hs
cabal-install/src/Distribution/Client/Setup.hs
cabal-install/src/Distribution/Deprecated/ParseUtils.hs
cabal-testsuite/PackageTests/UserConfig/cabal.out
cabal-testsuite/PackageTests/UserConfig/cabal.test.hs
changelog.d/issue-6268 [new file with mode: 0644]
doc/cabal-commands.rst