An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Previous Thread
Next Thread
Print Thread
lion damaged grep?
#19367 11/26/11 08:29 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
this works under lion:

echo 1 | grep " \\( \(byhhfyghes\|TB\)/[0-9]\+\(\.[0-9]\+\)\? \(bytes\|KB\|MB\|GB\|TB\) ([0-9]\+/[0-9]\+ bytes)\\|[0-9]\+/[0-9]\+ bytes\\) of \"\\([^\"]*\"\\)\\+ to [^/]*/[^/]*/[1-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}$"

but this does not:

echo 1 | grep " \\( \(byhhgfyghes\|TB\)/[0-9]\+\(\.[0-9]\+\)\? \(bytes\|KB\|MB\|GB\|TB\) ([0-9]\+/[0-9]\+ bytes)\\|[0-9]\+/[0-9]\+ bytes\\) of \"\\([^\"]*\"\\)\\+ to [^/]*/[^/]*/[1-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}$"

error message: grep: Regular expression too big

It works on all prior versions of OS X that I have tested. I've googled around and lion is breaking things in numerous place due to this grep error message coming up.

It's not a character length limit, formula complexity is also a factor. And this isn't even close to the complexity that some of my expressions get.

The biggest monster in that log analyzer, that runs fine on anything before lion, is this:


"^[A-Z][a-z]\{2\} \([ 12][0-9]\|3[01]\) \([0-1][0-9]\|2[0-3]\):[0-5][0-9]:[0-5][0-9] wired\[[1-9][0-9]*\]: Info: Received \\([0-9]\+\(\.[0-9]\+\)\? \(bytes\|KB\|MB\|GB\|TB\)/[0-9]\+\(\.[0-9]\+\)\? \(bytes\|KB\|MB\|GB\|TB\) ([0-9]\+/[0-9]\+ bytes)\\|[0-9]\+/[0-9]\+ bytes\\) of \"\\([^\"]*\"\\)\\+ from [^/]*/[^/]*/[1-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}$"

Since lion appears to be using the same build of grep as tiger,

grep --version
grep (GNU grep) 2.5.1

grep --version
grep (GNU grep) 2.5.1


So I checked filesizes:

10.4.11 ppc:
stat /usr/bin/grep
234881032 11389086 -rwxr-xr-x 3 root wheel 0 200064 "Nov 26 15:20:29 2011" "Jul 1 18:24:41 2006" "Feb 21 12:35:12 2008" 4096 392 0 /usr/bin/grep

10.6.8 intel:
stat /usr/bin/grep
234881027 37859256 -rwxr-xr-x 1 root wheel 0 227488 "Nov 26 15:21:53 2011" "Feb 10 23:54:37 2010" "May 20 08:39:39 2010" "Feb 10 23:54:37 2010" 4096 208 0x20 /usr/bin/grep

10.7.2:

stat /usr/bin/grep
234881032 67657 -rwxr-xr-x 3 root wheel 0 232064 "Nov 26 16:21:03 2011" "Oct 10 00:06:04 2011" "Oct 10 00:06:04 2011" "Jun 24 23:03:33 2011" 4096 224 0x20 /usr/bin/grep

So --version appears to not tell the whole story. I scp'd a copy of 10.6.8's grep to a lion machine, and imagine that, it works fine.

Code:

xserve:/library/wired admin $ grep --version ; echo 1 | grep " \\( \(byhhgfyghes\|TB\)/[0-9]\+\(\.[0-9]\+\)\? \(bytes\|KB\|MB\|GB\|TB\) ([0-9]\+/[0-9]\+ bytes)\\|[0-9]\+/[0-9]\+ bytes\\) of \"\\([^\"]*\"\\)\\+ to [^/]*/[^/]*/[1-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}$"
grep (GNU grep) 2.5.1

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

grep: Regular expression too big
xserve:/library/wired admin $ ./grep --version ; echo 1 | ./grep " \\( \(byhhgfyghes\|TB\)/[0-9]\+\(\.[0-9]\+\)\? \(bytes\|KB\|MB\|GB\|TB\) ([0-9]\+/[0-9]\+ bytes)\\|[0-9]\+/[0-9]\+ bytes\\) of \"\\([^\"]*\"\\)\\+ to [^/]*/[^/]*/[1-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}\.[0-9][0-9]\{0,2\}$"
grep (GNU grep) 2.5.1

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
xserve:/library/wired admin $



hrmf. Is someone at apple playing with grep?


I work for the Department of Redundancy Department
Re: lion damaged grep?
Virtual1 #19368 11/26/11 09:23 PM
Joined: Sep 2009
Offline

Joined: Sep 2009
dunno. (i'm still using 10.6.8)

does this tell you anything?
Code:
$ lipo -detailed_info /usr/bin/grep
Fat header in: /usr/bin/grep
fat_magic 0xcafebabe
nfat_arch 2
architecture x86_64
    cputype CPU_TYPE_X86_64
    cpusubtype CPU_SUBTYPE_X86_64_ALL
    offset 4096
    size 117008
    align 2^12 (4096)
architecture i386
    cputype CPU_TYPE_I386
    cpusubtype CPU_SUBTYPE_I386_ALL
    offset 122880
    size 104608
    align 2^12 (4096)



Re: lion damaged grep?
Hal Itosis #19369 11/26/11 09:25 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
well yes I was taking it for granted architecture differences are going to be there, especially since 10.4 obviously doesn't do intel and lion not ppc. but check out the file size differences. Lion's binary is BIGGER than snow leopard's. Explain that wink


I work for the Department of Redundancy Department
Re: lion damaged grep?
Virtual1 #19370 11/26/11 09:30 PM
Joined: Sep 2009
Offline

Joined: Sep 2009
does your copy pass code signature verification?
Code:
$ codesign -vvv /usr/bin/grep
/usr/bin/grep: valid on disk
/usr/bin/grep: satisfies its Designated Requirement


Re: lion damaged grep?
Hal Itosis #19371 11/26/11 09:31 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
for lion:

Code:

xserve:/Library/wired admin $ codesign -vvvv /usr/bin/grep
/usr/bin/grep: valid on disk
/usr/bin/grep: satisfies its Designated Requirement
xserve:/Library/wired admin $ lipo -detailed_info /usr/bin/grep
Fat header in: /usr/bin/grep
fat_magic 0xcafebabe
nfat_arch 2
architecture x86_64
    cputype CPU_TYPE_X86_64
    cpusubtype CPU_SUBTYPE_X86_64_ALL
    offset 4096
    size 117376
    align 2^12 (4096)
architecture i386
    cputype CPU_TYPE_I386
    cpusubtype CPU_SUBTYPE_I386_ALL
    offset 122880
    size 109184
    align 2^12 (4096)


I work for the Department of Redundancy Department
Re: lion damaged grep?
Virtual1 #19373 11/26/11 09:46 PM
Joined: Sep 2009
Offline

Joined: Sep 2009
no clue.

here, have fun...

http://www.opensource.apple.com/source/grep/grep-28/

smile

[maybe there's a bug in the compiler they used.]

Last edited by Hal Itosis; 11/26/11 09:49 PM.

Moderated by  alternaut, dkmarsh, joemikeb 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.4.33 Page Time: 0.486s Queries: 26 (0.012s) Memory: 0.6000 MB (Peak: 0.6782 MB) Data Comp: Zlib Server Time: 2024-04-24 07:30:34 UTC
Valid HTML 5 and Valid CSS