[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] tr: case mapping anomaly
From: |
Pádraig Brady |
Subject: |
Re: [coreutils] tr: case mapping anomaly |
Date: |
Wed, 29 Sep 2010 13:40:22 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 |
On 29/09/10 12:59, Eric Blake wrote:
Thanks for the review.
I agree with your tweaks, though since I've already pushed,
I don't think it's worth amending.
>> +
>> + # Ensure we extend string2 appropriately
>> + tr '[:upper:]- ' '[:lower:]_' < /dev/null || _fail=1
>
> Seems non-portable to have a - in the middle, even though here the left
> side is a character class instead of a byte. I think you'd better pick
> a different character than -, or move the - to the end.
Well that was part by design, as it's our tr that we're testing, and
this will flag if we inadvertently change range processing within tr.
>> + # Ensure the size of the case classes are accounted
>> + # for as a unit.
>> + echo 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
>> + tr '[:upper:]A-B' '[:lower:]0' >out || _fail=1
>> + echo '00cdefghijklmnopqrstuvwxyz' > exp
>
> Huh? A and B are both in [:upper:]; when a character is listed more
> than once in string1, it is only transliterated according to the first
> listing. I think this should be 'abc...' not '00c...' for the expected
> results.
Does POSIX specify that?
That's not what we do, nor what I would expect.
$ echo 'A' | LANG=C tr 'AA' '01'
1
cheers,
Pádraig.
- [coreutils] tr: case mapping anomaly, Pádraig Brady, 2010/09/24
- Re: [coreutils] tr: case mapping anomaly, Eric Blake, 2010/09/24
- Re: [coreutils] tr: case mapping anomaly, Pádraig Brady, 2010/09/25
- Re: [coreutils] tr: case mapping anomaly, Jim Meyering, 2010/09/25
- Re: [coreutils] tr: case mapping anomaly, Eric Blake, 2010/09/29
- Re: [coreutils] tr: case mapping anomaly,
Pádraig Brady <=
- Re: [coreutils] tr: case mapping anomaly, Eric Blake, 2010/09/29
- Re: [coreutils] tr: case mapping anomaly, Eric Blake, 2010/09/29