From patchwork Thu May 18 13:03:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos O'Donell X-Patchwork-Id: 1783291 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=YE2wAbna; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QMVXm0rKdz20dn for ; Thu, 18 May 2023 23:03:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 223003846441 for ; Thu, 18 May 2023 13:03:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 223003846441 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684415030; bh=9kfBzqtUsFTzXCS5ZQ98FtJaB0JCwgpq02d7neImgrU=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=YE2wAbnac0CYihQbMzuGFol6ZIZciSSG6Dc2N8qjxq14UlXxCln+wLyRL9emE8DKa n3LNaeMlPl5/PMnbhWwP91ajwGhYkJ4gGK8k9HGwf/QqR+mCAK9/UNxTTr6lAPlg0B tAwyH7tkM0shVpru+wqIZaj5k1lv2NtjquE5KOhQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id B0DA93858C5F for ; Thu, 18 May 2023 13:03:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B0DA93858C5F Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-617-I5IPc7TCOLKWPV8Q1biLHA-1; Thu, 18 May 2023 09:03:31 -0400 X-MC-Unique: I5IPc7TCOLKWPV8Q1biLHA-1 Received: by mail-yb1-f199.google.com with SMTP id 3f1490d57ef6-ba83fed51adso3562331276.0 for ; Thu, 18 May 2023 06:03:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684415010; x=1687007010; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9kfBzqtUsFTzXCS5ZQ98FtJaB0JCwgpq02d7neImgrU=; b=R0HLb88Jk8L+bN/Cqj1Ze9i/EsklzYRmhHRPKvnUhWWWvsa1PGjtp/fB10NN/2BX8J NVR5QwSPXT3O8oMv7tN9NErXefaquYp9f/MEZSs0jS1pVewyqPRAiCqdIzFfdvCvnc4N qne8+1ofK5JJW8RoLUH0lFEiEjce/X0BI/ZkuVYZ1G+xSzNPj9ek9qqdb6mXLPM/lyOW EjmUCxn4bg3v+JVW8EBxysAC+6E2zsJcrC8TJVDZLAdKPBK5hJ8FUd1ST/lvKF/Nyh8Q RyHcc+sF+2sZT2OW+LLm1MdFrfLSh4/B/GzHabR2awDymfcYF0Y8hCMSzCH5e62uwDsf kniw== X-Gm-Message-State: AC+VfDwGFysehcIMWuKwLrQ6t8IQNi4ELNq2uAxFa92WlLeTOD1/6D42 GoBoSxSXagoGZ7/pZsjaQHxpmGQtmxuX0XKccvnBvo/dcWV/tpqRKEQiIm0/RTiUIqMrC9JYgH+ e8zwwISlF7a0m+n3jnLLz/rGPa95jnWn7wNV3JouZ/VdOmpKG3YOrYpW6DdM2bGSVhdWM0JJeF0 Milg== X-Received: by 2002:a25:aaa1:0:b0:ba7:24e8:bcf8 with SMTP id t30-20020a25aaa1000000b00ba724e8bcf8mr1545534ybi.49.1684415009885; Thu, 18 May 2023 06:03:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ62uiahfAYM0fSRg5Ag8HtUbCF5TDt1te9aN0NmRuA4umBoQoDJTqNfsHrgnIfVPARU8YSSGw== X-Received: by 2002:a25:aaa1:0:b0:ba7:24e8:bcf8 with SMTP id t30-20020a25aaa1000000b00ba724e8bcf8mr1545476ybi.49.1684415009211; Thu, 18 May 2023 06:03:29 -0700 (PDT) Received: from DESKTOP-1DH6NSL.localdomain ([198.48.244.52]) by smtp.gmail.com with ESMTPSA id a3-20020a81bb43000000b0054c0a8ceb2fsm406033ywl.28.2023.05.18.06.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 06:03:28 -0700 (PDT) To: libc-alpha@sourceware.org, siddhesh@gotplt.org Cc: Carlos O'Donell Subject: [PATCH 1/5] scripts: sort-makefile-lines.py Date: Thu, 18 May 2023 09:03:21 -0400 Message-Id: <20230518130325.59309-2-carlos@redhat.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518130325.59309-1-carlos@redhat.com> References: <20230518130325.59309-1-carlos@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Carlos O'Donell via Libc-alpha From: Carlos O'Donell Reply-To: Carlos O'Donell Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" We must return < 0, 0, or > 0 as the result of the comparison function for cmp_to_key() to work correctly across all comparisons. Reviewed-by: Siddhesh Poyarekar --- scripts/sort-makefile-lines.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/sort-makefile-lines.py b/scripts/sort-makefile-lines.py index fd657df970..c0badebf8c 100755 --- a/scripts/sort-makefile-lines.py +++ b/scripts/sort-makefile-lines.py @@ -102,7 +102,10 @@ def glibc_makefile_numeric(string1, string2): # string1 and string2 both share a prefix and # have a numeric suffix that can be compared. # Sort order is based on the numeric suffix. - return int(var1.group(1)) > int(var2.group(1)) + # If the suffix is the same return 0, otherwise + # > 0 for greater-than, and < 0 for less-than. + # This is equivalent to the numerical difference. + return int(var1.group(1)) - int(var2.group(1)) # Default to strcoll. return locale.strcoll(string1, string2)