GNU bug report logs - #6176
[PATCH 1/2] sort: add a --debug option to highlight key extents

Previous Next

Package: coreutils;

Reported by: Pádraig Brady <P <at> draigBrady.com>

Date: Tue, 11 May 2010 22:59:02 UTC

Severity: normal

Tags: patch

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: 6176 <at> debbugs.gnu.org
Subject: bug#6176: [PATCH 2/2] sort: --debug: output data independent key	warnings
Date: Fri, 14 May 2010 16:52:10 +0100
On 14/05/10 16:09, Eric Blake wrote:
> On 05/14/2010 07:10 AM, Pádraig Brady wrote:
>>  
>>  /* The kind of blanks for '-b' to skip in various options. */
>> @@ -375,7 +378,8 @@ Other options:\n\
>>    -C, --check=quiet, --check=silent  like -c, but do not report first bad line\n\
>>        --compress-program=PROG  compress temporaries with PROG;\n\
>>                                decompress them with PROG -d\n\
>> -      --debug               annotate the part of the line used to sort\n\
>> +      --debug               annotate the part of the line used to sort,\n\
>> +                              and warn about questionable usage to stderr\n\
>>        --files0-from=F       read input from the files specified by\n\
>>                              NUL-terminated names in file F;\n\
>>                              If F is - then read names from standard input\n\
> 
> This makes for a pretty long translation string; time to break it in two?

OK will do.

>> +  for (key = keylist; key; key = key->next, keynum++)
>> +    {
>> +      /* Warn about field specs that will never match.  */
>> +      if (key->sword != SIZE_MAX && key->eword < key->sword)
>> +        error (0, 0, _("key %zu has zero width and will be ignored"), keynum);
> 
> This requires vfprintf-posix to guarantee that %zu will work; I'm not
> sure we have that guarantee, and Jim has been reluctant to globally turn
> on gnulib printf replacements.

Oops, right. I've been doing too much C99 lately.
I quickly grepped but didn't notice the existing %zu
was inside #if DEBUG. I'll use something more standard.

>> @@ -3884,6 +3985,18 @@ main (int argc, char **argv)
>>    if (debug && outfile)
>>      error (SORT_FAILURE, 0, _("options -o and --debug are incompatible"));
> 
> Why?

That was from the previous commit, and the log message there said:

  (main): Process the --debug option and make it mutually exlusive
  with the -o option as I don't see it useful there, even potentially
  harmful if someone left a --debug in by mistake when updating a file.
  Also restricting debug output to stdout, simplifies the logic
  for dealing with temporary files.

I'll add a comment to the code also.

thanks for the review.
Pádraig.




This bug report was last modified 15 years and 61 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.