This is an archive of the discontinued LLVM Phabricator instance.

[modules] Diagnose insufficient privileges when trying to load the modulemap
AbandonedPublic

Authored by davide on Mar 9 2016, 12:39 PM.

Details

Summary

I stumbled upon this yesterday. Without this patch in palce, the module map load is silently ignored, and this might cause subtle breakages.

Diff Detail

Event Timeline

davide updated this revision to Diff 50180.Mar 9 2016, 12:39 PM
davide updated this revision to Diff 50181.
davide retitled this revision from to [modules] Diagnose insufficient privileges when trying to load the modulemap.
davide updated this object.
davide added reviewers: rsmith, silvas, doug.gregor.
davide added a subscriber: cfe-commits.

Typo.

silvas edited edge metadata.Mar 9 2016, 3:42 PM

Isn't there a read call or something that fails down the road? How can it be silent?

Hmm, I think you're right. It's not actually that silent (it fails with a fatal error when trying to load/read).
That said, I think it might still be valuable to emit a diagnostic -- Richard what do you think?

I noticed you reported a very similar problem here: https://llvm.org/bugs/show_bug.cgi?id=20468

Also, I looked at the code more closely and I think the right place to diagnose this would be lib/Frontend/FrontendAction.cpp, in BeginSourceFile, around line 390, and not where I'm diagnosing it right now. Thoughts?

rsmith edited edge metadata.Mar 18 2016, 8:39 AM

I would prefer that we solve this problem generically for all files that Clang tries to open, not just for module map files. (Note, for instance, that PR20468 concerns files referenced by module map files, such as their nominated headers, not the module map files themselves.)

lib/Frontend/FrontendActions.cpp
269

Why don't we fail up here when trying to open the file for read?

silvas resigned from this revision.Jul 8 2016, 11:43 PM
silvas removed a reviewer: silvas.
davide abandoned this revision.Sep 9 2016, 1:48 PM