{"thread":{"id":"40269","subject":"git grep broken in Fedora 21 update?","startedAt":"2015-09-04T00:04:38Z","lastAt":"2015-09-04T16:18:39Z","messageCount":5,"participants":["Rustad, Mark D","Jacob Keller","Michael J Gruber","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"269393","messageId":"9CAA4751-D295-4ACE-8ED6-720D728D24EA@intel.com","threadId":"40269","inReplyTo":null,"subject":"git grep broken in Fedora 21 update?","fromName":"Rustad, Mark D","fromEmail":"mark.d.rustad@intel.com","sentAt":"2015-09-04T00:04:38Z","receivedAt":"2015-09-04T00:04:38Z","isPatch":false,"sender":{"key":"mark.d.rustad@intel.com","avatar":null},"body":"I just found a case where grep and git grep yield different results. Inside the ixgbe directory of the Linux kernel I did:\n\n$ grep enter_lplu *.[ch]\n\nAnd got the following:\n\nixgbe_main.c:\tif (adapter->hw.phy.ops.enter_lplu) {\nixgbe_main.c:\t\tadapter->hw.phy.ops.enter_lplu(&adapter->hw);\nixgbe_type.h:\ts32 (*enter_lplu)(struct ixgbe_hw *);\nixgbe_x550.c:/** ixgbe_enter_lplu_x550em - Transition to low power states\nixgbe_x550.c:static s32 ixgbe_enter_lplu_t_x550em(struct ixgbe_hw *hw)\nixgbe_x550.c:\t\t\tphy->ops.enter_lplu = ixgbe_enter_lplu_t_x550em;\n\nBut when I did:\n\n$ git grep enter_lplu\n\nI got:\n\nixgbe_main.c:   if (adapter->hw.phy.ops.enter_lplu) {\nixgbe_main.c:           adapter->hw.phy.ops.enter_lplu(&adapter->hw);\nixgbe_type.h:   s32 (*enter_lplu)(struct ixgbe_hw *);\nixgbe_x550.c:/** ixgbe_enter_lplu_x550em - Transition to low power states\nixgbe_x550.c:static s32 ixgbe_enter_lplu_t_x550em(struct ixgbe_hw *hw)\n\nYou can see that git grep missed the line in ixgbe_x550.c that had two hits on the string.\n\nThis 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.\n\nI see in my update log that pcre was updated to:\n\npcre.x86_64 0:8.35-12.fc21\npcre-devel.x86_64 0:8.35-12.fc21\n\nYet the grep command is unaffected.\n\n--\nMark Rustad, Networking Division, Intel Corporation\n\n"},{"id":"269396","messageId":"CA+P7+xqzEHD9kR6suGBb1oXfPx0gehk7KYoUJFip_WcPWxTrPw@mail.gmail.com","threadId":"40269","inReplyTo":"9CAA4751-D295-4ACE-8ED6-720D728D24EA@intel.com","subject":"Re: git grep broken in Fedora 21 update?","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2015-09-04T04:55:38Z","receivedAt":"2015-09-04T04:55:38Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Thu, Sep 3, 2015 at 5:04 PM, Rustad, Mark D <mark.d.rustad@intel.com> wrote:\n> I just found a case where grep and git grep yield different results. Inside the ixgbe directory of the Linux kernel I did:\n>\n> $ grep enter_lplu *.[ch]\n>\n> And got the following:\n>\n> ixgbe_main.c:   if (adapter->hw.phy.ops.enter_lplu) {\n> ixgbe_main.c:           adapter->hw.phy.ops.enter_lplu(&adapter->hw);\n> ixgbe_type.h:   s32 (*enter_lplu)(struct ixgbe_hw *);\n> ixgbe_x550.c:/** ixgbe_enter_lplu_x550em - Transition to low power states\n> ixgbe_x550.c:static s32 ixgbe_enter_lplu_t_x550em(struct ixgbe_hw *hw)\n> ixgbe_x550.c:                   phy->ops.enter_lplu = ixgbe_enter_lplu_t_x550em;\n>\n> But when I did:\n>\n> $ git grep enter_lplu\n>\n> I got:\n>\n> ixgbe_main.c:   if (adapter->hw.phy.ops.enter_lplu) {\n> ixgbe_main.c:           adapter->hw.phy.ops.enter_lplu(&adapter->hw);\n> ixgbe_type.h:   s32 (*enter_lplu)(struct ixgbe_hw *);\n> ixgbe_x550.c:/** ixgbe_enter_lplu_x550em - Transition to low power states\n> ixgbe_x550.c:static s32 ixgbe_enter_lplu_t_x550em(struct ixgbe_hw *hw)\n>\n> You can see that git grep missed the line in ixgbe_x550.c that had two hits on the string.\n>\n> 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.\n>\n> I see in my update log that pcre was updated to:\n>\n> pcre.x86_64 0:8.35-12.fc21\n> pcre-devel.x86_64 0:8.35-12.fc21\n>\n> Yet the grep command is unaffected.\n>\n> --\n> Mark Rustad, Networking Division, Intel Corporation\n>\n\nI don't know if command line grep uses pcre?\n\nDoes git-grep by default ignore changes not yet committed? That was my\nfirst thought but I am not very familiar with the tool.\n\nRegards,\nJake\n"},{"id":"269418","messageId":"55E99DDC.2000900@drmicha.warpmail.net","threadId":"40269","inReplyTo":"CA+P7+xqzEHD9kR6suGBb1oXfPx0gehk7KYoUJFip_WcPWxTrPw@mail.gmail.com","subject":"Re: git grep broken in Fedora 21 update?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-09-04T13:34:20Z","receivedAt":"2015-09-04T13:34:20Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jacob Keller venit, vidit, dixit 04.09.2015 06:55:\n> On Thu, Sep 3, 2015 at 5:04 PM, Rustad, Mark D <mark.d.rustad@intel.com> wrote:\n>> I just found a case where grep and git grep yield different results. Inside the ixgbe directory of the Linux kernel I did:\n>>\n>> $ grep enter_lplu *.[ch]\n>>\n>> And got the following:\n>>\n>> ixgbe_main.c:   if (adapter->hw.phy.ops.enter_lplu) {\n>> ixgbe_main.c:           adapter->hw.phy.ops.enter_lplu(&adapter->hw);\n>> ixgbe_type.h:   s32 (*enter_lplu)(struct ixgbe_hw *);\n>> ixgbe_x550.c:/** ixgbe_enter_lplu_x550em - Transition to low power states\n>> ixgbe_x550.c:static s32 ixgbe_enter_lplu_t_x550em(struct ixgbe_hw *hw)\n>> ixgbe_x550.c:                   phy->ops.enter_lplu = ixgbe_enter_lplu_t_x550em;\n>>\n>> But when I did:\n>>\n>> $ git grep enter_lplu\n>>\n>> I got:\n>>\n>> ixgbe_main.c:   if (adapter->hw.phy.ops.enter_lplu) {\n>> ixgbe_main.c:           adapter->hw.phy.ops.enter_lplu(&adapter->hw);\n>> ixgbe_type.h:   s32 (*enter_lplu)(struct ixgbe_hw *);\n>> ixgbe_x550.c:/** ixgbe_enter_lplu_x550em - Transition to low power states\n>> ixgbe_x550.c:static s32 ixgbe_enter_lplu_t_x550em(struct ixgbe_hw *hw)\n>>\n>> You can see that git grep missed the line in ixgbe_x550.c that had two hits on the string.\n>>\n>> 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.\n>>\n>> I see in my update log that pcre was updated to:\n>>\n>> pcre.x86_64 0:8.35-12.fc21\n>> pcre-devel.x86_64 0:8.35-12.fc21\n>>\n>> Yet the grep command is unaffected.\n>>\n>> --\n>> Mark Rustad, Networking Division, Intel Corporation\n>>\n> \n> I don't know if command line grep uses pcre?\n> \n> Does git-grep by default ignore changes not yet committed? That was my\n> first thought but I am not very familiar with the tool.\n> \n> Regards,\n> Jake\n> \n\nCan you downgrade pcre and check whether that's the reason?\n\nAlso, -14 in testing contains a few fixes.\n\nMichael\n"},{"id":"269421","messageId":"20150904140345.GA28675@sigill.intra.peff.net","threadId":"40269","inReplyTo":"9CAA4751-D295-4ACE-8ED6-720D728D24EA@intel.com","subject":"Re: git grep broken in Fedora 21 update?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-09-04T14:03:45Z","receivedAt":"2015-09-04T14:03:45Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Sep 04, 2015 at 12:04:38AM +0000, Rustad, Mark D wrote:\n\n> You can see that git grep missed the line in ixgbe_x550.c that had two hits on the string.\n> \n> This was with git 2.1.0 in Fedora 21. I use git grep a lot and never\n> noticed a problem before. I just updated my Fedora 21 system\n> yesterday, so I have to figure that has something to do with it. I\n> checked and git didn't get updated, so I figure it must be a library\n> that is really broken.\n> \n> I see in my update log that pcre was updated to:\n> \n> pcre.x86_64 0:8.35-12.fc21\n> pcre-devel.x86_64 0:8.35-12.fc21\n> \n> Yet the grep command is unaffected.\n\nI don't think \"git grep\" should be using pcre unless you specified \"-P\"\non the command line (which might be an interesting experiment, to see if\nit improves the result).\n\nIt shouldn't be affected by your working tree state. \"git grep\" without\narguments searches the working tree, just like grep. It might omit a\nfile that is not tracked, but given that the missing line is from a file\nwhich _does_ have other results, that's clearly not the problem.\n\nIs it possible that git _is_ producing the hit, but it is getting eaten\nby the pager or something like that? Does \"git --no-pager grep\nenter_lplu\" produce the same results?\n\nI don't think there have been any git bugs in this area for quite a\nwhile. In your position I'd try building from source to see if a freshly\nbuilt version has the same problem.\n\n-Peff\n"},{"id":"269432","messageId":"B27266ED-9A9F-4127-8166-8AC235492B93@intel.com","threadId":"40269","inReplyTo":"20150904140345.GA28675@sigill.intra.peff.net","subject":"Re: git grep broken in Fedora 21 update?","fromName":"Rustad, Mark D","fromEmail":"mark.d.rustad@intel.com","sentAt":"2015-09-04T16:18:39Z","receivedAt":"2015-09-04T16:18:39Z","isPatch":false,"sender":{"key":"mark.d.rustad@intel.com","avatar":null},"body":"> On Sep 4, 2015, at 7:03 AM, Jeff King <peff@peff.net> wrote:\n> \n> Is it possible that git _is_ producing the hit, but it is getting eaten\n> by the pager or something like that? Does \"git --no-pager grep\n> enter_lplu\" produce the same results?\n\nWell what do you know. Adding --no-pager gave me the right results. I wonder if the output isn't getting flushed to the pipe or something. In any case, I can add --no-pager to the alias I normally use and I'll be happy. The root cause will just gnaw at me for a while...\n\nHmm. Doing git grep enter_lplu | cat - also worked.\n\n--\nMark Rustad, Networking Division, Intel Corporation\n\n"}]}