git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git grep broken in Fedora 21 update?

From
Jacob Keller <jacob.keller@gmail.com>
Date
Sep 4, 2015, 04:55 UTC
Message-ID
<CA+P7+xqzEHD9kR6suGBb1oXfPx0gehk7KYoUJFip_WcPWxTrPw@mail.gmail.com>
In-Reply-To
<9CAA4751-D295-4ACE-8ED6-720D728D24EA@intel.com>
On Thu, Sep 3, 2015 at 5:04 PM, Rustad, Mark D <mark.d.rustad@intel.com> wrote:
Show 39 quoted lines
> I just found a case where grep and git grep yield different results. Inside the ixgbe directory of the Linux kernel I did:
>
> $ grep enter_lplu *.[ch]
>
> And got the following:
>
> ixgbe_main.c:   if (adapter->hw.phy.ops.enter_lplu) {
> ixgbe_main.c:           adapter->hw.phy.ops.enter_lplu(&adapter->hw);
> ixgbe_type.h:   s32 (*enter_lplu)(struct ixgbe_hw *);
> ixgbe_x550.c:/** ixgbe_enter_lplu_x550em - Transition to low power states
> ixgbe_x550.c:static s32 ixgbe_enter_lplu_t_x550em(struct ixgbe_hw *hw)
> ixgbe_x550.c:                   phy->ops.enter_lplu = ixgbe_enter_lplu_t_x550em;
>
> But when I did:
>
> $ git grep enter_lplu
>
> I got:
>
> ixgbe_main.c:   if (adapter->hw.phy.ops.enter_lplu) {
> ixgbe_main.c:           adapter->hw.phy.ops.enter_lplu(&adapter->hw);
> ixgbe_type.h:   s32 (*enter_lplu)(struct ixgbe_hw *);
> ixgbe_x550.c:/** ixgbe_enter_lplu_x550em - Transition to low power states
> ixgbe_x550.c:static s32 ixgbe_enter_lplu_t_x550em(struct ixgbe_hw *hw)
>
> You can see that git grep missed the line in ixgbe_x550.c that had two hits on the string.
>
> This was with git 2.1.0 in Fedora 21. I use git grep a lot and never noticed a problem before. I just updated my Fedora 21 system yesterday, so I have to figure that has something to do with it. I checked and git didn't get updated, so I figure it must be a library that is really broken.
>
> I see in my update log that pcre was updated to:
>
> pcre.x86_64 0:8.35-12.fc21
> pcre-devel.x86_64 0:8.35-12.fc21
>
> Yet the grep command is unaffected.
>
> --
> Mark Rustad, Networking Division, Intel Corporation
>
I don't know if command line grep uses pcre?

Does git-grep by default ignore changes not yet committed? That was my first thought but I am not very familiar with the tool.

Regards, Jake

Previous: Rustad, Mark DNext: Michael J Gruber
Message 2 of 5 in “git grep broken in Fedora 21 update?”
  1. Rustad, Mark DSep 4, 2015
  2. Jacob KellerSep 4, 2015
  3. Michael J GruberSep 4, 2015
  4. Jeff KingSep 4, 2015
  5. Rustad, Mark DSep 4, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.