Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: --incompatible_use_native_patch doesn't work with some patch format generated by diff #9222

Closed
meteorcloudy opened this issue Aug 22, 2019 · 0 comments
Assignees
Labels
breakage P1 I'll work on this now. (Assignee required) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug

Comments

@meteorcloudy
Copy link
Member

meteorcloudy commented Aug 22, 2019

Breakages after flipping --incompatible_use_native_patch:
https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1154#d51abae7-8a0d-4aa4-9e6d-6bafb05386c7

When doing diff on one liner file, it'll output such diff content:

$ echo "123" > foo
$ touch > bar
$ diff -u foo bar
--- foo 2019-08-22 10:06:50.635949900 +0200
+++ bar 2019-08-22 10:07:05.706701700 +0200
@@ -1 +0,0 @@
-123
$ diff -u bar foo
--- bar 2019-08-22 10:07:05.706701700 +0200
+++ foo 2019-08-22 10:06:50.635949900 +0200
@@ -0,0 +1 @@
+123

Note that @@ -1 +0,0 @@ and @@ -0,0 +1 @@ is not the complete header format.
(should be @@ -1,1 +0,0 @@ and @@ -0,0 +1,1 @@)

The native patch should support such format because it's generated by diff or git diff

@meteorcloudy meteorcloudy added type: bug P1 I'll work on this now. (Assignee required) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website labels Aug 22, 2019
@meteorcloudy meteorcloudy self-assigned this Aug 22, 2019
katre pushed a commit that referenced this issue Aug 23, 2019
`diff` generate incomplete header for adding or removing one line file.
Eg.
"""
--- foo
+++ bar
@@ -1 +0,0 @@  # Should be @@ -1,1 +0,0 @@
-hello, world
"""

We set the default value to 1 when the size info is missing.
Similar logic in `git apply` implementation:
https://github.com/git/git/blob/5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9/apply.c#L1400

Fixes #9222

RELNOTES: None
PiperOrigin-RevId: 264799477
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breakage P1 I'll work on this now. (Assignee required) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug
Projects
None yet
Development

No branches or pull requests

1 participant