From unknown Fri Aug 15 21:20:02 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#7214 <7214@debbugs.gnu.org> To: bug#7214 <7214@debbugs.gnu.org> Subject: Status: sort --debug maps large old-style field number to 0 in diagnostic Reply-To: bug#7214 <7214@debbugs.gnu.org> Date: Sat, 16 Aug 2025 04:20:02 +0000 retitle 7214 sort --debug maps large old-style field number to 0 in diagnos= tic reassign 7214 coreutils submitter 7214 Jim Meyering severity 7214 normal tag 7214 wontfix thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 14 06:02:38 2010 Received: (at submit) by debbugs.gnu.org; 14 Oct 2010 10:02:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6Kdy-0006bL-78 for submit@debbugs.gnu.org; Thu, 14 Oct 2010 06:02:38 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6Kdw-0006bG-06 for submit@debbugs.gnu.org; Thu, 14 Oct 2010 06:02:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6KhL-0000gV-DE for submit@debbugs.gnu.org; Thu, 14 Oct 2010 06:06:08 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:49512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6KhL-0000gO-9K for submit@debbugs.gnu.org; Thu, 14 Oct 2010 06:06:07 -0400 Received: from [140.186.70.92] (port=41908 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6KhK-00066h-9U for bug-coreutils@gnu.org; Thu, 14 Oct 2010 06:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6KhJ-0000g0-5m for bug-coreutils@gnu.org; Thu, 14 Oct 2010 06:06:05 -0400 Received: from mx.meyering.net ([82.230.74.64]:54528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6KhI-0000fO-W2 for bug-coreutils@gnu.org; Thu, 14 Oct 2010 06:06:05 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id B153AD85B; Thu, 14 Oct 2010 12:06:02 +0200 (CEST) From: Jim Meyering To: bug-coreutils@gnu.org Subject: sort --debug maps large old-style field number to 0 in diagnostic Date: Thu, 14 Oct 2010 12:06:02 +0200 Message-ID: <87mxqhqeb9.fsf@meyering.net> Lines: 7 MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) I noticed that using a field number of SIZE_MAX or larger makes --debug give an invalid diagnostic: $ :|_POSIX2_VERSION=199209 src/sort --debug +$(echo 2^64-1|bc).4 -1.2 src/sort: using simple byte comparison src/sort: obsolescent key `+0 -2' used; consider `-k 1,2' instead src/sort: leading blanks are significant in key 1; consider also specifying `b' From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 14 08:18:01 2010 Received: (at 7214) by debbugs.gnu.org; 14 Oct 2010 12:18:01 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6Mky-0008DS-Ni for submit@debbugs.gnu.org; Thu, 14 Oct 2010 08:18:00 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1P6Mkw-0008DN-Km for 7214@debbugs.gnu.org; Thu, 14 Oct 2010 08:17:59 -0400 Received: (qmail 24303 invoked from network); 14 Oct 2010 12:21:29 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 14 Oct 2010 12:21:29 -0000 Message-ID: <4CB6F553.8080709@draigBrady.com> Date: Thu, 14 Oct 2010 13:19:31 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Jim Meyering Subject: Re: bug#7214: sort --debug maps large old-style field number to 0 in diagnostic References: <87mxqhqeb9.fsf@meyering.net> In-Reply-To: <87mxqhqeb9.fsf@meyering.net> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 7214 Cc: 7214@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On 14/10/10 11:06, Jim Meyering wrote: > I noticed that using a field number of SIZE_MAX or larger makes --debug > give an invalid diagnostic: > > $ :|_POSIX2_VERSION=199209 src/sort --debug +$(echo 2^64-1|bc).4 -1.2 > src/sort: using simple byte comparison > src/sort: obsolescent key `+0 -2' used; consider `-k 1,2' instead > src/sort: leading blanks are significant in key 1; consider also specifying `b' I'd nearly call that corner case a feature, as it informs you the passed count has been wrapped. I.E. the obsolete syntax has a 1-less narrower range and this is informing you of that fact. printf "1 2\n" | src/sort -sb --debug +$((2**32-1)) -1 src/sort: using `en_IE.UTF-8' sorting rules src/sort: obsolescent key `+0 -1' used; consider `-k 1,1' instead 1 2 _ It does mean though, that overflows on the start field for obsolete syntax do sort the data, while overflows with the -k syntax do not. We could detect that for the old syntax, and map overflows to SIZE_MAX-1? I suppose we could also add a debug warning for when we do overflow, something along the lines of: $ src/sort -sb --debug -k$((2**32)) /dev/null src/sort: 4294967296 is too large, using 4294967295 @@ -3882,6 +3882,8 @@ parse_field_count (char const *string, size_t *val, char const *msgid) case LONGINT_OVERFLOW: case LONGINT_OVERFLOW | LONGINT_INVALID_SUFFIX_CHAR: *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); break; cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 14 08:40:50 2010 Received: (at 7214) by debbugs.gnu.org; 14 Oct 2010 12:40:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6N74-0008OZ-Aa for submit@debbugs.gnu.org; Thu, 14 Oct 2010 08:40:50 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6N70-0008OS-Pc for 7214@debbugs.gnu.org; Thu, 14 Oct 2010 08:40:47 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 29C6EECE7; Thu, 14 Oct 2010 14:44:18 +0200 (CEST) From: Jim Meyering To: =?utf-8?Q?P=C3=A1draig?= Brady Subject: Re: bug#7214: sort --debug maps large old-style field number to 0 in diagnostic In-Reply-To: <4CB6F553.8080709@draigBrady.com> (=?utf-8?Q?=22P=C3=A1draig?= Brady"'s message of "Thu, 14 Oct 2010 13:19:31 +0100") References: <87mxqhqeb9.fsf@meyering.net> <4CB6F553.8080709@draigBrady.com> Date: Thu, 14 Oct 2010 14:44:18 +0200 Message-ID: <87bp6xq6zh.fsf@meyering.net> Lines: 48 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: 7214 Cc: 7214@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) P=C3=A1draig Brady wrote: > On 14/10/10 11:06, Jim Meyering wrote: >> I noticed that using a field number of SIZE_MAX or larger makes --debug >> give an invalid diagnostic: >> >> $ :|_POSIX2_VERSION=3D199209 src/sort --debug +$(echo 2^64-1|bc).4 -1.2 >> src/sort: using simple byte comparison >> src/sort: obsolescent key `+0 -2' used; consider `-k 1,2' instead >> src/sort: leading blanks are significant in key 1; consider also speci= fying `b' > > I'd nearly call that corner case a feature, > as it informs you the passed count has been wrapped. > I.E. the obsolete syntax has a 1-less narrower range > and this is informing you of that fact. > > printf "1 2\n" | src/sort -sb --debug +$((2**32-1)) -1 > src/sort: using `en_IE.UTF-8' sorting rules > src/sort: obsolescent key `+0 -1' used; consider `-k 1,1' instead > 1 2 > _ > > > It does mean though, that overflows on the start field > for obsolete syntax do sort the data, while overflows > with the -k syntax do not. We could detect that for > the old syntax, and map overflows to SIZE_MAX-1? > > I suppose we could also add a debug warning for when > we do overflow, something along the lines of: > > $ src/sort -sb --debug -k$((2**32)) /dev/null > src/sort: 4294967296 is too large, using 4294967295 > > @@ -3882,6 +3882,8 @@ parse_field_count (char const *string, size_t *val,= char const *msgid) > case LONGINT_OVERFLOW: > case LONGINT_OVERFLOW | LONGINT_INVALID_SUFFIX_CHAR: > *val =3D SIZE_MAX; > + if (debug) /* Note --debug must come before keys to diagnose this.= */ > + error (0, 0, _("%" PRIuMAX " is too large, using %zu"), n, *val); That does sound like an improvement (that would require comment changes), but considering it's only with an outrageously large field number and when using obsolescent key-specifying syntax, it's probably not worth the trouble. But if you want to add the above, that's fine, too. Note however, that would not change the mapping from a field number of exactly SIZE_MAX to "0" in the diagnostic. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 14 09:13:23 2010 Received: (at 7214) by debbugs.gnu.org; 14 Oct 2010 13:13:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6NcY-0000AA-Q7 for submit@debbugs.gnu.org; Thu, 14 Oct 2010 09:13:22 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1P6NcW-0000A5-IW for 7214@debbugs.gnu.org; Thu, 14 Oct 2010 09:13:21 -0400 Received: (qmail 34681 invoked from network); 14 Oct 2010 13:16:51 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 14 Oct 2010 13:16:51 -0000 Message-ID: <4CB7024C.5010003@draigBrady.com> Date: Thu, 14 Oct 2010 14:14:52 +0100 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Jim Meyering Subject: Re: bug#7214: sort --debug maps large old-style field number to 0 in diagnostic References: <87mxqhqeb9.fsf@meyering.net> <4CB6F553.8080709@draigBrady.com> <87bp6xq6zh.fsf@meyering.net> In-Reply-To: <87bp6xq6zh.fsf@meyering.net> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 7214 Cc: 7214@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On 14/10/10 13:44, Jim Meyering wrote: > Pádraig Brady wrote: >> On 14/10/10 11:06, Jim Meyering wrote: >>> I noticed that using a field number of SIZE_MAX or larger makes --debug >>> give an invalid diagnostic: >>> >>> $ :|_POSIX2_VERSION=199209 src/sort --debug +$(echo 2^64-1|bc).4 -1.2 >>> src/sort: using simple byte comparison >>> src/sort: obsolescent key `+0 -2' used; consider `-k 1,2' instead >>> src/sort: leading blanks are significant in key 1; consider also specifying `b' >> >> I'd nearly call that corner case a feature, >> as it informs you the passed count has been wrapped. >> I.E. the obsolete syntax has a 1-less narrower range >> and this is informing you of that fact. >> >> printf "1 2\n" | src/sort -sb --debug +$((2**32-1)) -1 >> src/sort: using `en_IE.UTF-8' sorting rules >> src/sort: obsolescent key `+0 -1' used; consider `-k 1,1' instead >> 1 2 >> _ >> >> >> It does mean though, that overflows on the start field >> for obsolete syntax do sort the data, while overflows >> with the -k syntax do not. We could detect that for >> the old syntax, and map overflows to SIZE_MAX-1? >> >> I suppose we could also add a debug warning for when >> we do overflow, something along the lines of: >> >> $ src/sort -sb --debug -k$((2**32)) /dev/null >> src/sort: 4294967296 is too large, using 4294967295 >> >> @@ -3882,6 +3882,8 @@ parse_field_count (char const *string, size_t *val, char const *msgid) >> case LONGINT_OVERFLOW: >> case LONGINT_OVERFLOW | LONGINT_INVALID_SUFFIX_CHAR: >> *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); > > That does sound like an improvement (that would require comment changes), > but considering it's only with an outrageously large field number > and when using obsolescent key-specifying syntax, it's probably > not worth the trouble. But if you want to add the above, that's > fine, too. > > Note however, that would not change the mapping from a > field number of exactly SIZE_MAX to "0" in the diagnostic. > I'll try and fix it up for next release From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 14 09:40:02 2010 Received: (at 7214) by debbugs.gnu.org; 14 Oct 2010 13:40:02 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6O2L-0000Lr-Pr for submit@debbugs.gnu.org; Thu, 14 Oct 2010 09:40:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6O2J-0000Ll-GS for 7214@debbugs.gnu.org; Thu, 14 Oct 2010 09:40:00 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9EDhV1m023905 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 14 Oct 2010 09:43:31 -0400 Received: from [10.3.113.30] (ovpn-113-30.phx2.redhat.com [10.3.113.30]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o9EDhU6T014123; Thu, 14 Oct 2010 09:43:30 -0400 Message-ID: <4CB70902.8020909@redhat.com> Date: Thu, 14 Oct 2010 07:43:30 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4 MIME-Version: 1.0 To: =?ISO-8859-1?Q?P=E1draig_Brady?= Subject: Re: bug#7214: sort --debug maps large old-style field number to 0 in diagnostic References: <87mxqhqeb9.fsf@meyering.net> <4CB6F553.8080709@draigBrady.com> In-Reply-To: <4CB6F553.8080709@draigBrady.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id o9EDhV1m023905 X-Spam-Score: -10.1 (----------) X-Debbugs-Envelope-To: 7214 Cc: Jim Meyering , 7214@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.1 (----------) On 10/14/2010 06:19 AM, P=E1draig Brady wrote: > @@ -3882,6 +3882,8 @@ parse_field_count (char const *string, size_t *va= l, char const *msgid) > case LONGINT_OVERFLOW: > case LONGINT_OVERFLOW | LONGINT_INVALID_SUFFIX_CHAR: > *val =3D SIZE_MAX; > + if (debug) /* Note --debug must come before keys to diagnose thi= s. */ > + error (0, 0, _("%" PRIuMAX " is too large, using %zu"), n, *va= l); > break; Rather than warn during option parsing, what if you instead set a bool=20 variable overflow_detected, and warn only after option parsing is=20 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=20 warning for: sort +$(((1<<31)-1)) --debug Just a thought; I'm okay with whatever you eventually commit on this fron= t. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 14 12:45:23 2010 Received: (at 7214) by debbugs.gnu.org; 14 Oct 2010 16:45:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6Qvi-00038p-Tf for submit@debbugs.gnu.org; Thu, 14 Oct 2010 12:45:23 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P6Qvg-00038k-SH for 7214@debbugs.gnu.org; Thu, 14 Oct 2010 12:45:21 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 4DFD339E80DF; Thu, 14 Oct 2010 09:48:53 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 33BhQvrSgkuS; Thu, 14 Oct 2010 09:48:52 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id C209039E80DC; Thu, 14 Oct 2010 09:48:52 -0700 (PDT) Message-ID: <4CB73474.1060204@cs.ucla.edu> Date: Thu, 14 Oct 2010 09:48:52 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Jim Meyering Subject: Re: bug#7214: sort --debug maps large old-style field number to 0 in diagnostic References: <87mxqhqeb9.fsf@meyering.net> <4CB6F553.8080709@draigBrady.com> <87bp6xq6zh.fsf@meyering.net> In-Reply-To: <87bp6xq6zh.fsf@meyering.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: 7214 Cc: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= , 7214@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) On 10/14/10 05:44, Jim Meyering wrote: >> *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); > That does sound like an improvement (that would require comment changes), No, it's better to silently treat large field numbers as if they were infinity. 'sort' already does that in other cases (e.g., specify_nthreads), and so does 'join' (e.g., string_to_join_field), and we should be doing that whenever possible. The idea is that, since 'sort' can't possibly represent a line that contains more than SIZE_MAX fields, it's correct to treat very large field numbers, even numbers that provoke LONGINT_OVERFLOW, as if they were SIZE_MAX. GNU code should not contain arbitrary limits: so when it's correct to substitute a representable number for a number that's so large that it's unrepresentable, we should do that instead of reporting an overflow and failing. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 15 13:27:39 2018 Received: (at 7214) by debbugs.gnu.org; 15 Oct 2018 17:27:39 +0000 Received: from localhost ([127.0.0.1]:51157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gC6eZ-000784-3u for submit@debbugs.gnu.org; Mon, 15 Oct 2018 13:27:39 -0400 Received: from mail-it1-f177.google.com ([209.85.166.177]:37298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gC6eX-00077h-Hz; Mon, 15 Oct 2018 13:27:37 -0400 Received: by mail-it1-f177.google.com with SMTP id e74-v6so28771207ita.2; Mon, 15 Oct 2018 10:27:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:cc:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=YtunmA4yQKXkIfzv2Bv2SAtk0M7hp0jj/PK+p24kwLg=; b=ucAO++tNabBNdnqCa+dRdIzEmNpjaKgmcA2WoRp7PTPmTRHwdVu6MkAQtt8+uzaOhL a4rDBgxJhwFqZBPto8ZAGtgSgVDVHDff7ACJ/A/vf6MY3it15cueFtchfXcd/1UJbhn6 c4zbUtYGvvKr3mzeAlK7C/uaWP3cr/XYVl9pVXPxrxJdP9oHRvY3CQbcCoOlc9u/9Xsh 2TQAhp1H8oZ+T8T/R1c4mYtKo15JhkU09+CHiEvqPFu8P+roaNNvOHx50sSoW/HBExPG fQtQjRr96Knf9fIrJqTGN7TDEqeRmnD2DUhrANIaLdpIVV7ijQTMlx9nN3iBIByhdWJn 4cJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YtunmA4yQKXkIfzv2Bv2SAtk0M7hp0jj/PK+p24kwLg=; b=pQ2O69OFaXc2JEBgT+o287n1lGvNCtyifEW3yph+e19gEcVO1CEg0HyuGVMEIoyj6U IoKQ90sX0wUmLVMdwmn1yJbUkIWHpgxgwM5P9x5HtrrzR19SDsrczDHASKluWuCJ2Ll1 kbcOeQxpoQOX8JEx7q4o8ROg2EOFhwGBc1+lVAcErD9DOAXyJFgI8fQHhgU5tjdpZXhj HZRSzFh9xfB7IhnwKP7ZJreA56JM4SktdIYkn/qy68mYHMSpLt0pA395VN5wzz+fpl/G fMkKrZ9n/Zo4sX7pByRIvGVGLS+9XFhpify//sXn6sQYvFCPC/OUTrrXxsbGzq9NEGQ7 Y3eg== X-Gm-Message-State: ABuFfohQce4M7s+H40rxrTdSGQYjAH6Rw4B6H5VdTmYNB8xPK50S2Mj/ vSo1oRP//DilxXizcPoIPEPoA4pOuhE= X-Google-Smtp-Source: ACcGV60YSjv8FIqvcKvIHGvhxqG/XApbOGkDTWqwdmRfV98yPObX3tJwXk7Zl3NYxHnFMdWcyWfOdg== X-Received: by 2002:a24:2f41:: with SMTP id j62-v6mr12394338itj.80.1539624451347; Mon, 15 Oct 2018 10:27:31 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id u21-v6sm3626721ioc.43.2018.10.15.10.27.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Oct 2018 10:27:30 -0700 (PDT) Subject: Re: bug#7214: sort --debug maps large old-style field number to 0 in diagnostic References: <87mxqhqeb9.fsf@meyering.net> <4CB6F553.8080709@draigBrady.com> <87bp6xq6zh.fsf@meyering.net> <4CB73474.1060204@cs.ucla.edu> From: Assaf Gordon Message-ID: <9d46056d-6eec-4f39-647f-b6051d8da833@gmail.com> Date: Mon, 15 Oct 2018 11:27:28 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <4CB73474.1060204@cs.ucla.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 7214 wontfix close 7214 stop (triaging old bugs) On 14/10/10 10:48 AM, Paul Eggert wrote: > On 10/14/10 05:44, Jim Meyering wrote: >>> *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); >> That does sound like an improvement (that would require comment changes), > > No, it's better to silently treat large field numbers as if they were infinity. > [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.2 MISSING_HEADERS Missing To: header 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (assafgordon[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.177 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.166.177 listed in list.dnswl.org] X-Debbugs-Envelope-To: 7214 Cc: 7214@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) tags 7214 wontfix close 7214 stop (triaging old bugs) On 14/10/10 10:48 AM, Paul Eggert wrote: > On 10/14/10 05:44, Jim Meyering wrote: >>> *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); >> That does sound like an improvement (that would require comment changes), > > No, it's better to silently treat large field numbers as if they were infinity. > 8 years later, the change has not been committed - so closing as "wontfix". -assaf From unknown Fri Aug 15 21:20:02 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 13 Nov 2018 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator