This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Fix script to work with GNU sed
ClosedPublic

Authored by smeenai on Aug 28 2018, 12:17 PM.

Details

Summary

GNU sed and BSD sed have a different command-line syntax for in-place
editing, and the current form of the script would only work with BSD
sed. The easiest way to get cross-platform behavior is to specify a
backup suffix and then just delete the backup file at the end. (BSD sed
is the default on macOS, but it's possible to acquire GNU coreutils and
have your sed be GNU sed even on macOS; I'm aware it's not officially
supported in any capacity, but it's easy enough to support here.)

An alternative would be using perl -p -i -e instead of sed -i, but I
figured it was best to make the minimal working change.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

smeenai created this revision.Aug 28 2018, 12:17 PM
xiaobai added a reviewer: sas.Aug 28 2018, 4:10 PM
sas accepted this revision.Aug 28 2018, 4:16 PM
This revision is now accepted and ready to land.Aug 28 2018, 4:16 PM
xiaobai accepted this revision.Aug 28 2018, 4:28 PM

Regardless of compatibility, the man page for sed on OSX recommends not having a zero length extension while editing the file in place. LGTM.

This revision was automatically updated to reflect the committed changes.