coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] mkfifo, mknod: avoid duplicate quoting in error diagnostic


From: Bernhard Voelker
Subject: Re: [PATCH] mkfifo, mknod: avoid duplicate quoting in error diagnostic
Date: Tue, 03 Dec 2013 08:15:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

On 12/03/2013 01:18 AM, Pádraig Brady wrote:
> On 12/02/2013 11:41 PM, Bernhard Voelker wrote:
>>    devmsg ("format String:\n  input: %s\n  grouping: %s\n"
>>                     "  padding width: %ld\n  alignment: %s\n"
>> -                   "  prefix: '%s'\n  suffix: '%s'\n",
>> +                   "  prefix: %s\n  suffix: %s\n",
>>            quote (fmt), (grouping) ? "yes" : "no",
> 
> does this need to be quote_n (0,... ?
> 
>>            padding_width,
>>            (padding_alignment == MBS_ALIGN_LEFT) ? "Left" : "Right",
>> -          format_str_prefix, format_str_suffix);
>> +          quote_n (0, format_str_prefix), quote_n (1, format_str_suffix));
> 
> and this adjusted accordingly
> 
>> @@ -1067,8 +1068,8 @@ parse_human_number (const char *str, long double 
>> /*output */ *value,
>>    if (ptr && *ptr != '\0')
>>      {
>>        if (_invalid != inval_ignore)
>> -        error (conv_exit_code, 0, _("invalid suffix in input '%s': '%s'"),
>> -               str, ptr);
>> +        error (conv_exit_code, 0, _("invalid suffix in input %s: %s"),
>> +               quote (str), quote (ptr));
> 
> do these need to be quote_n?

ugh, Mondays, sorry.

The attached fixes it.

I also changed the quoting in 'extract_fields' by converting possible
NULL pointers into a proper "" instead of crippling the format string
to bypass the new rule:

-@@ -1271,7 +1275,9 @@ extract_fields (char *line, int _field,
+@@ -1271,8 +1276,10 @@ extract_fields (char *line, int _field,
    else
      *_suffix = NULL;

 -  devmsg ("  prefix: '%s'\n  number: '%s'\n  suffix: '%s'\n",
-+  /* Although the quoting notation '%s' violates sc_prohibit_quotes_notation,
-+     avoid using quote() here as e.g. *_prefix may be NULL.  */
-+  devmsg ("  prefix: '%s""'\n  number: '%s""'\n  suffix: '%s""'\n",
-           *_prefix, *_data, *_suffix);
+-          *_prefix, *_data, *_suffix);
++  devmsg ("  prefix: %s\n  number: %s\n  suffix: %s\n",
++          quote_n (0, *_prefix ? *_prefix : ""),
++          quote_n (1, *_data),
++          quote_n (2, *_suffix ? *_suffix : ""));
  }

Thanks for the review!

Have a nice day,
Berny

Attachment: 0001-maint-avoid-s-quoting-notation-in-diagnostic-message-v2.patch
Description: Text Data


reply via email to

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