Check that libs found by GCC aren't folders
ClosedPublic

Authored by harpocrates on Dec 18 2018, 7:31 PM.

Details

Summary

We use 'gcc -B<base-location> --print-file-name mylib.a' as a way of
checking if 'gcc' can discover 'mylib.a' at the given location. However,
this can break down if there is a folder caller 'mylib.a' that 'gcc' can
discover. We can guard against this by explicitly checking that the path
returned by 'gcc' is a file.

This may seem like a far-fetched scenario, but since
3d17f1f10fc00540ac052f2fd03182906aa47e35, we look for libraries without
any prefix or suffix (ie. 'extra-libraries: softfloat', we look for just
'softfloat' as well as 'softloat.a', 'softfloat.dll.a', etc.) which means
that there might actusally be a folder of that name in one of the base
locations.

harpocrates created this revision.Dec 18 2018, 7:31 PM

I'm unsure whether this is worth making a test case for, but here is a minimal test repo with instructions: https://github.com/benjaminselfridge/uses-softfloat.

With this patch, cabal new-repl won't panic anymore.

Phyx accepted this revision.Dec 19 2018, 3:03 PM
Phyx added a subscriber: angerman.

Hrm.. slightly confused... I'm pretty sure @angerman had the exact same patch last year... but lgtm, this code is no longer on the critical path so don't mind it becomes slower...

This revision is now accepted and ready to land.Dec 19 2018, 3:03 PM
angerman accepted this revision.Dec 19 2018, 5:57 PM

Right. As part of D4762. That didn’t cover ghci though it seems ;)

Friendly ping!

Is there anything that is blocking this from being merged?

Phyx added a comment.Jan 7 2019, 2:58 PM

Oh sorry, I had forgotten to commit this. I'm afraid I haven't sorted out my commit access to the new repository yet.
I'm not really sure what the process now is... Could I ask you to move it to gitlab? point to this review and I'm sure someone will commit it. I'll try to sort out my access this weekend.

In D5462#151388, @Phyx wrote:

Oh sorry, I had forgotten to commit this. I'm afraid I haven't sorted out my commit access to the new repository yet.
I'm not really sure what the process now is... Could I ask you to move it to gitlab? point to this review and I'm sure someone will commit it. I'll try to sort out my access this weekend.

No problem, just want to make sure it doesn't slip through the cracks. :)

I've opened https://gitlab.haskell.org/ghc/ghc/merge_requests/87.

harpocrates closed this revision.Jan 8 2019, 8:34 AM