bazelbuild/bazel

Fail to apply patch that adds a new line to the end of the file ("\ No newline at end of file")

Open

#17,376 opened on 2023年2月1日

GitHub で見る
 (9 comments) (7 reactions) (0 assignees)Java (4,465 forks)batch import
P2help wantedteam-OSStype: bug

Repository metrics

Stars
 (25,384 stars)
PR merge metrics
 (平均マージ 22d 20h) (30d で 77 merged PRs)

説明

Hi, I have tried to add a patch to TensorFlow build at https://github.com/tensorflow/tensorflow/blob/master/third_party/llvm/workspace.bzl that contains

--- llvm-project/clang/lib/Format/FormatTokenSource.h
+++ llvm-project/clang/lib/Format/FormatTokenSource.h
@@ -52,7 +52,7 @@
   virtual FormatToken *setPosition(unsigned Position) = 0;
 };
 
-class IndexedTokenSource : public FormatTokenSource {
+class LLVM_GSL_POINTER IndexedTokenSource : public FormatTokenSource {
 public:
   IndexedTokenSource(ArrayRef<FormatToken *> Tokens)
       : Tokens(Tokens), Position(-1) {}
@@ -198,4 +198,4 @@
 
 #undef DEBUG_TYPE
 
-#endif
\ No newline at end of file
+#endif

bazel build fails with

# Error in patch: Error applying patch tf/tensorflow/third_party/llvm/generated.patch: Expecting more chunk line at line 19
# ERROR: tf/tensorflow/WORKSPACE:11]([REDACTED]):14: fetching _tf_http_archive rule //external:llvm-raw: Traceback (most recent call last):
# 	File "/tf/tensorflow/third_party/repo.bzl", line 83, column 30, in _tf_http_archive_impl
# 		ctx.patch(patch_file, strip = 1)
# Error in patch: Error applying patch /tf/tensorflow/third_party/llvm/generated.patch: Expecting more chunk line at line 19
# ERROR: no such package '@llvm-raw//utils/bazel': Error applying patch /tf/tensorflow/third_party/llvm/generated.patch: Expecting more chunk line at line 19

Line 19 is \ No newline at end of file.

removing @@ -198,4 +198,4 @@ fragment that adds a new line from patch fixes the issue.

Will be happy with workarounds too.

コントリビューターガイド