All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: git@vger.kernel.org, Gaston Gonzalez <gascoar@gmail.com>
Subject: Re: Bug in 'git am' when applying a broken patch
Date: Mon, 01 Jun 2015 11:31:10 -0700	[thread overview]
Message-ID: <xmqqwpzn5lht.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150601001759.GA3934@kroah.com> (Greg KH's message of "Mon, 1 Jun 2015 09:17:59 +0900")

Greg KH <gregkh@linuxfoundation.org> writes:

> But, there's nothing in the patch at all except the commit message:
>
> $ git show HEAD
> ...
> Any ideas what is going on here?  Shouldn't 'git am' have failed?

Yes.  The patch reads like this:

    ---
     drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)

    diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/...
    index d2e8b12..0477ba1 100644
    --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
    +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
    @@ -660,2 +660,2 @@ inline struct sk_buff *ieee80211_authentic...
            auth = (struct ieee80211_authentication *)
                    skb_put(skb, sizeof(struct ieee80211_authentication));

    -	auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
    -	if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
    +	auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
    +	if (challengelen)
    +		auth->header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_WEP);

            auth->header.duration_id = 0x013a; //FIXME

    --
    2.1.4

    _______________________________________________
    devel mailing list
    devel@linuxdriverproject.org
    http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


It claims that it has only 2 lines in the hunk, so "git apply"
parses the hunk that begins at line 660 as such:

    @@ -660,2 +660,2 @@ inline struct sk_buff *ieee80211_authentic...
            auth = (struct ieee80211_authentication *)
                    skb_put(skb, sizeof(struct ieee80211_authentication));

And then seeing that the next line (which is a blank line, not even
a lone SP on it) does not begin with "@@ -", it says "OK, the
remainder is a cruft after the patch" and discards the rest (which
it must be capable of, to ignore "-- ", "2.1.4", "devel mailing
list", etc.)

There is some safety against not finding a correct patch header
(i.e. "diff --git" line) by detecting a lone "@@ -" while parsing
the patch stream, but there is no logic implemented to detect this
kind of breakage in the code.

  parent reply	other threads:[~2015-06-01 18:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01  0:17 Bug in 'git am' when applying a broken patch Greg KH
2015-06-01  1:54 ` Greg KH
2015-06-01 12:09   ` Christian Couder
2015-06-01 18:31 ` Junio C Hamano [this message]
2015-06-01 18:58   ` Junio C Hamano
2015-06-01 20:09     ` Eric Sunshine
2015-06-01 20:23       ` Junio C Hamano
2015-06-02  1:26         ` Greg KH
2015-06-26 19:49         ` Stefan Beller
2015-06-26 20:58           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqwpzn5lht.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=gascoar@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.