This is an archive of the discontinued LLVM Phabricator instance.

Ignore LC_CTYPE in sed invocation on Darwin
ClosedPublic

Authored by pipping.elias on Jan 25 2016, 12:03 PM.

Details

Summary

Here, sed is used to prepare object files for comparison via cmp. On my Darwin 15.4.0 machine, LC_CTYPE is set to UTF-8 (by default, I believe). Under these circumstances, anything sed is made to read will be treated as UTF-8, prompting it to signal an error if it is not, like so:

% sed s/a/b/ <(head -n1 /dev/random) >/dev/null; echo $?
sed: RE error: illegal byte sequence
1
%

To make sed work as expected, I need to set LC_CTYPE to C:

% env LC_CTYPE=C sed s/a/b/ <(head -n1 /dev/random) >/dev/null; echo $?
0
%

Without this change, sed will exit with an error for every single file that it compares between phase 2 and phase 3, thereby making it look as if the differences were far larger than they are.

Diff Detail

Repository
rL LLVM

Event Timeline

pipping.elias retitled this revision from to Ignore LC_CTYPE in sed invocation on Darwin.
pipping.elias updated this object.
pipping.elias added a reviewer: hans.
pipping.elias updated this object.
pipping.elias added a subscriber: llvm-commits.
hans added inline comments.Jan 25 2016, 1:03 PM
test-release.sh
544 ↗(On Diff #45897)

Please move the line break here to make it fit in 80 columns.

Limit of 80 characters per line now respected!

pipping.elias marked an inline comment as done.Jan 26 2016, 4:47 AM
hans accepted this revision.Jan 26 2016, 10:37 AM
hans edited edge metadata.

LGTM, thanks.

Do you have commit access, or would you like me to commit this for you?

This revision is now accepted and ready to land.Jan 26 2016, 10:37 AM

I do not have commit access. I you could commit this for me, I'd appreciate that :)

This revision was automatically updated to reflect the committed changes.
hans added a comment.Jan 26 2016, 4:24 PM

And merged to 3.8 in r258892.