Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nB12y-0005dU-L0 for mharc-grub-devel@gnu.org; Fri, 21 Jan 2022 16:02:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nB12v-0005XY-P5 for grub-devel@gnu.org; Fri, 21 Jan 2022 16:02:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58618) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nB12s-0000Ip-LE for grub-devel@gnu.org; Fri, 21 Jan 2022 16:02:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642798924; 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=FZFSccrxOZSlcsBoBOyw2wrYgUTagl1t7dJ9A1dvFBRI1PcbEaYlWXh07RvpVmCzxLRgfn DRl9DvnQT6PJXHu0FONdQpv+58mkaiqCy/2Ltw4vpynEQcFu335SNsFXE8bx2FBl9aQAtv T7grF9I8qDkzdSd5AtcHXFgSelHMCp0= 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-608-Sw4YFOLANXaJnP-0JwcclA-1; Fri, 21 Jan 2022 16:02:01 -0500 X-MC-Unique: Sw4YFOLANXaJnP-0JwcclA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF3DB839A43; Fri, 21 Jan 2022 21:02:00 +0000 (UTC) Received: from eesha.redhat.com (ovpn-0-18.rdu2.redhat.com [10.22.0.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13BA74D732; Fri, 21 Jan 2022 21:01:59 +0000 (UTC) From: Robbie Harwood To: grub-devel@gnu.org Cc: development@efficientek.com, Robbie Harwood Subject: [PATCH v4 1/2] Correct sorting of kernel names containing '_' Date: Fri, 21 Jan 2022 16:01:54 -0500 Message-Id: <20220121210155.23956-2-rharwood@redhat.com> In-Reply-To: <20220121210155.23956-1-rharwood@redhat.com> References: <20220121210155.23956-1-rharwood@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.133.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.699, 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: Fri, 21 Jan 2022 21:02:10 -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