bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6176: [PATCH 2/2] sort: --debug: output data independent key warning


From: Pádraig Brady
Subject: bug#6176: [PATCH 2/2] sort: --debug: output data independent key warnings
Date: Fri, 14 May 2010 22:47:41 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

On 14/05/10 22:23, Paul Eggert wrote:
> On 05/14/10 06:10, Pádraig Brady wrote:
> 
>> -    if ((1 < (key->random + key->numeric + key->general_numeric +
>> key->month
>> -              + key->version + !!key->ignore + key->human_numeric))
>> +    if ((1 < (key->random + key_numeric (key) + key->month +
>> key->version
>> +              + !!key->ignore))
> 
> This change doesn't look right, since it won't catch the error of
> specifying both numeric and general_numeric options.  Am I missing
> something?

Well spotted
test/misc/sort::h7 had caught my silliness also

> 
>> sort: obsolescent key formats used.  Consider using `-k'
> 
> Something like the following diagnostic would be far more helpful for
> users who are not 'sort' experts:
> 
>   sort: obsolescent key `+2 -4' used; consider `-k 3,4' instead
> 
> Can you please arrange for that?

Yes that would be more useful. I'll have a look.

>> +  /* The following is too big, but guaranteed to be "big enough". */
>> +  char *opts = xstrdup (short_options);
> 
> This unnecessarily copies short_options.  Better would be:

>   char opts[sizeof short_options];
>   key_to_opts (key, opts);
>   F (opts);
> 
> This is a bit faster and is easier to understand (at least, for me).

Yes that's better.

thanks a lot!
Pádraig.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]