From unknown Mon Jun 23 16:44:42 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#22275 <22275@debbugs.gnu.org> To: bug#22275 <22275@debbugs.gnu.org> Subject: Status: a before null Reply-To: bug#22275 <22275@debbugs.gnu.org> Date: Mon, 23 Jun 2025 23:44:42 +0000 retitle 22275 a before null reassign 22275 coreutils submitter 22275 gregory mott severity 22275 normal tag 22275 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 30 11:52:40 2015 Received: (at submit) by debbugs.gnu.org; 30 Dec 2015 16:52:40 +0000 Received: from localhost ([127.0.0.1]:50577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aEJzL-0007Su-MF for submit@debbugs.gnu.org; Wed, 30 Dec 2015 11:52:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35377) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aEIxH-0005rI-6C for submit@debbugs.gnu.org; Wed, 30 Dec 2015 10:46:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEIxB-0000hZ-Db for submit@debbugs.gnu.org; Wed, 30 Dec 2015 10:46:22 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,HTML_MESSAGE, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEIxB-0000hV-AB for submit@debbugs.gnu.org; Wed, 30 Dec 2015 10:46:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEIxA-0008FS-IW for bug-coreutils@gnu.org; Wed, 30 Dec 2015 10:46:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEIx9-0000gq-Rn for bug-coreutils@gnu.org; Wed, 30 Dec 2015 10:46:20 -0500 Received: from mail-oi0-x232.google.com ([2607:f8b0:4003:c06::232]:35369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEIx9-0000gl-Lw for bug-coreutils@gnu.org; Wed, 30 Dec 2015 10:46:19 -0500 Received: by mail-oi0-x232.google.com with SMTP id l9so175576348oia.2 for ; Wed, 30 Dec 2015 07:46:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=whitleymott-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=guND9JfRnT4n1bLfhXPJblk0IvBx68wNRLCY4Lt64G8=; b=Yv8WjySa7u/MSsSUOkhm5csQ3olHCV5suN4HsxkA0wZMrOUuGO7idpkqenumOIVVLg C96rEm6/ideqjQ/8e6QOCmzpP89p5/52GX8tCZj2+7KuafSBDYPRIkEpgy5tb3fdL+/D 63Pc9xQFJhMoxC9EM9KdVLBoh//Y7kFM6s6Idn33mjYm5qEjZOeaKI/60SwswdrNBWJ8 5Zbc1Z3W36Kzkl0ay1qCZCCHHNpryASECyk4OSM9LU4Ey7tSTitVagGnFPcR5Z0KtdIR ImLQOaTGAe/exQMJ6PDobqdSafXWZHkLqF3rPKGAQPOexAO+RRsjSLfvJj27J2fjJAy8 RMHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=guND9JfRnT4n1bLfhXPJblk0IvBx68wNRLCY4Lt64G8=; b=CqJbaYiZuxwcXtyWlZjZezHCrv+rfA/qm0Y0IfTiPaX0b3mOZ7Ju9y/Nme3LwntQ3h 524fDWGn0x6MA1NQ7VDCNCab2+1QFkbH6NZSD68y8ET8KITc4vrelZLcNt4gXvchPKwJ 6n0FQOXKhjpLp7fC3EXIg2T+Td080qr6zhl0cf+Z2lrAOivTRqDVA5lhqMH05kPYOON3 9ju6Qa2UWc//N39Tcgf41dN9ssg+z348IHPmKSHLqLkl3vrX7Gvu/R+6+3Ou1JA3TCGo 2Hr/TCq1cdBBw6fWnHJQ4bIj9XXD+CS8WULwx8cpBVZHCR8DG1fhce3CTfSdvknAsG5M fiEQ== X-Gm-Message-State: ALoCoQkQGcbGirneWqNE9MHt0Usa0hgnqmPPvC9oZ/D/sXM/jRm1o8WmkMBpu/ORTnjMmaAfx8x+bf5C5HbJGo6gpXpW+In+vw== MIME-Version: 1.0 X-Received: by 10.202.81.18 with SMTP id f18mr41609589oib.68.1451490378643; Wed, 30 Dec 2015 07:46:18 -0800 (PST) Received: by 10.202.214.199 with HTTP; Wed, 30 Dec 2015 07:46:18 -0800 (PST) Received: by 10.202.214.199 with HTTP; Wed, 30 Dec 2015 07:46:18 -0800 (PST) In-Reply-To: References: Date: Wed, 30 Dec 2015 09:46:18 -0600 Message-ID: Subject: a before null From: gregory mott To: bug-coreutils@gnu.org Content-Type: multipart/alternative; boundary=001a113b19ca6a2dcf05281f7050 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 30 Dec 2015 11:52:38 -0500 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: -4.1 (----) --001a113b19ca6a2dcf05281f7050 Content-Type: text/plain; charset=UTF-8 in what circumstances is this a sensible and/or desirable result?: $ sort -V< 7.7z > 7a.7z > eoi 7a.7z 7.7z --001a113b19ca6a2dcf05281f7050 Content-Type: text/html; charset=UTF-8

in what circumstances is this a sensible and/or desirable result?:

$ sort -V<<eoi
> 7.7z
> 7a.7z
> eoi
7a.7z
7.7z

--001a113b19ca6a2dcf05281f7050-- From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 30 13:01:53 2015 Received: (at 22275) by debbugs.gnu.org; 30 Dec 2015 18:01:53 +0000 Received: from localhost ([127.0.0.1]:50605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aEL4K-0000ia-Q6 for submit@debbugs.gnu.org; Wed, 30 Dec 2015 13:01:52 -0500 Received: from mail-qg0-f50.google.com ([209.85.192.50]:35070) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aEL4K-0000iP-0W for 22275@debbugs.gnu.org; Wed, 30 Dec 2015 13:01:52 -0500 Received: by mail-qg0-f50.google.com with SMTP id o11so188237232qge.2 for <22275@debbugs.gnu.org>; Wed, 30 Dec 2015 10:01:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=ywFY33VOLmCtUyqW6qtWzcb5oD+EhQafjLxjfHHMClQ=; b=nr3pzihx3lPMHN++1Nhwbap17JJKu6F4oXwQEQxGvJWsqZqjsD9ye9/kPaajK/svEo FvXgM4G32HeDIC5E+3KpP0RGLev0lftkcVGAyOheqMoVvEyH5Lsnc5yE+DBCG0TYfyiZ iL2Qwu3piIuY8UdJ46AP83LSV/f0kXg7tFBhpQo3cbKXnZcEGawCOCvOlasPZySIjNYw 4YgTi3iJR75k8XSfK2Kp//g/DRUbP10Os2lj1D9puX8Qrdbs7J6Y0MBm8ANV912IQeS5 A87WtDe8BHKyV1h06rE5oVdDoSww8fuKQvFBruu3VF9LnfnbPyIJZvxF2HRcuBnhJmXR 5h6Q== X-Received: by 10.140.225.9 with SMTP id v9mr19613612qhb.89.1451498506315; Wed, 30 Dec 2015 10:01:46 -0800 (PST) Received: from disco.erlich.nygenome.org ([69.74.14.178]) by smtp.googlemail.com with ESMTPSA id d195sm9753054qhc.17.2015.12.30.10.01.45 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Dec 2015 10:01:45 -0800 (PST) Subject: Re: bug#22275: a before null To: gregory mott , 22275@debbugs.gnu.org References: From: Assaf Gordon Message-ID: <56841C57.7050701@gmail.com> Date: Wed, 30 Dec 2015 13:03:03 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22275 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.7 (/) tag 22275 notabug close 22275 stop Hello Gregory, On 12/30/2015 10:46 AM, gregory mott wrote: > in what circumstances is this a sensible and/or desirable result?: > > $ sort -V< > 7.7z > > 7a.7z > > eoi > 7a.7z > 7.7z GNU sort's "-V" option is modeled after Debian's version sorting algorithm, explained here: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version The goal of this algorithm is to sort version of Debian packages, hence it has some particular rules. First, see that it is consistent with Debian's sorting rules: $ dpkg --compare-versions '7.7z' gt '7a.7z' && echo greater greater That is, '7.7z' is *greater* (=comes after) '7a.7z' - thus 'sort -V' is correct (or at least - consistent with the defined algorithm). Second, Examining why is that the case based on the algorithm: The Debian policy says (paraphrasing): 1. compare the non-digits part 1.1 letters sorts earlier than any non-letter 1.2 except tilde which comes before anything else 2. compare the digits part 3. repeat And so the break-down of the compared parts in your two strings are: 1. "7" vs "7" 2. "." vs "a." 3. "7" vs "7" 4. "z" vs "z" If I understand correctly, your expectation was that the string is split by dots, hence it is "null" vs "a". However, the algorithm compares "." vs "a.", and sorts letters earlier than non-letters (see step 2 above. note that steps 3 and 4 are not actually performed, since the result of step 2 is not equal). Third, What is the purpose of such ordering? That is a question for the Debian Policy writer, however I could hypothesize that they considered versions such as "7a", "7b" to be "7alpha" and "7beta", and so when version "7" is released - it is "newer" (and therefore must sort after the alpha/beta ones). As such, this is not a bug in gnu sort, and I'm closing the bug, but comments are welcomed and the discussion can continue by replying to this thread. regards, - assaf P.S. For reference, the string-version comparison implementation is in gnulib, in this file: http://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/filevercmp.c From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 24 17:39:49 2018 Received: (at control) by debbugs.gnu.org; 24 Oct 2018 21:39:49 +0000 Received: from localhost ([127.0.0.1]:40842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFQsX-0000jx-0m for submit@debbugs.gnu.org; Wed, 24 Oct 2018 17:39:49 -0400 Received: from mail-pf1-f178.google.com ([209.85.210.178]:40484) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFQsV-0000jl-LS for control@debbugs.gnu.org; Wed, 24 Oct 2018 17:39:47 -0400 Received: by mail-pf1-f178.google.com with SMTP id g21-v6so3079726pfi.7 for ; Wed, 24 Oct 2018 14:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=NsFINI551aeFTTf9YE58DSJ+D6IeBTmzdFouLiCikzU=; b=dDrqiFPM264u/iMLF+7DNs3OclyFnvJLrQenz+p4wIM274/6v9XQjjyde/GrxwUpnk Rsv3wfZAhusl2WHlelDTaIDise3rHIHXoBnyHdTBjkP385BRapUqUpgyh/20O3NgiJB3 HZobk23RkX57XmYnHvTzApMhBLJyc2EYWK6zkRaHoy11ZCwH5D+KSWEBc4cQ6XqS59L3 fC2IsxUOX83PL/oBlSymMQQn27xrbDAVEo2yz2ypcEISCtIEeu/CQhZrzEvGIWU31nVu MFZz4edvaNfFQtKG0L63aL0LXu/xh4PLY1uo8qhbkFF+KkFBM+ljnVgYHt95xPMWdLyw YJ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=NsFINI551aeFTTf9YE58DSJ+D6IeBTmzdFouLiCikzU=; b=NbpcMl2iebz/V5v7IdbbVQa11gB7vPZF72V5EFBuxqwigjhz4zGEGywYUIzPXBOawU ZLxRZEAtG4Kr2vo4LhkwRn0tN1KXKLOj7IG3dpJ7wxQTI1ozErWmqLRkrrRyrz8B+sD3 vlmJvd2C56nu0Shd8iNUt/JcUU7afPrJArecZvHcKnRn/e6LUWpcfiil3Ix77WKDTBS6 0CoNSX9B4Xpx2pv1LipoYzksAK+Y7yPtlg4wNyJYVt+bH6t6zMy9lRB8a0XSOQKtW6f4 o1P2LuJNpZ2D6p5mDi/T2gP/mcqU/pM+9rQLypS/bp5Q2xteBbYrkHnEjnYCVrlkOCl0 PTSw== X-Gm-Message-State: AGRZ1gLdMnDWO6jNUpSBg7/ZANzXj40f/xoXKSlhyrFKZ0fJrNxyzpHY UWZRf261geaGJW0FkatehVUMRm2wv8g= X-Google-Smtp-Source: AJdET5fw1FXpo8FRqL2wdeIfHSp69sSyJCM6j+6b4bEZjMhA369XJSHhuKOT5ymudbRcdoOV6CI3Mg== X-Received: by 2002:a63:ef0b:: with SMTP id u11-v6mr4040005pgh.283.1540417181469; Wed, 24 Oct 2018 14:39:41 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id c62-v6sm11078224pfb.147.2018.10.24.14.39.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 14:39:40 -0700 (PDT) To: control@debbugs.gnu.org From: Assaf Gordon Message-ID: Date: Wed, 24 Oct 2018 15:39:39 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) 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 22275 notabug close 22275 [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.210.178 listed in list.dnswl.org] 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_H3 RBL: Good reputation (+3) [209.85.210.178 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control 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: 1.0 (+) tags 22275 notabug close 22275 From unknown Mon Jun 23 16:44:42 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 22 Nov 2018 12:24:10 +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