From patchwork Wed Nov 25 12:35:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 41191 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A749C385DC2E; Wed, 25 Nov 2020 12:35:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A749C385DC2E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1606307729; bh=+JtGANTRARMuMP9fM8LpqCzNrRVqFjCiXp3TiWf0aPI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=uqoYlS694WS2W/mWUXomw6idZLZ0IPVNBtDqGaaqVsmIhCFHKe/agK7sr/5rPawkA lpDYzDt+gHg0m9zv5kdZrHBIYDMmYV3iJomcT8Ax+IPZ65E9F4rcYVNqG6LNeygkJt xlArTm2FJcj7H+VDRA4g6pYGGD+oLhiMRFK/ZWHs= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id C838C385DC2E for ; Wed, 25 Nov 2020 12:35:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C838C385DC2E Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-ViPR-q5VOgimIMBLys5NFA-1; Wed, 25 Nov 2020 07:35:25 -0500 X-MC-Unique: ViPR-q5VOgimIMBLys5NFA-1 Received: by mail-wr1-f71.google.com with SMTP id l5so726090wrn.18 for ; Wed, 25 Nov 2020 04:35:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:subject:gcc:organization:from:message-id:date; bh=+JtGANTRARMuMP9fM8LpqCzNrRVqFjCiXp3TiWf0aPI=; b=TYdniIef1LAHsDkMVOhkjwz63u6yWcgnTnANV8Jcv4+tRIva1tYcoXVgj5iTYiDNtF iBKqio/wFB1u3HjgeLy0uOEsFTOnbRyYeosCIRg03Pbyl1+dH3VxG37AUXK/0YRKMt6H aSytlUGfFAKLlTDn78yNSVZVv5LaRjRdQQbId6q4Zy7M8Ciep/vPd0k5l+2E66zEPSfn rNPT0hF57zuJ8wWKJXKjHqlN3THhsrJGIGRg2Tsr8WuKGMUowQbZu4oc5OZdM1xlX9UB HN4WsObKDHZjmdBhYecIYOyDaihsEO56tieFPG/x3u6O2y0Flo1UYO/JEB8wkjz1liF+ nJ6g== X-Gm-Message-State: AOAM533mm9YbTG1yDO1OrFJpew6jxt9ue/d1Q/MkbdbtxmPgTSAFgE+b cqEExDvl+p86ax4dRBFATyA5Spoe3eL/tQucUvcQKOAjOJoIWtf6IfDC3clDnzlM6BjAYThHR9K YAI9OgAHNUt6ZmTcMrfDUoQUNKF1CDmsiOpVyy+Xl07mBtXRBgTBDLZzPwk7eNj8OLlqy X-Received: by 2002:a1c:660b:: with SMTP id a11mr3727883wmc.159.1606307723809; Wed, 25 Nov 2020 04:35:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/uGPm8Zk5Hg+WPW7WD6iH1xhzjtIO//2Ws6hJ3AG4tWiRcNP1ZiRsj93ICTUj7XmvOfmZhg== X-Received: by 2002:a1c:660b:: with SMTP id a11mr3727858wmc.159.1606307723540; Wed, 25 Nov 2020 04:35:23 -0800 (PST) Received: from localhost ([2a01:e0a:1a0:d060:5246:5dff:feab:d19c]) by smtp.gmail.com with ESMTPSA id q17sm5593394wro.36.2020.11.25.04.35.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 04:35:22 -0800 (PST) Received: by localhost (Postfix, from userid 1000) id 931F4581C97; Wed, 25 Nov 2020 13:35:21 +0100 (CET) To: libabigail@sourceware.org Subject: [PATCH] abipkgdiff: Avoid uncertainty when sorting worker tasks X-Operating-System: Fedora 34 Gcc: nnimap+lcl:rht/Sent X-URL: http://www.redhat.com Organization: Red Hat / France Message-Id: <20201125123521.931F4581C97@localhost> Date: Wed, 25 Nov 2020 13:35:21 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.2 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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" Hello, Worker tasks that have compared the binaries of two packages are sorted according to the sizes of the binaries they compared. The tasks that compared bigger binaries come first. So the output of these tasks is always sorted the same. When two tasks have sorted binaries of the same size, let's sort them by taking into account the lexicographic order of the binaries names. This reduces the sorting uncertainty due to having same size binaries. * elf_size_is_greater: Take the name of the binaries into account when their size is equal. Also, assert that all comparison tasks have compared binaries. Signed-off-by: Dodji Seketeli --- tools/abipkgdiff.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc index 6d3f5e79..2968338a 100644 --- a/tools/abipkgdiff.cc +++ b/tools/abipkgdiff.cc @@ -2524,10 +2524,17 @@ elf_size_is_greater(const task_sptr &task1, compare_task_sptr t1 = dynamic_pointer_cast(task1); compare_task_sptr t2 = dynamic_pointer_cast(task2); - off_t s1 = t1->args ? t1->args->elf1.size + t1->args->elf2.size : 0; - off_t s2 = t2->args ? t2->args->elf1.size + t2->args->elf2.size: 0; + ABG_ASSERT(t1->args && t2->args); + off_t s1 = t1->args->elf1.size + t1->args->elf2.size; + off_t s2 = t2->args->elf1.size + t2->args->elf2.size; + + if (s1 != s2) + return s1 > s2; + + // The sizes of the compared binaries are the same. So sort them + // lexicographically. + return t1->args->elf1.name < t2->args->elf1.name; - return s1 > s2; } /// This type is used to notify the calling thread that the comparison