Skip to content

Commit

Permalink
Merge pull request #6648 from commercialhaskell/fix6647
Browse files Browse the repository at this point in the history
Fix #6647 Trigger S-8432 whenever space in Stack's 'programs' directory
  • Loading branch information
mpilgrem authored Aug 24, 2024
2 parents 19668b6 + 3ee03d0 commit 909c818
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 13 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Behavior changes:
consequently, if a Docker container is not being run 'detached', its standard
input channel will always be kept open. (Before Docker 1.9.1 the use of an
interactive container could hang in certain circumstances.)
* On Windows, Stack will always warn (message S-8432) if there is a space
character in Stack's 'programs' path, as GHC 9.4.1 and later do not work if
there is a space in the path to the `ghc` executable. S-8432 now presents as a
warning and not an error.

Other enhancements:

Expand Down
24 changes: 20 additions & 4 deletions doc/maintainers/stack_errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,12 +542,28 @@ to take stock of the errors that Stack itself can raise, by reference to the

* `Stack.Config.configFromConfigMonoid`:

Presented as a warning rather than as an error:

~~~text
[S-8432] Stack's 'programs' path contains a space character and has no alternative
[S-8432]
Stack's 'programs' path is <path>. It contains a space character. This will
prevent building with GHC 9.4.1 or later. It also has has no alternative
short ('8 dot 3') name. This will cause problems with packages that use the
GNU project's 'configure' shell script. Use the 'local-programs-path'
configuration option to specify an alternative path. The current path is:
<path>
GNU project's 'configure' shell script.

To avoid such problems, use the local-programs-path non-project specific
configuration option to specify an alternative space-free path.
~~~

or

~~~text
[S-8432]
Stack's 'programs' path is <path>. It contains a space character. This will
prevent building with GHC 9.4.1 or later.

To avoid such problems, use the local-programs-path non-project specific
configuration option to specify an alternative space-free path.
~~~

* `Stack.Coverage.generateHpcReport`: catches exceptions from
Expand Down
27 changes: 18 additions & 9 deletions src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -347,20 +347,29 @@ configFromConfigMonoid
-- exist.
shortLocalProgramsFilePath <-
liftIO $ getShortPathName localProgramsFilePath
when (' ' `elem` shortLocalProgramsFilePath) $
prettyError $
prettyWarn $
"[S-8432]"
<> line
<> fillSep
[ flow "Stack's 'programs' path contains a space character and \
\has no alternative short ('8 dot 3') name. This will \
\cause problems with packages that use the GNU project's \
\'configure' shell script. Use the"
( [ flow "Stack's 'programs' path is"
, style File (fromString localProgramsFilePath) <> "."
, flow "It contains a space character. This will prevent \
\building with GHC 9.4.1 or later."
]
<> [ flow "It also has no alternative short ('8 dot 3') name. \
\This will cause problems with packages that use the \
\GNU project's 'configure' shell script."
| ' ' `elem` shortLocalProgramsFilePath
]
)
<> blankLine
<> fillSep
[ flow "To avoid sucn problems, use the"
, style Shell "local-programs-path"
, flow "configuration option to specify an alternative path. \
\The current path is:"
, style File (fromString localProgramsFilePath) <> "."
, flow "non-project specific configuration option to specify an \
\alternative space-free path."
]
<> line
platformOnlyDir <-
runReaderT platformOnlyRelDir (platform, platformVariant)
let localPrograms = localProgramsBase </> platformOnlyDir
Expand Down

0 comments on commit 909c818

Please sign in to comment.