buggrep - Bugs: bug #29496, matching file begin and end gives...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #29496: matching file begin and end gives wrong results

Submitted by:  None
Submitted on:  Fri 09 Apr 2010 02:28:16 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: Closed

(Jump to the original submission Jump to the original submission)

Sat 10 Apr 2010 02:46:18 PM UTC, comment #7:

Of course.
I didn't want to type half the alphabet to ask how to match ABCDEFGHIJKLMNOPQRS or similar.
;)

malenki <malenki>
Sat 10 Apr 2010 02:41:49 PM UTC, comment #6:

To match only uppercase [C-F] you can use [CDEF].

Paolo Bonzini <bonzini>
Sat 10 Apr 2010 01:11:56 PM UTC, comment #5:

I used my distro's packages.

Just to be sure:
With the old "bugged" grep CDEF was matched with [C-F], now has to be used
[[:upper:]]*[C-F] to match CDEF on all locales?

Thanks for your time and patience
malenki

malenki <malenki>
Sat 10 Apr 2010 12:11:34 PM UTC, comment #4:

> > Besides, how would you grep for lines starting with a capital character using a locale!=C?
>
> You don't. You have to set LC_ALL=C or at least LC_COLLATE=C.


I was wrong; you can use [[:upper:]].

Paolo Bonzini <bonzini>
Sat 10 Apr 2010 12:08:50 PM UTC, comment #3:

> The behaviour of grep has changed since I test both versions on the same system.


True, but it's a bugfix. (BTW, did you compile 2.5.3 yourself or did you use your distro's)?

> I don't know why grep should reply the same strings no matter if I grep for ^[A-Z] or ^[a-z].


It actually doesn't, one would omit "a" and the other would omit "Z". It's the way it is, and we cannot change it.

> Besides, how would you grep for lines starting with a capital character using a locale!=C?


You don't. You have to set LC_ALL=C or at least LC_COLLATE=C.

I'm closing the bug, but feel free to reply again if you have other doubts.

Paolo Bonzini <bonzini>
Fri 09 Apr 2010 09:51:50 PM UTC, comment #2:

Testfile added.
My locale is de_DE.UTF-8

The string is
grep ^[A-Z] str_grep_testcase.txt

grep version 2.5.3 gives - like expected
Dachssteig
Danziger StraßE

version 2.6.2 gives

Dachssteig
Danziger StraßE
dehmelweg
drögenkamP
droste-Hülshoff-StraßE

The behaviour of grep has changed since I test both versions on the same system.
I don't know why grep should reply the same strings no matter if I grep for ^[A-Z] or ^[a-z].
Besides, how would you grep for lines starting with a capital character using a locale!=C?

PS: strange behaviour of this tracker to let everybody w/o login open a ticket but not reply to it...

(file #20176)

malenki <malenki>
Fri 09 Apr 2010 02:44:05 PM UTC, comment #1:

A good bug report must include a testcase (your /etc/passwd file in this case; make up your own testcase if you don't want to give us the file) and a description of the intended vs. actual results.

I don't see anything weird in the output of the two commands on my system, though. Remember that [A-Z] will match lowercase characters (except `a' actually) in a locale other than the C locale under glibc, since the collation order for those locales is aAbBcCdD...xXyYzZ.

Try "LC_ALL=C grep ^[A-Z] /etc/passwd" and "LC_ALL=C grep [A-Z]$ /etc/passwd". If they work, the problem is simply that you were expecting a different collation order.

Paolo Bonzini <bonzini>
Fri 09 Apr 2010 02:28:16 PM UTC, original submission:

try
grep ^[A-Z] /etc/passwd
and
grep [A-Z]$ /etc/passwd
to verify.
Experienced with 2.6.3.
2.5.4 and 2.5.3 are fine regarding this issue

Anonymous

 

Attached Files
file #20176:  str_grep_testcase.txt added by malenki (75B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by malenki (Updated the item)
  • -unavailable- added by bonzini (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 10 Apr 2010 12:08:50 PM UTCbonziniStatusNeed Info=>Invalid
      Open/ClosedOpen=>Closed
    Fri 09 Apr 2010 09:51:50 PM UTCmalenkiAttached File-=>Added str_grep_testcase.txt, #20176
    Fri 09 Apr 2010 02:44:05 PM UTCbonziniStatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1