cabal icon indicating copy to clipboard operation
cabal copied to clipboard

broken symlinks for configuration files are silently ignored

Open Flupp opened this issue 1 year ago • 0 comments

When a configuration file like cabal.project, cabal.project.local, or cabal.project.freeze is a broken symlink, it is silently ignored.

For example:

cd "$(mktemp --directory)"
cabal init --exe --simple
ln -s I-do-not-exist cabal.project
cabal build

The last step succeeds unexpectedly.

I see that this behavior is consistent with shell command test -e cabal.project. However, with the current behavior, a subtly wrong symlink can easily be overlooked, especially in an automated build environment (which is actually where I stumbled over it). Hence, I suggest having an existence test more like test -e FILE || test -h FILE.

System information

  • Arch Linux
  • cabal-install version 3.10.3.0 compiled using version 3.10.3.0 of the Cabal library
  • The Glorious Glasgow Haskell Compilation System, version 9.4.8

Flupp avatar Apr 25 '24 16:04 Flupp