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 aperta il 1 feb 2023

Vedi su GitHub
 (9 commenti) (7 reazioni) (0 assegnatari)Java (4465 fork)batch import
P2help wantedteam-OSStype: bug

Metriche repository

Star
 (25.384 star)
Metriche merge PR
 (Merge medio 22g 20h) (77 PR mergiate in 30 g)

Descrizione

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.

Guida contributor