cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Make cabal check reject packages with invalid file names

Open phadej opened this issue 1 year ago • 3 comments

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.

phadej avatar Aug 30 '24 14:08 phadej

Sounds reasonable. @ffaf1, any thoughts?

ulysses4ever avatar Aug 30 '24 14:08 ulysses4ever

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.

ffaf1 avatar Aug 31 '24 10:08 ffaf1

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...)

phadej avatar Aug 31 '24 23:08 phadej

I have put up a MR #10816

Let me know if you think this is along the right lines. There are already quite comprehensive checks in place for most of the paths you can write in a cabal file but not the module names.

mpickering avatar Mar 05 '25 16:03 mpickering