This is an archive of the discontinued LLVM Phabricator instance.

createUniqueFile() is documented to create the file in the temporary directory unless it's supplied an absolute path. Make sure the output filepath supplied to createUniqueFile() in HTMLDiagnostics::ReportDiag() is absolute.
ClosedPublic

Authored by dirty on Sep 10 2015, 2:09 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

dirty updated this revision to Diff 34488.Sep 10 2015, 2:09 PM
dirty retitled this revision from to createUniqueFile() is documented to create the file in the temporary directory unless it's supplied an absolute path. Make sure the output filepath supplied to createUniqueFile() in HTMLDiagnostics::ReportDiag() is absolute..
dirty updated this object.
dirty added reviewers: rsmith, akyrtzi.
dirty added a subscriber: cfe-commits.
akyrtzi edited edge metadata.Sep 16 2015, 11:31 AM
akyrtzi added a subscriber: akyrtzi.

+ Anna

vsk added a subscriber: vsk.Sep 17 2015, 12:03 AM

Could you handle the error code coming out of make_absolute? It looks like it calls current_path(), which can fail in interesting ways.

dirty added a comment.Sep 21 2015, 2:56 PM

Are you suggesting I change the code to something like the following:

if (std::error_code EC =
    llvm::sys::fs::make_absolute(Model)) {
    llvm::errs() << "warning: could not make '" << Model
                 << "' absolute: " << EC.message() << '\n';
  return;
}
vsk added a comment.Sep 22 2015, 8:55 PM

Yes, that looks good.

dirty updated this revision to Diff 35463.Sep 22 2015, 11:02 PM
dirty edited edge metadata.
  • Update patch with feedback from vsk: better handle errors from make_absolute().

Updating D12774: createUniqueFile() is documented to create the file in the temporary directory unless it's supplied an absolute path.

Make sure the output filepath supplied to createUniqueFile() in HTMLDiagnostics::ReportDiag() is absolute.

Should I go ahead and commit this change?

vsk added a comment.Sep 30 2015, 5:15 PM

LGTM, thanks.

dirty added a reviewer: vsk.Sep 30 2015, 5:16 PM
vsk accepted this revision.Sep 30 2015, 5:18 PM
vsk edited edge metadata.
This revision is now accepted and ready to land.Sep 30 2015, 5:18 PM
This revision was automatically updated to reflect the committed changes.