[Top][All Lists]

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

bug#7214: sort --debug maps large old-style field number to 0 in diagnos

From: Eric Blake
Subject: bug#7214: sort --debug maps large old-style field number to 0 in diagnostic
Date: Thu, 14 Oct 2010 07:43:30 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4

On 10/14/2010 06:19 AM, Pádraig Brady wrote:
@@ -3882,6 +3882,8 @@ parse_field_count (char const *string, size_t *val, char 
const *msgid)
        *val = SIZE_MAX;
+      if (debug) /* Note --debug must come before keys to diagnose this.  */
+        error (0, 0, _("%" PRIuMAX " is too large, using %zu"), n, *val);

Rather than warn during option parsing, what if you instead set a bool variable overflow_detected, and warn only after option parsing is completed? The warning won't be quite as specific:

_("At least one key range overflowed")

but given that it's a corner case already, it means you would then have warning for:

sort +$(((1<<31)-1)) --debug

Just a thought; I'm okay with whatever you eventually commit on this front.

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

reply via email to

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