Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nAaaM-0005i2-Ui for mharc-grub-devel@gnu.org; Thu, 20 Jan 2022 11:46:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAaZK-0005co-FR for grub-devel@gnu.org; Thu, 20 Jan 2022 11:45:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27553) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAaZH-0007ri-9x for grub-devel@gnu.org; Thu, 20 Jan 2022 11:45:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642697146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vF0jth6DoSO131GhU6+OBGMMY8AAGjgCPXMAyis8VQM=; b=W5dr9lvrLpQHqiqJx0SPUDVm7aT4RVNww7/MOtxEVQa3q9ILm++JHDXB6o+7bsKQceOApJ mUYvHUhDXEgxdyME1V81y01BzI587IxueCIKfNdeCjMOW65pniE6CPNslzvQPForReI2M9 X3MNxG9fF8nrQJAvzb3a6SC14wos8Bs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-347-8lOAP4uYN4e8Pp8c_VB9FA-1; Thu, 20 Jan 2022 11:45:35 -0500 X-MC-Unique: 8lOAP4uYN4e8Pp8c_VB9FA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D022363A5; Thu, 20 Jan 2022 16:45:34 +0000 (UTC) Received: from eesha.redhat.com (unknown [10.22.48.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id E96F07E414; Thu, 20 Jan 2022 16:45:33 +0000 (UTC) From: Robbie Harwood To: grub-devel@gnu.org Cc: development@efficientek.com, Robbie Harwood Subject: [PATCH v2 1/2] Correct sorting of kernel names containing '_' Date: Thu, 20 Jan 2022 11:45:22 -0500 Message-Id: <20220120164523.8841-2-rharwood@redhat.com> In-Reply-To: <20220120164523.8841-1-rharwood@redhat.com> References: <20220120164523.8841-1-rharwood@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=rharwood@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=170.10.129.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2022 16:46:32 -0000 sort(1) from GNU coreutils does not treat underscore as part of a version number for `sort -V. This causes misorderings on x86_64, where e.g. kernel-core-3.17.6-300.11.fc21.x86_64 will incorrectly sort *before* kernel-core-3.17.6-300.fc21.x86_64. To cope with this behavior, replace underscores with dashes in order to approximate their intended meaning as version component separators. Fixes: https://savannah.gnu.org/bugs/?42844 Signed-off-by: Robbie Harwood --- util/grub-mkconfig_lib.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in index 301d1ac22..23d41475f 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -243,8 +243,8 @@ version_test_numeric () version_test_gt () { - version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//"`" - version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//"`" + version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//" -e "s/_/-/g"`" + version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//" -e "s/_/-/g"`" version_test_gt_cmp=gt if [ "x$version_test_gt_b" = "x" ] ; then return 0 -- 2.34.1