This is an archive of the discontinued LLVM Phabricator instance.

Strip file path from the -o option while creating reproduce.txt
ClosedPublic

Authored by dmikulin on Jan 30 2017, 2:10 PM.

Details

Summary

This is a fix for Bugzilla 28579.
The problem is that in --reproduce links the file path in -o option is copied verbatim. When "lld @response.txt" link is run against the extracted test case, if -o contains anything other that a plain file name, the link will likely fail because the target directory in -o may not exists. Stripping the directory path will create the output file in the top level test directory.

Diff Detail

Event Timeline

dmikulin created this revision.Jan 30 2017, 2:10 PM
davide edited edge metadata.Jan 30 2017, 2:15 PM

Please upload this patch with context git diff -U9999999 (or the equivalent svn command).

dmikulin updated this revision to Diff 86345.Jan 30 2017, 2:18 PM

I think this is the right direction. The alternative would be to create the intermediate directories in the archive we're building, but that seems more complicated for pretty much no additional benefit.
Rui, what do you think? Also, make sure this works on Windows (it should just fine, but better making sure to avoid failures on the bots).

dmikulin updated this revision to Diff 86363.Jan 30 2017, 4:11 PM

Minor formatting change.

ruiu edited edge metadata.Jan 30 2017, 4:13 PM

This bit me a few times, so I think this is a good addition. Thank you for doing this!

ELF/DriverUtils.cpp
139

Since we know it is "-o", OS << "-o " << is more straightforward.

Please add a comment why you are stripping directory parts from a path.

// If an output path contains directories, "lld @response.txt" will likely
// to fail because the archive we are creating doesn't contain empty
// directories for the output path (-o doesn't create directories).
// Strip directories to prevent the issue.
dmikulin updated this revision to Diff 86364.Jan 30 2017, 4:23 PM

Added a comment and changed the output to explicit "-o "

ruiu accepted this revision.Jan 30 2017, 4:34 PM

LGTM

This revision is now accepted and ready to land.Jan 30 2017, 4:34 PM
davide accepted this revision.Jan 30 2017, 4:37 PM

LGTM.

silvas edited edge metadata.Feb 1 2017, 1:45 PM

Thanks for working on this!

rafael closed this revision.Feb 2 2017, 2:34 PM
rafael edited edge metadata.

Committed as r293792