From 0b06a133018bd2f5b40a74e94f966bc6a54f238e Mon Sep 17 00:00:00 2001 From: Sam May Date: Sun, 15 Aug 2021 00:02:46 -0700 Subject: [PATCH] Properly link filename compatibility checks into `cabal check` (#7479) * Properly link filename compatibility checks into `cabal check` * Improve consistency and clarity of Check error messages --- .../regressions/assoc-cpp-options.check | 2 +- .../regressions/denormalised-paths.cabal | 7 + .../regressions/denormalised-paths.check | 19 ++- .../regressions/extensions-paths-5054.check | 2 +- .../Distribution/PackageDescription/Check.hs | 144 ++++++++---------- .../AutogenModules/Package/setup.cabal.out | 2 +- .../AutogenModules/Package/setup.out | 2 +- changelog.d/path-validation | 11 ++ changelog.d/rel-path-check | 4 - 9 files changed, 93 insertions(+), 100 deletions(-) create mode 100644 changelog.d/path-validation delete mode 100644 changelog.d/rel-path-check diff --git a/Cabal-tests/tests/ParserTests/regressions/assoc-cpp-options.check b/Cabal-tests/tests/ParserTests/regressions/assoc-cpp-options.check index fd1446fcebc..ed0edf29738 100644 --- a/Cabal-tests/tests/ParserTests/regressions/assoc-cpp-options.check +++ b/Cabal-tests/tests/ParserTests/regressions/assoc-cpp-options.check @@ -1 +1 @@ -'cpp-options': -traditional is not portable C-preprocessor flag +'cpp-options: -traditional' is not a portable C-preprocessor flag. diff --git a/Cabal-tests/tests/ParserTests/regressions/denormalised-paths.cabal b/Cabal-tests/tests/ParserTests/regressions/denormalised-paths.cabal index 338109cabda..9fb2f39cbe9 100644 --- a/Cabal-tests/tests/ParserTests/regressions/denormalised-paths.cabal +++ b/Cabal-tests/tests/ParserTests/regressions/denormalised-paths.cabal @@ -29,8 +29,12 @@ tested-with: || ==8.8.1 extra-source-files: + -- this is fine + files/**/*.md + -- collection of invalid paths files/**/*.txt/ files/../foo.txt + files/<>/*.txt source-repository head type: git @@ -69,3 +73,6 @@ library -- this is the only case catched by Cabal-3.0.2.0 hs-source-dirs: ../../assoc/src + + -- globs not allowed in field + c-sources: c/**/*.c diff --git a/Cabal-tests/tests/ParserTests/regressions/denormalised-paths.check b/Cabal-tests/tests/ParserTests/regressions/denormalised-paths.check index 02fe04a457b..84eade4e941 100644 --- a/Cabal-tests/tests/ParserTests/regressions/denormalised-paths.check +++ b/Cabal-tests/tests/ParserTests/regressions/denormalised-paths.check @@ -1,12 +1,11 @@ The 'subdir' field of a source-repository is not a good relative path: "trailing same directory segment: ." +The paths 'files/<>/*.txt', 'c/**/*.c', 'C:foo/bar', '||s' are invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$". 'hs-source-dirs: ../../assoc/src' is a relative path outside of the source tree. This will not work when generating a tarball with 'sdist'. -'extra-source-files: files/**/*.txt/' is not good relative path: trailing slash -'extra-source-files: files/../foo.txt' is not good relative path: parent directory segment: .. -'license-file: LICENSE2/' is not good relative path: trailing slash -'license-file: .' is not good relative path: trailing dot segment -'hs-source-dirs: src/.' is not good relative path: trailing same directory segment: . -'hs-source-dirs: src/../src' is not good relative path: parent directory segment: .. -'hs-source-dirs: src/../../assoc/src' is not good relative path: parent directory segment: .. -'hs-source-dirs: C:foo/bar' is not good relative path: reserved character ':' -'hs-source-dirs: ||s' is not good relative path: reserved character '|' -'hs-source-dirs: ../../assoc/src' is not good relative path: parent directory segment: .. +'extra-source-files: files/**/*.txt/' is not a good relative path: "trailing slash" +'extra-source-files: files/../foo.txt' is not a good relative path: "parent directory segment: .." +'license-file: LICENSE2/' is not a good relative path: "trailing slash" +'license-file: .' is not a good relative path: "trailing dot segment" +'hs-source-dirs: src/.' is not a good relative path: "trailing same directory segment: ." +'hs-source-dirs: src/../src' is not a good relative path: "parent directory segment: .." +'hs-source-dirs: src/../../assoc/src' is not a good relative path: "parent directory segment: .." +'hs-source-dirs: ../../assoc/src' is not a good relative path: "parent directory segment: .." diff --git a/Cabal-tests/tests/ParserTests/regressions/extensions-paths-5054.check b/Cabal-tests/tests/ParserTests/regressions/extensions-paths-5054.check index 6268308c77d..d6a6dac2aa2 100644 --- a/Cabal-tests/tests/ParserTests/regressions/extensions-paths-5054.check +++ b/Cabal-tests/tests/ParserTests/regressions/extensions-paths-5054.check @@ -1 +1 @@ -The package uses RebindableSyntax with OverloadedStrings or OverloadedLists in default-extensions, and also Paths_ autogen module. That configuration is known to cause compile failures with Cabal < 2.2. To use these default-extensions with Paths_ autogen module specify at least 'cabal-version: 2.2'. +Packages using RebindableSyntax with OverloadedStrings or OverloadedLists in default-extensions, in conjunction with the autogenerated module Paths_*, are known to cause compile failures with Cabal < 2.2. To use these default-extensions with a Paths_* autogen module, specify at least 'cabal-version: 2.2'. diff --git a/Cabal/src/Distribution/PackageDescription/Check.hs b/Cabal/src/Distribution/PackageDescription/Check.hs index d0f5fa1462d..680a9ab1180 100644 --- a/Cabal/src/Distribution/PackageDescription/Check.hs +++ b/Cabal/src/Distribution/PackageDescription/Check.hs @@ -440,10 +440,9 @@ checkFields pkg = check (not . FilePath.Windows.isValid . prettyShow . packageName $ pkg) $ PackageDistInexcusable $ - "Unfortunately, the package name '" ++ prettyShow (packageName pkg) - ++ "' is one of the reserved system file names on Windows. Many tools " - ++ "need to convert package names to file names so using this name " - ++ "would cause problems." + "The package name '" ++ prettyShow (packageName pkg) ++ "' is " + ++ "invalid on Windows. Many tools need to convert package names to " + ++ "file names so using this name would cause problems." , check ((isPrefixOf "z-") . prettyShow . packageName $ pkg) $ PackageDistInexcusable $ @@ -768,10 +767,6 @@ checkSourceRepos pkg = PackageDistInexcusable "The 'subdir' field of a source-repository must be a relative path." - , check (maybe False isAbsoluteOnAnyPlatform (repoSubdir repo)) $ - PackageDistInexcusable - "The 'subdir' field of a source-repository must be a relative path." - , do subdir <- repoSubdir repo err <- isGoodRelativeDirectoryPath subdir @@ -1041,7 +1036,7 @@ checkCPPOptions pkg = catMaybes [ (flag, dir) | flag@('-':'I':dir) <- all_cppOptions ] ] ++ - [ PackageBuildWarning $ "'cpp-options': " ++ opt ++ " is not portable C-preprocessor flag" + [ PackageBuildWarning $ "'cpp-options: " ++ opt ++ "' is not a portable C-preprocessor flag." | opt <- all_cppOptions -- "-I" is handled above, we allow only -DNEWSTUFF and -UOLDSTUFF , not $ any (`isPrefixOf` opt) ["-D", "-U", "-I" ] @@ -1063,9 +1058,15 @@ data PathKind = PathKindFile | PathKindDirectory | PathKindGlob + deriving (Eq) checkPaths :: PackageDescription -> [PackageCheck] checkPaths pkg = + checkPackageFileNamesWithGlob + [ (kind == PathKindGlob, path) + | (path, _, kind) <- relPaths ++ absPaths + ] + ++ [ PackageBuildWarning $ quote (field ++ ": " ++ path) ++ " is a relative path outside of the source tree. " @@ -1074,12 +1075,13 @@ checkPaths pkg = , isOutsideTree path ] ++ [ PackageDistInexcusable $ - quote (field ++ ": " ++ path) ++ " is an absolute path." + quote (field ++ ": " ++ path) ++ " specifies an absolute path, but the " + ++ quote field ++ " field must use relative paths." | (path, field, _) <- relPaths , isAbsoluteOnAnyPlatform path ] ++ [ PackageDistInexcusable $ - quote (field ++ ": " ++ path) ++ " is not good relative path: " ++ err + quote (field ++ ": " ++ path) ++ " is not a good relative path: " ++ show err | (path, field, kind) <- relPaths -- these are not paths, but globs... , err <- maybeToList $ case kind of @@ -1098,7 +1100,7 @@ checkPaths pkg = , isInsideDist path ] ++ [ PackageDistInexcusable $ - "The 'ghc-options' contains the path '" ++ path ++ "' which points " + "The 'ghc-options' contain the path '" ++ path ++ "' which points " ++ "inside the 'dist' directory. This is not reliable because the " ++ "location of this directory is configurable by the user (or package " ++ "manager). In addition the layout of the 'dist' directory is subject " @@ -1285,12 +1287,12 @@ checkCabalVersion pkg = ++ "so you need to specify 'cabal-version: >= 1.6'." -- check for new language extensions - , checkVersion CabalSpecV1_4 (not (null mentionedExtensionsThatNeedCabal12)) $ + , checkVersion CabalSpecV1_2 (not (null mentionedExtensionsThatNeedCabal12)) $ PackageDistInexcusable $ "Unfortunately the language extensions " ++ commaSep (map (quote . prettyShow) mentionedExtensionsThatNeedCabal12) ++ " break the parser in earlier Cabal versions so you need to " - ++ "specify 'cabal-version: >= 1.4'. Alternatively if you require " + ++ "specify 'cabal-version: >= 1.2'. Alternatively if you require " ++ "compatibility with earlier Cabal versions then you may be able to " ++ "use an equivalent compiler-specific flag." @@ -1572,11 +1574,11 @@ checkPathsModuleExtensions pd | specVersion pd >= CabalSpecV2_2 = [] | any checkBI (allBuildInfo pd) || any checkLib (allLibraries pd) = return $ PackageBuildImpossible $ unwords - [ "The package uses RebindableSyntax with OverloadedStrings or OverloadedLists" - , "in default-extensions, and also Paths_ autogen module." - , "That configuration is known to cause compile failures with Cabal < 2.2." - , "To use these default-extensions with Paths_ autogen module" - , "specify at least 'cabal-version: 2.2'." + [ "Packages using RebindableSyntax with OverloadedStrings or" + , "OverloadedLists in default-extensions, in conjunction with the" + , "autogenerated module Paths_*, are known to cause compile failures" + , "with Cabal < 2.2. To use these default-extensions with a Paths_*" + , "autogen module, specify at least 'cabal-version: 2.2'." ] | otherwise = [] where @@ -1623,7 +1625,7 @@ checkDevelopmentOnlyFlagsOptions fieldName ghcOptions = PackageDistInexcusable $ "'" ++ fieldName ++ ": -Werror' makes the package easy to " ++ "break with future GHC versions because new GHC versions often " - ++ "add new warnings. " + ++ "add new warnings." ++ extraExplanation , check (has_J) $ @@ -1635,7 +1637,7 @@ checkDevelopmentOnlyFlagsOptions fieldName ghcOptions = , checkFlags ["-fdefer-type-errors"] $ PackageDistInexcusable $ "'" ++ fieldName ++ ": -fdefer-type-errors' is fine during development but " - ++ "is not appropriate for a distributed package. " + ++ "is not appropriate for a distributed package." ++ extraExplanation -- -dynamic is not a debug flag @@ -1643,7 +1645,7 @@ checkDevelopmentOnlyFlagsOptions fieldName ghcOptions = ghcOptions) $ PackageDistInexcusable $ "'" ++ fieldName ++ ": -d*' debug flags are not appropriate " - ++ "for a distributed package. " + ++ "for a distributed package." ++ extraExplanation , checkFlags ["-fprof-auto", "-fprof-auto-top", "-fprof-auto-calls", @@ -1656,7 +1658,7 @@ checkDevelopmentOnlyFlagsOptions fieldName ghcOptions = ++ "that use this one these flags clutter the profile output with " ++ "excessive detail. If you think other packages really want to see " ++ "cost centres from this package then use '-fprof-auto-exported' " - ++ "which puts cost centres only on exported functions. " + ++ "which puts cost centres only on exported functions." ++ extraExplanation ] where @@ -1841,8 +1843,8 @@ checkCabalFileName ops pkg = do Right pdfile | takeFileName pdfile == expectedCabalname -> return Nothing | otherwise -> return $ Just $ PackageDistInexcusable $ - "The filename " ++ pdfile ++ " does not match package name " ++ - "(expected: " ++ expectedCabalname ++ ")" + "The filename " ++ quote pdfile ++ " does not match package name " ++ + "(expected: " ++ quote expectedCabalname ++ ")" where pkgname = unPackageName . packageName $ pkg expectedCabalname = pkgname <.> "cabal" @@ -1934,7 +1936,7 @@ checkLocalPathsExist ops pkg = do missing <- filterM (liftM not . doesDirectoryExist ops . fst) dirs return [ PackageBuildWarning { explanation = quote (kind ++ ": " ++ dir) - ++ " directory does not exist." + ++ " specifies a directory which does not exist." } | (dir, kind) <- missing ] @@ -1976,25 +1978,39 @@ repoTypeDirname Pijul = [".pijul"] -- should be done for example when creating or validating a package tarball. -- checkPackageFileNames :: [FilePath] -> [PackageCheck] -checkPackageFileNames files = - (take 1 . mapMaybe checkWindowsPath $ files) - ++ (take 1 . mapMaybe checkTarPath $ files) - -- If we get any of these checks triggering then we're likely to get - -- many, and that's probably not helpful, so return at most one. - -checkWindowsPath :: FilePath -> Maybe PackageCheck -checkWindowsPath path = - check (not $ FilePath.Windows.isValid path') $ - PackageDistInexcusable $ - "Unfortunately, the file " ++ quote path ++ " is not a valid file " - ++ "name on Windows which would cause portability problems for this " - ++ "package. Windows file names cannot contain any of the characters " - ++ "\":*?<>|\" and there are a few reserved names including \"aux\", " - ++ "\"nul\", \"con\", \"prn\", \"com1-9\", \"lpt1-9\" and \"clock$\"." +checkPackageFileNames = checkPackageFileNamesWithGlob . zip (repeat True) + +checkPackageFileNamesWithGlob :: [(Bool, FilePath)] -> [PackageCheck] +checkPackageFileNamesWithGlob files = + catMaybes $ + checkWindowsPaths files + : + [ checkTarPath file + | (_, file) <- files + ] + +checkWindowsPaths :: [(Bool, FilePath)] -> Maybe PackageCheck +checkWindowsPaths paths = + case filter (not . FilePath.Windows.isValid . escape) paths of + [] -> Nothing + ps -> Just $ + PackageDistInexcusable $ + "The " ++ quotes (map snd ps) ++ " invalid on Windows, which " + ++ "would cause portability problems for this package. Windows file " + ++ "names cannot contain any of the characters \":*?<>|\" and there " + ++ "a few reserved names including \"aux\", \"nul\", \"con\", " + ++ "\"prn\", \"com1-9\", \"lpt1-9\" and \"clock$\"." where - path' = ".\\" ++ path -- force a relative name to catch invalid file names like "f:oo" which -- otherwise parse as file "oo" in the current directory on the 'f' drive. + escape (isGlob, path) = (".\\" ++) + -- glob paths will be expanded before being dereferenced, so asterisks + -- shouldn't count against them. + $ map (\c -> if c == '*' && isGlob then 'x' else c) path + quotes [failed] = + "path " ++ quote failed ++ " is" + quotes failed = + "paths " ++ intercalate ", " (map quote failed) ++ " are" -- | Check a file name is valid for the portable POSIX tar format. -- @@ -2183,68 +2199,56 @@ fileExtensionSupportedLanguage path = -- -- Lastly, not good file nor directory cases: -- --- >>> traverse_ test ["", "/tmp/src", "foo//bar", "foo/.", "foo/./bar", "foo/../bar", "foo*bar"] +-- >>> traverse_ test ["", "/tmp/src", "foo//bar", "foo/.", "foo/./bar", "foo/../bar"] -- Just "empty path"; Just "empty path" -- Just "posix absolute path"; Just "posix absolute path" -- Just "empty path segment"; Just "empty path segment" -- Just "trailing same directory segment: ."; Just "trailing same directory segment: ." -- Just "same directory segment: ."; Just "same directory segment: ." -- Just "parent directory segment: .."; Just "parent directory segment: .." --- Just "reserved character '*'"; Just "reserved character '*'" -- -- For the last case, 'isGoodRelativeGlob' doesn't warn: -- --- >>> traverse_ (print . isGoodRelativeGlob) ["foo/../bar", "foo*bar"] +-- >>> traverse_ (print . isGoodRelativeGlob) ["foo/../bar"] -- Just "parent directory segment: .." --- Nothing -- isGoodRelativeFilePath :: FilePath -> Maybe String isGoodRelativeFilePath = state0 where - -- Reserved characters - -- https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - isReserved c = c `elem` "<>:\"\\/|?*" - -- initial state state0 [] = Just "empty path" state0 (c:cs) | c == '.' = state1 cs | c == '/' = Just "posix absolute path" - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state5 cs -- after initial . state1 [] = Just "trailing dot segment" state1 (c:cs) | c == '.' = state4 cs | c == '/' = state2 cs - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state5 cs -- after ./ or after / between segments state2 [] = Just "trailing slash" state2 (c:cs) | c == '.' = state3 cs | c == '/' = Just "empty path segment" - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state5 cs -- after non-first segment's . state3 [] = Just "trailing same directory segment: ." state3 (c:cs) | c == '.' = state4 cs | c == '/' = Just "same directory segment: ." - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state5 cs -- after .. state4 [] = Just "trailing parent directory segment: .." state4 (c:cs) | c == '.' = state5 cs | c == '/' = Just "parent directory segment: .." - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state5 cs -- in a segment which is ok. state5 [] = Nothing state5 (c:cs) | c == '.' = state5 cs | c == '/' = state2 cs - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state5 cs -- | See 'isGoodRelativeFilePath'. @@ -2260,50 +2264,40 @@ isGoodRelativeGlob = isGoodRelativeFilePath . map f where isGoodRelativeDirectoryPath :: FilePath -> Maybe String isGoodRelativeDirectoryPath = state0 where - -- Reserved characters - -- https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file - isReserved c = c `elem` "<>:\"\\/|?*" - -- initial state state0 [] = Just "empty path" state0 (c:cs) | c == '.' = state5 cs | c == '/' = Just "posix absolute path" - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state4 cs -- after initial ./ or after / between segments state1 [] = Nothing state1 (c:cs) | c == '.' = state2 cs | c == '/' = Just "empty path segment" - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state4 cs -- after non-first setgment's . state2 [] = Just "trailing same directory segment: ." state2 (c:cs) | c == '.' = state3 cs | c == '/' = Just "same directory segment: ." - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state4 cs -- after .. state3 [] = Just "trailing parent directory segment: .." state3 (c:cs) | c == '.' = state4 cs | c == '/' = Just "parent directory segment: .." - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state4 cs -- in a segment which is ok. state4 [] = Nothing state4 (c:cs) | c == '.' = state4 cs | c == '/' = state1 cs - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state4 cs -- after initial . state5 [] = Nothing -- "." state5 (c:cs) | c == '.' = state3 cs | c == '/' = state1 cs - | isReserved c = Just ("reserved character " ++ show c) | otherwise = state4 cs -- [Note: Good relative paths] @@ -2315,11 +2309,11 @@ isGoodRelativeDirectoryPath = state0 -- import Kleene -- import Kleene.ERE (ERE (..), intersections) -- --- data C = CDot | CSlash | COtherReserved | CChar +-- data C = CDot | CSlash | CChar -- deriving (Eq, Ord, Enum, Bounded, Show) -- -- reservedR :: ERE C --- reservedR = notChar CSlash /\ notChar COtherReserved +-- reservedR = notChar CSlash -- -- pathPieceR :: ERE C -- pathPieceR = intersections @@ -2346,31 +2340,24 @@ isGoodRelativeDirectoryPath = state0 -- @ -- 0 -> \x -> if -- | x <= CDot -> 1 --- | x <= COtherReserved -> 6 -- | otherwise -> 5 -- 1 -> \x -> if -- | x <= CDot -> 4 -- | x <= CSlash -> 2 --- | x <= COtherReserved -> 6 -- | otherwise -> 5 -- 2 -> \x -> if -- | x <= CDot -> 3 --- | x <= COtherReserved -> 6 -- | otherwise -> 5 -- 3 -> \x -> if -- | x <= CDot -> 4 --- | x <= COtherReserved -> 6 -- | otherwise -> 5 -- 4 -> \x -> if -- | x <= CDot -> 5 --- | x <= COtherReserved -> 6 -- | otherwise -> 5 -- 5+ -> \x -> if -- | x <= CDot -> 5 -- | x <= CSlash -> 2 --- | x <= COtherReserved -> 6 -- | otherwise -> 5 --- 6 -> \_ -> 6 -- black hole -- @ -- -- and @dirPathR@: @@ -2378,29 +2365,22 @@ isGoodRelativeDirectoryPath = state0 -- @ -- 0 -> \x -> if -- | x <= CDot -> 5 --- | x <= COtherReserved -> 6 -- | otherwise -> 4 -- 1+ -> \x -> if -- | x <= CDot -> 2 --- | x <= COtherReserved -> 6 -- | otherwise -> 4 -- 2 -> \x -> if -- | x <= CDot -> 3 --- | x <= COtherReserved -> 6 -- | otherwise -> 4 -- 3 -> \x -> if -- | x <= CDot -> 4 --- | x <= COtherReserved -> 6 -- | otherwise -> 4 -- 4+ -> \x -> if -- | x <= CDot -> 4 -- | x <= CSlash -> 1 --- | x <= COtherReserved -> 6 -- | otherwise -> 4 -- 5+ -> \x -> if -- | x <= CDot -> 3 -- | x <= CSlash -> 1 --- | x <= COtherReserved -> 6 -- | otherwise -> 4 --- 6 -> \_ -> 6 -- black hole -- @ diff --git a/cabal-testsuite/PackageTests/AutogenModules/Package/setup.cabal.out b/cabal-testsuite/PackageTests/AutogenModules/Package/setup.cabal.out index c31ecaec961..3554cdf926d 100644 --- a/cabal-testsuite/PackageTests/AutogenModules/Package/setup.cabal.out +++ b/cabal-testsuite/PackageTests/AutogenModules/Package/setup.cabal.out @@ -14,7 +14,7 @@ On executable 'Exe' an 'autogen-module' is not on 'other-modules' On test suite 'Test' an 'autogen-module' is not on 'other-modules' On benchmark 'Bench' an 'autogen-module' is not on 'other-modules' Packages using 'cabal-version: 2.0' and the autogenerated module Paths_* must include it also on the 'autogen-modules' field besides 'exposed-modules' and 'other-modules'. This specifies that the module does not come with the package and is generated on setup. Modules built with a custom Setup.hs script also go here to ensure that commands like sdist don't fail. -The filename ./my.cabal does not match package name (expected: AutogenModules.cabal) +The filename './my.cabal' does not match package name (expected: 'AutogenModules.cabal') Note: the public hackage server would reject this package. Building source dist for AutogenModules-0.1... cabal: Error: Could not find module: MyLibHelperModule with any suffix: ["gc","chs","hsc","x","y","ly","cpphs","hs","lhs","hsig","lhsig"]. If the module is autogenerated it should be added to 'autogen-modules'. diff --git a/cabal-testsuite/PackageTests/AutogenModules/Package/setup.out b/cabal-testsuite/PackageTests/AutogenModules/Package/setup.out index d557874e1fb..d26d2133ecb 100644 --- a/cabal-testsuite/PackageTests/AutogenModules/Package/setup.out +++ b/cabal-testsuite/PackageTests/AutogenModules/Package/setup.out @@ -14,7 +14,7 @@ On executable 'Exe' an 'autogen-module' is not on 'other-modules' On test suite 'Test' an 'autogen-module' is not on 'other-modules' On benchmark 'Bench' an 'autogen-module' is not on 'other-modules' Packages using 'cabal-version: 2.0' and the autogenerated module Paths_* must include it also on the 'autogen-modules' field besides 'exposed-modules' and 'other-modules'. This specifies that the module does not come with the package and is generated on setup. Modules built with a custom Setup.hs script also go here to ensure that commands like sdist don't fail. -The filename ./my.cabal does not match package name (expected: AutogenModules.cabal) +The filename './my.cabal' does not match package name (expected: 'AutogenModules.cabal') Note: the public hackage server would reject this package. Building source dist for AutogenModules-0.1... setup: Error: Could not find module: MyLibHelperModule with any suffix: ["gc","chs","hsc","x","y","ly","cpphs","hs","lhs","hsig","lhsig"]. If the module is autogenerated it should be added to 'autogen-modules'. diff --git a/changelog.d/path-validation b/changelog.d/path-validation new file mode 100644 index 00000000000..79e3f0d7b9b --- /dev/null +++ b/changelog.d/path-validation @@ -0,0 +1,11 @@ +synopsis: Fix bugs in filename validation +packages: Cabal +prs: #7429 #7479 +issues: #7426 + +description: { + +- Relative paths starting with single-character directories are now properly allowed +- `cabal check` rejects paths which are invalid on Windows or in tarballs + +} diff --git a/changelog.d/rel-path-check b/changelog.d/rel-path-check deleted file mode 100644 index 69e6b3a936c..00000000000 --- a/changelog.d/rel-path-check +++ /dev/null @@ -1,4 +0,0 @@ -synopsis: Allow relative paths starting with single-charater directories -packages: Cabal -prs: #7429 -issues: #7426