haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.61k stars 691 forks source link

Make cabal check reject packages with invalid file names #10295

Open phadej opened 2 weeks ago

phadej commented 2 weeks ago

Describe the feature request

Make cabal check reject packages when source distribution contains files with invalid names on any operating system. For example aux is not valid on Windows (and Windows file systems are case insensitive)., so e.g. module Foo.Aux.Helpers or Language.Con, Foreign.Nul are a bad idea.

Additional context

I think calling explicitly, System.FilePath.Posix.isValid and System.FilePath.Windows.isValid would be enough.

ulysses4ever commented 2 weeks ago

Sounds reasonable. @ffaf1, any thoughts?

ffaf1 commented 2 weeks ago

It is a sensible request. We already do some isValid checks with regard to Windows

https://github.com/haskell/cabal/blob/1e93e57d20801a333c6fae05573c2e0687a17e75/Cabal/src/Distribution/PackageDescription/Check.hs#L574-L580

We just need to get this right with regard to — say — excluding autogenerated modules and the like.

phadej commented 2 weeks ago

We just need to get this right with regard to — say — excluding autogenerated modules

You don't need to exclude them. Autogenerated modules will also have files on the filesystem. (EDIT: when autogenerated...)