Assaf Gordon <assafgordon@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Assaf Gordon <assafgordon@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Eric Blake <eblake@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Eric Blake <eblake@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Debbugs Internal Request <help-debbugs@HIDDEN>
to internal_control <at> debbugs.gnu.org
.
Full text available.Received: (at 30661) by debbugs.gnu.org; 2 Mar 2018 01:52:33 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 01 20:52:33 2018 Received: from localhost ([127.0.0.1]:39909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1erZs8-0007tQ-1p for submit <at> debbugs.gnu.org; Thu, 01 Mar 2018 20:52:33 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33964 helo=mx1.redhat.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eblake@HIDDEN>) id 1erZs6-0007t9-8k; Thu, 01 Mar 2018 20:52:30 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 998028D6FB; Fri, 2 Mar 2018 01:52:24 +0000 (UTC) Received: from [10.10.122.122] (ovpn-122-122.rdu2.redhat.com [10.10.122.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 513522024CA6; Fri, 2 Mar 2018 01:52:24 +0000 (UTC) Subject: Re: bug#30661: closed (Re: bug#30661: sort) To: James Bunke <james_a_bunke@HIDDEN>, "30661 <at> debbugs.gnu.org" <30661 <at> debbugs.gnu.org> References: <0a0f61a9-3ed1-48f4-16cc-6d8e930001b5@HIDDEN> <820042476.8030674.1519861379922@HIDDEN> <handler.30661.D30661.151992094413753.notifdone <at> debbugs.gnu.org> <875362785.8854560.1519946999371@HIDDEN> From: Eric Blake <eblake@HIDDEN> Organization: Red Hat, Inc. Message-ID: <cdaa9e0c-ea6c-ac8e-f11f-2182c064057e@HIDDEN> Date: Thu, 1 Mar 2018 19:52:24 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <875362785.8854560.1519946999371@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 02 Mar 2018 01:52:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 02 Mar 2018 01:52:24 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eblake@HIDDEN' RCPT:'' X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: 30661 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.6 (/) reopen 30661 retitle 30661 RFE: Add way for sort to handle hex numbers tag 30661 -notabug thanks On 03/01/2018 05:29 PM, James Bunke wrote: > $ echo -e "170\n11" | sort -n echo -e is not portable; printf is better. > 11 > 170 > $ echo -e "AA\nB" | sort -n > AA > B > $ echo -e "0xAA\n0xB" | sort -n > 0xAA > 0xB Again, 'sort --debug' is your friend: $ printf '0xAA\n0xB\n' | LC_ALL=C sort -n --debug sort: using simple byte comparison 0xAA _ ____ 0xB _ ___ The numeric sort key parses '0' and stops at 'x', because it does NOT parse hexadecimal. Here's what POSIX has to say about -n: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html "-n Restrict the sort key to an initial numeric string, consisting of optional <blank> characters, optional <hyphen-minus> character, and zero or more digits with an optional radix character and thousands separators (as defined in the current locale), which shall be sorted by arithmetic value. An empty digit string shall be treated as zero. Leading zeros and signs on zeros shall not affect ordering." Which does not directly mention "decimal", but the mention of a radix character (as in '1.2' or '1,2', depending on locale) pretty much implies decimal, as radix characters are only output by printf when printing floating point values in a decimal format. > > Perhaps its the documentation that is lacking as I find no reference to hexadecimal ineither the "man" or "info" on sort -- can it sort hexadecimal? -n cannot. You are correct that we could improve the info page to make it explicit that -n sorts based on decimal values. You also raise a good point that it may be worth adding a new sorting option that sorts by hexadecimal. Although the existing practice of decorate/sort/undecorate to [temporarily] convert hex into decimal before sorting is going to be more portable, being able to directly sort hex does seem like something that may be worthwhile. > No information on whatsort considers to be a "numeral" or expects hexadecimal to be represented. I was justattempting to skip extra processes to convert the data or to write my own sort process. > Thank you for your efforts on my behalf. Do you know who handles the documentation?Maybe there is newer man/info than on this old machine. The info documentation is part of coreutils.git, so you've reached the right place. I'm going to reopen and retitle this bug to request the ability to do hex sorting. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
bug-coreutils@HIDDEN
:bug#30661
; Package coreutils
.
Full text available.Received: (at 30661) by debbugs.gnu.org; 1 Mar 2018 23:40:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 01 18:40:04 2018 Received: from localhost ([127.0.0.1]:39862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1erXnw-0004wk-00 for submit <at> debbugs.gnu.org; Thu, 01 Mar 2018 18:40:04 -0500 Received: from sonic303-4.consmr.mail.bf2.yahoo.com ([74.6.131.43]:42654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <james_a_bunke@HIDDEN>) id 1erXeT-0004jl-55 for 30661 <at> debbugs.gnu.org; Thu, 01 Mar 2018 18:30:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1519947011; bh=Jg1dkjveJSQDpbk52qAg2Iw592q+ZzUywxqfmdMhjR4=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=Y9eYA1pVuFqkRT15awMlfzmpGz4AYoPVZBl2WF7nSosBiGneftdUJKmkimdlMKDOZG6nHg9dY/SIW+OQWYsDzNcpMm75Oa15G1cSHMkFkkXpz9x5sp2HxVBwJvxquE9UoRF8LHnczhtjc5pzMeetxO13WKaR+xf4Eu+mOaFML1y+V8h9cJNkGWSWixxFvqsPxF79Ie8P3Io+u403y5oXApu8yUhGQp9EJJLuiIMTK7Mm12RHwiBRKYHQxqz3pSSUii65g/L8bZOye0OpfUB29H2El/2uzZ9X/mS6uvmjXelegYjzu274ZTrPtb4zZ62towFjWAd+5GkQ74FAhND3pg== X-YMail-OSG: G_CdVG0VM1lUq_RPlv1MKG.0DVzgcLYYYgLiPPs9GhyVci64lmTgMauicQQj4NB Q63pmIio5tXngVsig1hiwg0AmA5.eGTRltPy_fVNwF5zUN1jJrRj9ZOHOkZQEPCopiO0AyfQLIqj jzaKGK9Rd3ZKXMvXfclX0a.Ig87bppuC2._ufg1icXmed6dGdx9vqZULdUxRCJkJcdnsk75ZwsuS GLCribYElDazkxYfrt_gEwM3i13gxFMegyjFhB_ZejFyfr7YGJwfUO84_XMWjhwzWl7ZtdTWJruC MulVq49Fpq_pP70s0ybYi5MmVhksrapCRu423cDwAob9WjvZf7lbPcs0t0meIgxzMpxcUNFz7r7U NAta2UY74z0QvCdT1L_qgxYPPM7z_vlIVpQp.2SUoRrlbf_Re8KHpqKqZt0T4n3UDaeUr68N6EP9 x_Jatiwm2FXqifWHq4l79YpfiBaMcbbSGwHLEfPi2PCEnspcLDItn1vHnf2uMDaOuC1mNumbTb8a 6ed1XTighcIVaRLYYB.to5rmg Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.bf2.yahoo.com with HTTP; Thu, 1 Mar 2018 23:30:11 +0000 Date: Thu, 1 Mar 2018 23:29:59 +0000 (UTC) From: James Bunke <james_a_bunke@HIDDEN> To: "30661 <at> debbugs.gnu.org" <30661 <at> debbugs.gnu.org> Message-ID: <875362785.8854560.1519946999371@HIDDEN> In-Reply-To: <handler.30661.D30661.151992094413753.notifdone <at> debbugs.gnu.org> References: <0a0f61a9-3ed1-48f4-16cc-6d8e930001b5@HIDDEN> <820042476.8030674.1519861379922@HIDDEN> <handler.30661.D30661.151992094413753.notifdone <at> debbugs.gnu.org> Subject: Re: bug#30661: closed (Re: bug#30661: sort) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_8854559_960570759.1519946999362" X-Mailer: WebService/1.1.11419 YahooMailNeo Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0 Content-Length: 13254 X-Spam-Score: 1.8 (+) 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: $ echo -e "170\n11" | sort -n 11 170 $ echo -e "AA\nB" | sort -n AA B $ echo -e "0xAA\n0xB" | sort -n 0xAA 0xB Perhaps its the documentation that is lacking as I find no reference to hexadecimal ineither the "man" or "info" on sort -- can it sort hexadecimal? No information on whatsort considers to be a "numeral" or expects hexadecimal to be represented. I was justattempting to skip extra processes to convert the data or to write my own sort process. Thank you for your efforts on my behalf. Do you know who handles the documentation?Maybe there is newer man/info than on this old machine. [...] Content analysis details: (1.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (james_a_bunke[at]yahoo.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.6.131.43 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 1.8 FUZZY_XPILL BODY: Attempt to obfuscate words in spam 0.0 HTML_MESSAGE BODY: HTML included in message 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid X-Debbugs-Envelope-To: 30661 X-Mailman-Approved-At: Thu, 01 Mar 2018 18:40:02 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: James Bunke <james_a_bunke@HIDDEN> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 1.8 (+) 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: $ echo -e "170\n11" | sort -n 11 170 $ echo -e "AA\nB" | sort -n AA B $ echo -e "0xAA\n0xB" | sort -n 0xAA 0xB Perhaps its the documentation that is lacking as I find no reference to hexadecimal ineither the "man" or "info" on sort -- can it sort hexadecimal? No information on whatsort considers to be a "numeral" or expects hexadecimal to be represented. I was justattempting to skip extra processes to convert the data or to write my own sort process. Thank you for your efforts on my behalf. Do you know who handles the documentation?Maybe there is newer man/info than on this old machine. [...] Content analysis details: (1.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.6.131.43 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (james_a_bunke[at]yahoo.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 1.8 FUZZY_XPILL BODY: Attempt to obfuscate words in spam 0.0 HTML_MESSAGE BODY: HTML included in message 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid ------=_Part_8854559_960570759.1519946999362 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable $ echo -e "170\n11" | sort -n 11 170 $ echo -e "AA\nB" | sort -n AA B $ echo -e "0xAA\n0xB" | sort -n 0xAA 0xB Perhaps its the documentation that is lacking as I find no reference to hex= adecimal ineither the "man" or "info" on sort -- can it sort hexadecimal? N= o information=C2=A0 on whatsort considers to be a "numeral" or expects hexa= decimal to be represented. I was justattempting to skip extra processes to = convert the data or to write my own sort process. Thank you for your efforts on my behalf. Do you know who handles the docume= ntation?Maybe there is newer man/info than on this old machine. =20 On Thursday, March 1, 2018 11:16 AM, GNU bug Tracking System <help-debb= ugs@HIDDEN> wrote: =20 Your bug report #30661: sort which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 30661 <at> debbugs.gnu.org. --=20 30661: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D30661 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problemstag 30661 notabug thanks On 02/28/2018 05:42 PM, James Bunke wrote: > To: bug-coreutils@HIDDEN >=20 > This seems an oversight than an actual bug: >=20 >=C2=A0 =C2=A0=C2=A0=C2=A0 'sort -n' thinks "B" is a larger value than "AA"= -- yep! someone > forgot about hexadecimal, but binary, octal, and decimal work fine. Please demonstrate an actual command line that you typed and output you=20 got.=C2=A0 Here's what I tried in reproducing your claim: $ printf 'AA\nB\n' | LC_ALL=3DC sort --debug -n sort: using simple byte comparison AA ^ no match for key __ B ^ no match for key _ As I typed it, 'sort -n' outputs the line AA before the line B because=20 of fallback sorting rules (the entire line is used when none of the keys=20 produced a difference, and since neither line was numeric, they were=20 equivalently treated as '0' by -n), contrary to your claim that sort=20 takes 'B' first.=C2=A0 Therefore, I don't know if my attempt matches what y= ou=20 actually saw, as you did not give very many details other than a vague=20 verbal description of your issue. >=20 > Suggestion: Don't revert to alphanumeric sorting until the rules are > broken by the sort field: Sorry, but 'sort -n' behavior is specified by POSIX, and we can't change=20 it, as that would break scripts that expect POSIX behavior.=C2=A0 Most=20 likely, sort can already do what you want with additional command line=20 options, but I don't even know what data you want sorted, or what output=20 you actually want, to tell you what command line would give the output=20 you want.=C2=A0 The --debug option can be great at learning what sort is=20 actually doing (and how it is more likely that your request is=20 incomplete, rather than sort misbehaving). As such, I'm closing this as not a bug, as you have not demonstrated an=20 actual POSIX compliance issue; but do feel free to provide us with more=20 information, and we can reopen this if you actually do come up with=20 something that needs addressing beyond what sort can already do when=20 invoked correctly. --=20 Eric Blake, Principal Software Engineer Red Hat, Inc.=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 +1-919-301-3266 Virtualization:=C2=A0 qemu.org | libvirt.org To: bug-coreutils@HIDDEN This seems an oversight than an actual bug: =C2=A0=C2=A0=C2=A0 'sort -n' thinks "B" is a larger value than "AA" -- yep!= someone forgot about hexadecimal, but binary, octal, and decimal work fine. Suggestion: Don't revert to alphanumeric sorting until the rules are broken by the sort field: =C2=A0=C2=A0=C2=A0 1) There is an optional leading Plus(+) or Minus(-) but = just one. =C2=A0=C2=A0=C2=A0 2) There is an optional single Point(.) that may occur a= nywhere =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 within the field except before an opti= onal Plus or Minus. =C2=A0=C2=A0=C2=A0 3) Numerals are limited to "0123456789ABCDEFabcdef". =C2=A0=C2=A0=C2=A0 4) No white space, other letters, or other punctuation a= llowed or =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 revert to alphanumeric sort. Thank You, J.B. P.S.: Shouldn't be necessary to transform data to sort it... =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Use '-nx' or '-gx' if you must, but it shoul= dn't be needed. =20 ------=_Part_8854559_960570759.1519946999362 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <html><head></head><body><div style=3D"color:#000; background-color:#fff; f= ont-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font= -size:13px"><div id=3D"yui_3_16_0_ym19_1_1519943926768_9538"><span id=3D"yu= i_3_16_0_ym19_1_1519943926768_9791">$ echo -e "170\n11" | sort -n<br>11<br>= 170<br>$ echo -e "AA\nB" | sort -n<br>AA<br>B<br>$ echo -e "0xAA\n0xB" | so= rt -n<br>0xAA<br>0xB<br></span></div><div id=3D"yui_3_16_0_ym19_1_151994392= 6768_9580"><br><span></span></div><div id=3D"yui_3_16_0_ym19_1_151994392676= 8_9821"><span id=3D"yui_3_16_0_ym19_1_1519943926768_9820">Perhaps its the d= ocumentation that is lacking as I find no reference to hexadecimal in</span= ></div><div id=3D"yui_3_16_0_ym19_1_1519943926768_9794" dir=3D"ltr"><span i= d=3D"yui_3_16_0_ym19_1_1519943926768_9828">either the "man" or "info" on so= rt -- can it sort hexadecimal? No information on what</span></div><di= v id=3D"yui_3_16_0_ym19_1_1519943926768_10535" dir=3D"ltr"><span id=3D"yui_= 3_16_0_ym19_1_1519943926768_9828">sort considers to be a "numeral" or expec= ts hexadecimal to be represented. I was just</span></div><div id=3D"yui_3_1= 6_0_ym19_1_1519943926768_10534" dir=3D"ltr"><span id=3D"yui_3_16_0_ym19_1_1= 519943926768_9828">attempting to skip extra processes to convert the data o= r to write my own sort process.</span></div><div id=3D"yui_3_16_0_ym19_1_15= 19943926768_10572" dir=3D"ltr"><span id=3D"yui_3_16_0_ym19_1_1519943926768_= 9828"><br></span></div><div id=3D"yui_3_16_0_ym19_1_1519943926768_10565" di= r=3D"ltr"><span id=3D"yui_3_16_0_ym19_1_1519943926768_9828">Thank you for y= our efforts on my behalf. Do you know who handles the documentation?</span>= </div><div id=3D"yui_3_16_0_ym19_1_1519943926768_10599" dir=3D"ltr"><span i= d=3D"yui_3_16_0_ym19_1_1519943926768_9828">Maybe there is newer man/info th= an on this old machine.<br></span></div><div id=3D"yui_3_16_0_ym19_1_151994= 3926768_10564" dir=3D"ltr"><span id=3D"yui_3_16_0_ym19_1_1519943926768_9828= "> </span></div> <div class=3D"qtdSeparateBR"><br><br></div><div style=3D"d= isplay: block;" class=3D"yahoo_quoted"> <div style=3D"font-family: Helvetic= a Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;"> <di= v style=3D"font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lu= cida Grande, sans-serif; font-size: 16px;"> <div dir=3D"ltr"><font face=3D"= Arial" size=3D"2"> On Thursday, March 1, 2018 11:16 AM, GNU bug Tracking Sy= stem <help-debbugs@HIDDEN> wrote:<br></font></div> <br><br> <div cl= ass=3D"y_msg_container">Your bug report<br><br>#30661: sort<br><br>which wa= s filed against the coreutils package, has been closed.<br><br>The explanat= ion is attached below, along with your original report.<br>If you require m= ore details, please reply to <a ymailto=3D"mailto:30661 <at> debbugs.gnu.org." h= ref=3D"mailto:30661 <at> debbugs.gnu.org.">30661 <at> debbugs.gnu.org.</a><br><br>-- = <br>30661: <a href=3D"http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D30661"= target=3D"_blank">http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D30661</a>= <br>GNU Bug Tracking System<br>Contact <a ymailto=3D"mailto:help-debbugs@gn= u.org" href=3D"mailto:help-debbugs@HIDDEN">help-debbugs@HIDDEN</a> with p= roblems<div id=3D"ymsg50368" class=3D"ymsg1071832426" src=3D"mid://AGLWyQoA= AB4rWpgnQwm4SPMOd98/2"><div dir=3D"ltr">tag 30661 notabug<br></div><div dir= =3D"ltr">thanks<br></div><div dir=3D"ltr"><br></div><div dir=3D"ltr">On 02/= 28/2018 05:42 PM, James Bunke wrote:<br></div><div dir=3D"ltr">> To: <a = ymailto=3D"mailto:bug-coreutils@HIDDEN" href=3D"mailto:bug-coreutils@HIDDEN= rg">bug-coreutils@HIDDEN</a><br></div><div dir=3D"ltr">> <br></div><div= dir=3D"ltr">> This seems an oversight than an actual bug:<br></div><div= dir=3D"ltr">> <br></div><div dir=3D"ltr">> = 'sort -n' thinks "B" is a larger value than "AA" -- yep! someone<br></div><= div dir=3D"ltr">> forgot about hexadecimal, but binary, octal, and decim= al work fine.<br></div><div dir=3D"ltr"><br></div><div dir=3D"ltr">Please d= emonstrate an actual command line that you typed and output you <br></div><= div dir=3D"ltr">got. Here's what I tried in reproducing your claim:<b= r></div><div dir=3D"ltr"><br></div><div dir=3D"ltr">$ printf 'AA\nB\n' | LC= _ALL=3DC sort --debug -n<br></div><div dir=3D"ltr">sort: using simple byte = comparison<br></div><div dir=3D"ltr">AA<br></div><div dir=3D"ltr">^ no matc= h for key<br></div><div dir=3D"ltr">__<br></div><div dir=3D"ltr">B<br></div= ><div dir=3D"ltr">^ no match for key<br></div><div dir=3D"ltr">_<br></div><= div dir=3D"ltr"><br></div><div dir=3D"ltr">As I typed it, 'sort -n' outputs= the line AA before the line B because <br></div><div dir=3D"ltr">of fallba= ck sorting rules (the entire line is used when none of the keys <br></div><= div dir=3D"ltr">produced a difference, and since neither line was numeric, = they were <br></div><div dir=3D"ltr">equivalently treated as '0' by -n), co= ntrary to your claim that sort <br></div><div dir=3D"ltr">takes 'B' first.&= nbsp; Therefore, I don't know if my attempt matches what you <br></div><div= dir=3D"ltr">actually saw, as you did not give very many details other than= a vague <br></div><div dir=3D"ltr">verbal description of your issue.<br></= div><div dir=3D"ltr"><br></div><div dir=3D"ltr">> <br></div><div dir=3D"= ltr">> Suggestion: Don't revert to alphanumeric sorting until the rules = are<br></div><div dir=3D"ltr">> broken by the sort field:<br></div><div = dir=3D"ltr"><br></div><div dir=3D"ltr">Sorry, but 'sort -n' behavior is spe= cified by POSIX, and we can't change <br></div><div dir=3D"ltr">it, as that= would break scripts that expect POSIX behavior. Most <br></div><div = dir=3D"ltr">likely, sort can already do what you want with additional comma= nd line <br></div><div dir=3D"ltr">options, but I don't even know what data= you want sorted, or what output <br></div><div dir=3D"ltr">you actually wa= nt, to tell you what command line would give the output <br></div><div dir= =3D"ltr">you want. The --debug option can be great at learning what s= ort is <br></div><div dir=3D"ltr">actually doing (and how it is more likely= that your request is <br></div><div dir=3D"ltr">incomplete, rather than so= rt misbehaving).<br></div><div dir=3D"ltr"><br></div><div dir=3D"ltr">As su= ch, I'm closing this as not a bug, as you have not demonstrated an <br></di= v><div dir=3D"ltr">actual POSIX compliance issue; but do feel free to provi= de us with more <br></div><div dir=3D"ltr">information, and we can reopen t= his if you actually do come up with <br></div><div dir=3D"ltr">something th= at needs addressing beyond what sort can already do when <br></div><div dir= =3D"ltr">invoked correctly.<br></div><div dir=3D"ltr"><br></div><div dir=3D= "ltr">-- <br></div><div dir=3D"ltr">Eric Blake, Principal Software Engineer= <br></div><div dir=3D"ltr">Red Hat, Inc. = +1-919-301-3266<br></div><div dir=3D"ltr">Virtualization: qemu.org |= libvirt.org<br></div><div dir=3D"ltr"><br></div><div dir=3D"ltr"><br></div= ></div><div id=3D"ymsg25638" class=3D"ymsg1071832426" src=3D"mid://AGLWyQoA= AB4rWpgnQwm4SPMOd98/3"><div id=3D"yiv2442982841"><div><div style=3D"color:#= 000;background-color:#fff;font-family:Helvetica Neue, Helvetica, Arial, Luc= ida Grande, sans-serif;font-size:13px;"><div id=3D"yiv2442982841yui_3_16_0_= ym19_1_1519861150505_2033">To: bug-coreutils@HIDDEN<br><br>This seems an o= versight than an actual bug:<br><br> 'sort -n' thinks "B"= is a larger value than "AA" -- yep! someone<br>forgot about hexadecimal, b= ut binary, octal, and decimal work fine.<br><br>Suggestion: Don't revert to= alphanumeric sorting until the rules are<br>broken by the sort field:<br><= br> 1) There is an optional leading Plus(+) or Minus(-) b= ut just one.<br> 2) There is an optional single Point(.) = that may occur anywhere<br> within the = field except before an optional Plus or Minus.<br> 3) Num= erals are limited to "0123456789ABCDEFabcdef".<br> 4) No = white space, other letters, or other punctuation allowed or<br> = revert to alphanumeric sort.<br><br>Thank You,<br>= J.B.<br><br>P.S.: Shouldn't be necessary to transform data to sort it...<br= > Use '-nx' or '-gx' if you must, but it shou= ldn't be needed.<br><br></div></div></div></div></div><br><br></div> </div= > </div> </div></div></body></html> ------=_Part_8854559_960570759.1519946999362--
bug-coreutils@HIDDEN
:bug#30661
; Package coreutils
.
Full text available.Received: (at 30661-done) by debbugs.gnu.org; 1 Mar 2018 16:15:44 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 01 11:15:44 2018 Received: from localhost ([127.0.0.1]:39508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1erQrw-0003Zk-FV for submit <at> debbugs.gnu.org; Thu, 01 Mar 2018 11:15:44 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56190 helo=mx1.redhat.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eblake@HIDDEN>) id 1erQru-0003ZR-NF; Thu, 01 Mar 2018 11:15:43 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 53FCB4023112; Thu, 1 Mar 2018 16:15:37 +0000 (UTC) Received: from [10.10.122.122] (ovpn-122-122.rdu2.redhat.com [10.10.122.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AEC19C067; Thu, 1 Mar 2018 16:15:36 +0000 (UTC) Subject: Re: bug#30661: sort To: James Bunke <james_a_bunke@HIDDEN>, 30661-done <at> debbugs.gnu.org, GNU bug control <control <at> debbugs.gnu.org> References: <820042476.8030674.1519861379922.ref@HIDDEN> <820042476.8030674.1519861379922@HIDDEN> From: Eric Blake <eblake@HIDDEN> Organization: Red Hat, Inc. Message-ID: <0a0f61a9-3ed1-48f4-16cc-6d8e930001b5@HIDDEN> Date: Thu, 1 Mar 2018 10:15:36 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <820042476.8030674.1519861379922@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 01 Mar 2018 16:15:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 01 Mar 2018 16:15:37 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eblake@HIDDEN' RCPT:'' X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 30661-done X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) tag 30661 notabug thanks On 02/28/2018 05:42 PM, James Bunke wrote: > To: bug-coreutils@HIDDEN > > This seems an oversight than an actual bug: > > Â Â Â 'sort -n' thinks "B" is a larger value than "AA" -- yep! someone > forgot about hexadecimal, but binary, octal, and decimal work fine. Please demonstrate an actual command line that you typed and output you got. Here's what I tried in reproducing your claim: $ printf 'AA\nB\n' | LC_ALL=C sort --debug -n sort: using simple byte comparison AA ^ no match for key __ B ^ no match for key _ As I typed it, 'sort -n' outputs the line AA before the line B because of fallback sorting rules (the entire line is used when none of the keys produced a difference, and since neither line was numeric, they were equivalently treated as '0' by -n), contrary to your claim that sort takes 'B' first. Therefore, I don't know if my attempt matches what you actually saw, as you did not give very many details other than a vague verbal description of your issue. > > Suggestion: Don't revert to alphanumeric sorting until the rules are > broken by the sort field: Sorry, but 'sort -n' behavior is specified by POSIX, and we can't change it, as that would break scripts that expect POSIX behavior. Most likely, sort can already do what you want with additional command line options, but I don't even know what data you want sorted, or what output you actually want, to tell you what command line would give the output you want. The --debug option can be great at learning what sort is actually doing (and how it is more likely that your request is incomplete, rather than sort misbehaving). As such, I'm closing this as not a bug, as you have not demonstrated an actual POSIX compliance issue; but do feel free to provide us with more information, and we can reopen this if you actually do come up with something that needs addressing beyond what sort can already do when invoked correctly. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
James Bunke <james_a_bunke@HIDDEN>
:Eric Blake <eblake@HIDDEN>
:Eric Blake <eblake@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at submit) by debbugs.gnu.org; 1 Mar 2018 00:01:53 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 28 19:01:53 2018 Received: from localhost ([127.0.0.1]:38066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1erBfV-00024B-BI for submit <at> debbugs.gnu.org; Wed, 28 Feb 2018 19:01:53 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <james_a_bunke@HIDDEN>) id 1erBRJ-0001je-Pj for submit <at> debbugs.gnu.org; Wed, 28 Feb 2018 18:47:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <james_a_bunke@HIDDEN>) id 1erBRD-00019m-Fz for submit <at> debbugs.gnu.org; Wed, 28 Feb 2018 18:47:08 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.4 required=5.0 tests=BAYES_50,FORGED_YAHOO_RCVD, FREEMAIL_FROM,HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35383) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <james_a_bunke@HIDDEN>) id 1erBRD-00019Z-Cj for submit <at> debbugs.gnu.org; Wed, 28 Feb 2018 18:47:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <james_a_bunke@HIDDEN>) id 1erBRC-0000ue-4T for bug-coreutils@HIDDEN; Wed, 28 Feb 2018 18:47:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <james_a_bunke@HIDDEN>) id 1erBR8-00014u-5y for bug-coreutils@HIDDEN; Wed, 28 Feb 2018 18:47:06 -0500 Received: from sonic306-31.consmr.mail.bf2.yahoo.com ([74.6.132.230]:35164) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <james_a_bunke@HIDDEN>) id 1erBR7-00013D-P0 for bug-coreutils@HIDDEN; Wed, 28 Feb 2018 18:47:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1519861620; bh=o1iuvy21JBZTiFCwscMw9YoiOwZfPLOBU35vkWq4FqM=; h=Date:From:Reply-To:To:Subject:References:From:Subject; b=Qf7ZfyO+DaJHp5beuIP4PMNWrdjkbIhrarIv7RmW0koZhIoscyXIQ2Dd5SpS8JyZXrc29offa7kupBBYxMbwxOPBBA0agEc8Q+mp0SoA+eHwz1bVj4/bc2bWhJKz9FBGxhZQ4UzFtFxu/LbKSE3CUjjDDf252/0YBXqi+WxWtotg+eqWdqCLqK7ZcxNKpZYJoxoYzQT2WhYNAX2OWo4gT+i4cbVbxQRP3QD61t+KY8SKBvGcCYv6pmyS9x3YDJdPPp8WdcexVM8XklyDLRdE2T3v5BK1lO+Ie/ScQoBOomVhYMJ7t0FAILCZ8ADWj+S+DKtraNKV+x2vkQV6WZcKTw== X-YMail-OSG: Fi3uOrsVM1lU9kSe0QuKroKZEhbMT5DKcCGyOx0a3WkC1eMzQny9r0LdVlUilsd VJV0IT18X_K2N91ip_P67pT64T1XAOBuAf7h2gSJ66voqNwoJWpI3SZmhHuvSio9ym.SHv4s4t_u XnIjLc5QA8s2V01KxDwn36y8wwg4uu80lKBaNRzBU9qEx5T4L8XCKVhCfoE006068LwId_VNKsmz TNIW4R0dGvgRRfLznDqcPqBZDytIBJjgEd7LSCo0OEeQctkF9fQ2ChoVWwrUjm359ADpa.K9D5IG dnSAT6xJPFM9PuxqMMzz4.zQOxSO2MoFGPIFYeQL2v11qI_kFGBsi9BO4UPcSVOyK.9.PsjK4dGx LvNZQGbUBum.fXzpxKGisxdMsvzZlBtl9.rHA3ph5A7DYoqnl19phxKlwH6uRKStgHSNORrtqecd .xa6io1NmMAyrhIll_kmK9iq4U761eZj4y8cCcooYXRD.y8rwKn2qjb6mFRcLEpVyecletupetHf cLJKjc1sFgoTTresKWX6QTQt5afl04ObN.MiL85LgWP.sLNFxBFqb9To3a17b6g-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.bf2.yahoo.com with HTTP; Wed, 28 Feb 2018 23:47:00 +0000 Date: Wed, 28 Feb 2018 23:42:59 +0000 (UTC) From: James Bunke <james_a_bunke@HIDDEN> To: "bug-coreutils@HIDDEN" <bug-coreutils@HIDDEN> Message-ID: <820042476.8030674.1519861379922@HIDDEN> Subject: sort MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_8030673_1276334331.1519861379920" References: <820042476.8030674.1519861379922.ref@HIDDEN> X-Mailer: WebService/1.1.11419 YahooMailNeo Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0 Content-Length: 2619 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 28 Feb 2018 19:01:52 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: James Bunke <james_a_bunke@HIDDEN> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) ------=_Part_8030673_1276334331.1519861379920 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable To: bug-coreutils@HIDDEN This seems an oversight than an actual bug: =C2=A0=C2=A0=C2=A0 'sort -n' thinks "B" is a larger value than "AA" -- yep!= someone forgot about hexadecimal, but binary, octal, and decimal work fine. Suggestion: Don't revert to alphanumeric sorting until the rules are broken by the sort field: =C2=A0=C2=A0=C2=A0 1) There is an optional leading Plus(+) or Minus(-) but = just one. =C2=A0=C2=A0=C2=A0 2) There is an optional single Point(.) that may occur a= nywhere =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 within the field except before an opti= onal Plus or Minus. =C2=A0=C2=A0=C2=A0 3) Numerals are limited to "0123456789ABCDEFabcdef". =C2=A0=C2=A0=C2=A0 4) No white space, other letters, or other punctuation a= llowed or =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 revert to alphanumeric sort. Thank You, J.B. P.S.: Shouldn't be necessary to transform data to sort it... =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Use '-nx' or '-gx' if you must, but it shoul= dn't be needed. ------=_Part_8030673_1276334331.1519861379920 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <html><head></head><body><div style=3D"color:#000; background-color:#fff; f= ont-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font= -size:13px"><div id=3D"yui_3_16_0_ym19_1_1519861150505_2033">To: bug-coreut= ils@HIDDEN<br><br>This seems an oversight than an actual bug:<br><br> = ; 'sort -n' thinks "B" is a larger value than "AA" -- yep! some= one<br>forgot about hexadecimal, but binary, octal, and decimal work fine.<= br><br>Suggestion: Don't revert to alphanumeric sorting until the rules are= <br>broken by the sort field:<br><br> 1) There is an opti= onal leading Plus(+) or Minus(-) but just one.<br> 2) The= re is an optional single Point(.) that may occur anywhere<br> &n= bsp; within the field except before an optional Plus or M= inus.<br> 3) Numerals are limited to "0123456789ABCDEFabc= def".<br> 4) No white space, other letters, or other punc= tuation allowed or<br> revert to alphan= umeric sort.<br><br>Thank You,<br>J.B.<br><br>P.S.: Shouldn't be necessary = to transform data to sort it...<br> Use '-nx'= or '-gx' if you must, but it shouldn't be needed.<br><br></div></div></bod= y></html> ------=_Part_8030673_1276334331.1519861379920--
James Bunke <james_a_bunke@HIDDEN>
:bug-coreutils@HIDDEN
.
Full text available.bug-coreutils@HIDDEN
:bug#30661
; Package coreutils
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.