From f9fb66cdb7419d2eadf7faea995f1aacb032104b Mon Sep 17 00:00:00 2001 From: YoungSeok Yoon Date: Thu, 28 May 2020 17:27:56 -0700 Subject: [PATCH] Correctly add newline character when concatenating schema generated python srcs The last sed command used for adding the import statement and the '\n' was working as intended on Linux, but was failing on macOS, due to the difference in sed behavior between GNU and BSD. Fixed the issue by using an actual newline character with $'\n', which correctly works on both platforms. Fixes https://github.com/tensorflow/tensorflow/issues/39756 PiperOrigin-RevId: 313691192 Change-Id: I96e5544c03641bae05753e8f7d1346c8aa1c0f6e --- third_party/flatbuffers/build_defs.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/flatbuffers/build_defs.bzl b/third_party/flatbuffers/build_defs.bzl index 9be627119cf..02027aa09f5 100644 --- a/third_party/flatbuffers/build_defs.bzl +++ b/third_party/flatbuffers/build_defs.bzl @@ -362,7 +362,7 @@ def _concat_flatbuffer_py_srcs_impl(ctx): "sed 's/from flatbuffers." + "/from flatbuffers.python.flatbuffers./' |" + "sed '1s/^/from flatbuffers.python " + - "import flatbuffers\\n/' > %s" + "import flatbuffers\\'$'\\n/' > %s" ) % ( ctx.attr.deps[0].files.to_list()[0].path, ctx.outputs.out.path,