Running the command: $ echo cacca | grep ^[A-Z] ; echo $? I would expect grep not to print anything and the following echo to print 1. Instead, the I receive the following output: $ echo cacca | grep ^[A-Z] ; echo $? cacca 0 That means that grep finds what it's looking for. But there's no capital letter starting the searched string! Another interesting effect is that I have an alias for grep='grep --color=auto' and no part of the output "cacca" is colored when I exploit this behavior. egrep has the same behavior, but fgrep doesn't: $ echo cacca | fgrep ^[A-Z] ; echo $? 1 Reproducible: Always Steps to Reproduce: 1. echo cacca | grep ^[A-Z]; echo $? (strange behavior) 2. echo Cacca | grep ^[A-Z]; echo $? (works) 3. echo cacca | fgrep ^[A-Z]; echo $? (works) Actual Results: 1. cacca 0 2. Cacca (the C is colored) 0 3. 1 Expected Results: 1. 1 2. Cacca (the C is colored) 0 3. 1 *** Deprecated use of action 'info', use '--info' instead Portage 2.1.3.9 (default-linux/x86/2006.1, gcc-4.1.2, glibc-2.5-r4, 2.6.22-gentoo-r5 i686) ================================================================= System uname: 2.6.22-gentoo-r5 i686 Intel(R) Pentium(R) M processor 1.50GHz Timestamp of tree: Wed, 19 Sep 2007 08:20:01 +0000 app-shells/bash: 3.2_p17 dev-java/java-config: 1.3.7, 2.0.33-r1 dev-lang/python: 2.4.4-r4 dev-python/pycrypto: 2.0.1-r6 sys-apps/baselayout: 1.12.9-r2 sys-apps/sandbox: 1.2.17 sys-devel/autoconf: 2.13, 2.61-r1 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10 sys-devel/binutils: 2.17-r1 sys-devel/gcc-config: 1.3.16 sys-devel/libtool: 1.5.24 virtual/os-headers: 2.6.21 ACCEPT_KEYWORDS="x86" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=pentium-m -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/ xkb /usr/share/config" CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/ph p/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web 2c" CXXFLAGS="-O2 -march=pentium-m -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch" GENTOO_MIRRORS="ftp://mirror.switch.ch/mirror/gentoo/ ftp://ftp.solnet.ch/mirror/Gentoo ftp://ftp.un i-erlangen.de/pub/mirrors/gentoo http://mirror.mcs.anl.gov/pub/gentoo/" LANG="en_US.UTF-8" LINGUAS="en de it zh zh_TW" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="7zip X a52 aac aalib acpi aiglx alsa amr apache2 arts audiofile bash-completion bcmath berkdb beryl bitmap-fonts blas bluetooth bzip2 calendar cdparanoia cdr cjk cli cracklib crypt cups curl dbus dga dio doc dri dts dv dvb dvd dvdr dvdread emacs encode exif expat ffmpeg fftw firefox flac flash foomaticdb fortran ftp gd gdbm gif glut gmp gnutls gpm gtk gtk2 gtkhtml hal iconv icq ieee1394 imagemagick imap imlib immqt-bc ipv6 isdnlog jabber java javascript jpeg jpeg2k kde ladspa lash ldap leim lesstif libcaca libwww lzo mad maildir matroska mbox mcal midi mikmod mime ming mmap mmx mng motif mp3 mpeg msn mudflap mysql ncurses nls nptl nptlonly nsplugin offensive ogg openal opengl openmp osc oscar oss pam pcmcia pcntl pcre pda pdf perl php plotutils png pop portaudio posix ppds pppd python qt3 qt4 quicktime readline real reflection samba sdl session sharedmem shorten skey slang sndfile sockets socks5 sound sox speex spell spl sqlite sse sse2 ssl startup-notification svg symlink sysvipc tcl tcpd tetex theora threads tidy tiff tk tokenizer truetype truetype-fonts type1-fonts unicode usb v4l vcd videos vim-with-x vorbis wifi win32codecs wmf wxwindows x264 x86 xcomposite xface xine xinerama xinetd xml xmlrpc xorg xosd xpm xprint xscreensaver xsl xv xvid yahoo zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de it zh zh_TW" USERLAND="GNU" VIDEO_CARDS="dummy fbdev i810 vesa vga v4l" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
i'm pretty sure this is fixed in 2.5.3 already ... can you please test that
(In reply to comment #1) Sorry for the silly question, but... how can I emerge that packet? In the ebuild file the KEYWORDS is set to "". If I try to emerge it, emerge says "missing keyword". If I try to patch the ebuild adding the keyword ~x86, then emerge says the file size or the MD5 is wrong... :-$
(In reply to comment #2) > Sorry for the silly question, but... how can I emerge that packet? echo "sys-apps/grep **" >> /etc/portage/package.keywords
(In reply to comment #3) Thank you for the answer: I didn't know that "trick". :-) Too bad, the same problem appears with grep-2.5.3 :-( $ echo cacca | grep '^[A-Z]' ; echo $? cacca 0 $ grep --version GNU grep 2.5.3 Copyright (C) 1988, 1992-2002, 2004, 2005 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.
For your information, I've encountered the same problem in grep 2.5.1 on OpenSUSE 10.2 for x86-64 (I don't know about other architectures). Here's my bug report on Novell's bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=329992
seems to be fixed for me with grep-2.5.4: $ alias grep=grep $ echo cacca | grep ^[A-Z] ; echo $? 1 $ grep --version GNU grep 2.5.4 ...