Deduplicate `LD_LIBRARY_PATH` when running tests (#8728)
* Deduplicate `LD_LIBRARY_PATH` when running tests
When Cabal runs a test suite, it adds all the dependent libraries to
`LD_LIBRARY_PATH`. In some cases, this can exceed the operating system's
`ARG_MAX` limit:
dist/build/test/test: createProcess: posix_spawnp: resource exhausted (Argument list too long)
However, many of the entries (observed as high as 75%!) in `LD_LIBRARY_PATH`
are duplicates. Deduplicating the list with `Data.List.nub` fixes this error.
This error was originally observed when testing a large commercial
Haskell project (the mercury.com backend). Ideally, `depLibraryPaths`
would be fixed to not return duplicate entries, but this fixup is
low-cost and effective.
* Add changelog entries
---------
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>