Page MenuHomePhabricator

[lldb/PlatformDarwin] Always delete destination file first in PutFile
ClosedPublic

Authored by friss on Mar 19 2020, 1:24 PM.

Details

Summary

The default behavior of Platform::PutFile is to open the file and
truncate it if it already exists. This works fine and is a sensible
default, but it interacts badly with code-signing on iOS, as doing so
invalidates the signature of the file (even if the new content has a
valid code signature).

We have a couple tests which on purpose reload a different binary with
the same name. Those tests are currently broken because of the above
interaction.

This patch simply makes the Darwin platform unconditionally delete the
destination file before sending the new one to work around this issue.

Diff Detail

Event Timeline

friss created this revision.Mar 19 2020, 1:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2020, 1:24 PM
jasonmolenda accepted this revision.Mar 19 2020, 1:59 PM

nice catch, lgtm.

This revision is now accepted and ready to land.Mar 19 2020, 1:59 PM
This revision was automatically updated to reflect the committed changes.