-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take care with special characters in paths to configure scripts.
On all platforms, warn about their presence. On Windows, we should use slashes (as opposed to backslashes) where possible, to avoid causing things like #5386. Closes #5386.
- Loading branch information
1 parent
9df6d54
commit 48d7b60
Showing
21 changed files
with
5,524 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Main (main) where | ||
|
||
import Distribution.Simple | ||
|
||
main :: IO () | ||
main = defaultMainWithHooks autoconfUserHooks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo bar/configure', contains the character ' ' (space). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo bar/configure', contains the character ' ' (tab). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo | ||
bar/configure', contains the character ' | ||
' (newline). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo"bar/configure', contains the character '"' (double quote). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo#bar/configure', contains the character '#' (hash). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo$bar/configure', contains the character '$' (dollar sign). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo&bar/configure', contains the character '&' (ampersand). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo'bar/configure', contains the character ''' (single quote). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo(bar/configure', contains the character '(' (left bracket). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo)bar/configure', contains the character ')' (right bracket). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo*bar/configure', contains the character '*' (star). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo;bar/configure', contains the character ';' (semicolon). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo<bar/configure', contains the character '<' (less-than sign). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo=bar/configure', contains the character '=' (equals sign). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo>bar/configure', contains the character '>' (greater-than sign). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo?bar/configure', contains the character '?' (question mark). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo[bar/configure', contains the character '[' (left square bracket). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo/bar/configure', contains the character '/' (backslash). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo`bar/configure', contains the character '`' (backtick). This may cause the script to fail with an obscure error, or for building the package to fail later. | ||
# cabal v1-configure | ||
Resolving dependencies... | ||
Configuring test-0... | ||
Warning: The path to the './configure' script, '/<ROOT>/cabal.dist/foo|bar/configure', contains the character '|' (pipe). This may cause the script to fail with an obscure error, or for building the package to fail later. |
53 changes: 53 additions & 0 deletions
53
cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import Test.Cabal.Prelude | ||
import Data.Foldable (traverse_) | ||
main = cabalTest $ do | ||
-- Test the forbidden characters except NUL. Reference: | ||
-- https://www.gnu.org/software/autoconf/manual/autoconf.html#File-System-Conventions | ||
-- Most of these are magic on Windows, so don't bother testing there. | ||
-- | ||
-- Note: we bundle the configure script so no need to autoreconf | ||
-- while building | ||
skipIf =<< isWindows | ||
traverse_ check | ||
[ "foo bar" | ||
, "foo\tbar" | ||
, "foo\nbar" | ||
, "foo\"bar" | ||
, "foo#bar" | ||
, "foo$bar" | ||
, "foo&bar" | ||
, "foo'bar" | ||
, "foo(bar" | ||
, "foo)bar" | ||
, "foo*bar" | ||
, "foo;bar" | ||
, "foo<bar" | ||
, "foo=bar" | ||
, "foo>bar" | ||
, "foo?bar" | ||
, "foo[bar" | ||
, "foo\\bar" | ||
, "foo`bar" | ||
, "foo|bar" | ||
] | ||
where | ||
-- 'cabal' from the prelude requires the command to succeed; we | ||
-- don't mind if it fails, so long as we get the warning. This is | ||
-- an inlined+specialised version of 'cabal' for v1-configure. | ||
check dir = withSourceCopyDir dir $ | ||
defaultRecordMode RecordMarked $ do | ||
recordHeader ["cabal", "v1-configure"] | ||
env <- getTestEnv | ||
let args = | ||
[ "v1-configure" | ||
, "-vverbose +markoutput +nowrap" | ||
, "--builddir" | ||
, testDistDir env | ||
] | ||
configured_prog <- requireProgramM cabalProgram | ||
r <- liftIO $ run (testVerbosity env) | ||
(Just (testCurrentDir env)) | ||
(testEnvironment env) | ||
(programPath configured_prog) | ||
args | ||
recordLog r |
Oops, something went wrong.